Protocol Overview
SSH (Secure Shell) is a cryptographic network protocol for operating network services securely over an unsecured network. The best known example application is for remote login to computer systems by users. Read more on Wikipedia.
Implemented features
Currently SSH protocol allows you to add SSH servers to monitor if it is available, and to execute your own scripts. In case of executing your own script, it will return the information about the execution status and a returned numerical value (if possible).
There are 3 possible usage scenarios:
- Check only if SSH service is up&running without executing any command on the remote host. In this scenario the test is successful when the SSH connection has been made.
- Check the SSH connectivity and execute a script or program on remote host. In this case test is successful when the SSH connection has been made, script was able to execute and returned the exit code 0.
- Check the result of a script execution and parse its result. In this scenario to mark the test successful, the condition from scenario no. 2 has to be met and the script output has to contain the expected value (e.g. if the script ends with a result message "Free disk space 543MB" value of 543 will be used as a returned value).
Our implementation supports authentication methods which use:
- username and password,
- username and private key,
- username, private key and password.
If you want to execute your own script, it is important to fill in the timeout script execution field. It is an approximated execution time for your script. Obviously, if your script will execute faster than you've expected, the test will finish faster, but in another case your service will be set as timeouted and flagged as failure.
Protocol settings
Pulse - Monitoring Tool for JIRA SSH protocol allows you to run inline scripts (i.e df -h -m .|awk '{ print $2}'|tail -1 ) but also to execute already existing scripts in your system. To run an existing script on your server, write an execution command just like in the shell (i.e ./home/user1732/Documents/sctipts/notifyLowMem.sh). Remember that some users may do NOT have the access to some files or execution permissions. Most operating systems inform you about this situation and Pulse - Monitoring Tool for JIRA also throws the information about this. Otherwise you would just be informed about an unsuccessfully running script.
Currently Pulse - Monitoring Tool for JIRA allows you to specify "correct" or "expected" values for each of supported protocols. These values must be numerical. If your script returns more than one numerical value, the first one will be used by default. Script values may be either integer or floating-point numbers.
Pulse - Monitoring Tool for JIRA provides a correct value mechanism - it allows you to define if a returned value is bigger, smaller or equal to the expected value. Depending on a choosen strategy and script execution tries, the service will be failed or succeded. If you use "all attempts were successful", your service will be set as success. If all of your test tries will succeed, when using "at least one attempt was successful", any of the test tries has to succeed to set your service as working correctly.
Important
If Pulse - Monitoring Tool for JIRA notices problems with a correct connection service, value tests will NOT be running.
Important
It is highly recommended to use the OpenSSH private key format. If you currently are NOT using a password, it is not so important. In other cases it may be necessery to use it. Below you can see how it should look like:
or should NOT:
Examples
Below you can find an example of the SSH protocol configuration in Pulse - Monitoring Tool for JIRA.
Before you configure this service make sure that your SSH server is running on server. If you want to successfully test your service, you should take the following steps:
- the SSH server have to be running,
- check if your SSH server is running on a specified port,
- check how you authorize with your service (if it is just a password, a private key or both).
If all parameters you entered are correct, your service connects correctly. If not, check your firewall rules.
The next step is to check if the SSH connection estabilishes correctly its script execution. It is highly recommended to set the service timeout higher than the script execution timeout. It will NOT be a mistake but in some cases it may cause failures.
FAQ
Why my SSH service connects to the server correctly but script returns the exit status code -1?
Sometimes you may be informed about a successful connection but even then script executions may fail. In most cases it means that your script unsuccessfully finished but if you set the timeout script execution too small the shell streams latency may cause that there will be not enough time to run a script and read the result. For better efficiency it is recommended to set a higher script execution timeout - if a script will execute faster, you will NOT have to wait until the execution time finishes. When the executed script extends, for any reason, it is more possible that this script will run correctly.