Is there an API available to start K6 test run or any alternate such as curl if I want to start K6 test run on a remote windows server? - performance-testing

In a remote server is there an option or way to start the K6 process / load test using an API or curl command.
Example: I would like to start the k6 load test in machine 2 from machine 1

You can run a Bash script on the remote windows server using SSH. The bash script would contain the k6 run command.
Running Bash script on remote windows server:
https://unix.stackexchange.com/questions/120898/running-bash-script-on-a-remote-windows-machine

Related

How to execute linux commands on a remote ubuntu server using symfony4?

I want to execute some linux commands like docker run nginx on a remote Ubuntu server. Let's say host A using my client interface on another host B developed in symfony4 and then the server (host A) will send some info after executing the command to the client interface on host B to be displayed on it.
How to achieve this?
at first you need to log in:
ssh username#ip_address_of_server_with_symfony4
Then
cd /path/to/symfony4
Then
docker exec symfony_container_php php bin/console command:name --arguments
If you need to run single command from your local computer, you also can use ssh -t
ssh -t user#ip full;command;separated with;-es

running SSH script command from jenkins using SSH

To deploy application on linux ubuntu server I have bunch of SSH commands that i currently run using PuTTY. The server has local account serviceaccount1. In PuTTY i connect to server using serviceaccount1 and executes the following commands one by one
cd /home/serviceaccount1/cr-ml
script /dev/null
screen -S data_and_status
cd cr-ml/notebooks
source activate crml
unset XDG_RUNTIME_DIR
jupyter kernelgateway --api='kernel_gateway.notebook_http' --seed_uri='data_and_status_api.ipynb' --port 8894 --ip 0.0.0.0
...
...
and so on
Now i want automate this using Jenkins. I installed SSH plugin, configured credential using SSH Username serviceaccount1 with private key
Then created a new jenkins project and added a build step Execute shell scripts on remote host using ssh and then add all the above commands.
When i build the jenkins project, it get stuck at executing 2nd command script /dev/null
i see the following console output
To me, it seems the culprit is the screen -S data_and_status command. Once you start a screen, I don't think you would be able to execute the subsequent commands over the SSH connection.
Alternatively, you can try using a tool like Ansible to run a bunch of commands against a remote server.

Why would netcat work fine from commandline but fail in a jenkins build?

I have a shell script running in a build server, that kicks off a huge virtual machine and then waits for a message on a port with:
nc -vv -l -p 9090
The huge virtual machine runs a super-complicated script which includes the following simple statement when it completes its task:
echo Completed | nc -vv -w10 $TARGET_IP 9090
Where TARGET_IP is a statically configured IP address of the build server.
This all works fine when I initiate the script on the command line.
However, when I incorporate the very same script into a Jenkins build, on the very same machine, the nc call in the script on the huge vm fails with:
/var/lib/cloud/instance/user-data.txt: line 11: echo: write error: Broken pipe
What could cause this strange difference in behaviour?
Environment is Ubuntu 16.04 LTS on AWS EC2.

Executing node.js script remotely

I am setting continuous integration using Jenkins server for my Node.js application. For deployment I am using a powershell script and for that I have installed powershell plug-in. The script will need to perform the following tasks in the order.
# Step1
# Stop all the currently running services on web server. For that I am trying to
# execute maintenance.js remotely from the build server under node
node \\SharedWebServerFolder\Utilities\maintenance.js stopServices
# Step2
# Copies all the resources to server at \\SharedServerWebFolder
# Step3
# Start the services
node \\SharedWebServerFolder\Utilities\maintenance.js startServices
I have no problem executing Step2. My question is about Step1 and Step3.
Should I execute maintenance.js remotely from the build server? Is this even possible? ( Assume I have installed node.js on the build server)
Should I have one more PowerShell script on the web server which executes maintenance.js locally? So basically deployment script (from build server) will execute remote PowerShell script (which is on web server) and that remote PowerShell script will execute maintenance.js locally. In this scenario I don't have to install Node.js on the build server.
What is recommended?
People generally use ssh to execute commands remotely. I think you want to execute a command from your build server on your production / staging server.
see linux execute command remotely
this is simple where the remote box is a linux box.
If your remote is a Windows box then you can still run an ssh server on it but its more painful to setup. you might try Bitvise SSH Client.
Once your ssh client is setup correctly you should be able to execute remote commands from your build server.
I have used Jenkins SSH Plugin for deployment in my remote staging/production servers.I would recommend to execute your 'maintenance.js' in web server machine instead of your build server.You can just trigger 'maintenance.js' execution in staging/production servers from build server using ssh.I believe the execution of 'maintenance.js' remotely from the build server is hard to achieve.

Bash Script output to rest api call

I need to monitor a Linux server using bash script so scenario is like this
I have a bash script which can monitor a Linux service and it shows
result right
Now I need to show the result of bash script to port
8080 or any port like http://192.168.2.1:8080 and it will show
status code 200 or error, So when I hit http://192.168.2.1:8080 it will execute the bash script and get result and show it
Note: No web service is running right now on server
I would recommend using CGI. There go some links:
Setup apache: http://httpd.apache.org/docs/2.2/howto/cgi.html
Shell scripts: http://www.yolinux.com/TUTORIALS/LinuxTutorialCgiShellScript.html
If you need to grab GET / POST parameters: https://marc.waeckerlin.org/computer/blog/parsing_of_query_string_in_bash_cgi_scripts
Regards,

Resources