check_by_ssh warning threshold



I’m having trouble setting warning and critical thresholds on a check_by_ssh command.
At the moment I have check_by_ssh connecting to another machine, executing a simple script and returning a numerical value.
So far I have had no luck trying to set warning and critical thresholds on this value. I’ve been getting errors in the config and I can’t find anything online telling me the right way to do this.

My config looks like this;


define command{ command_name check-sessions command_line $USER1$/check_by_ssh -i /home/nagios/.ssh/id_dsa -l nagios -H $HOSTADDRESS$ -C /home/nagios/ 2>/dev/null }


define service{ use generic-service host_name myHost service_description Web Session Check check_command check-sessions }

The maximum value that the script will return is 300 so I want to add threshold using either absolute values or percentages.
Can anybody help me here? I’m completely stuck and the documentation has been no help to me.

Thanks for any and all help.


I’ve been able to overcome this issue with check_by_ssh . In order to do so I had to use a different plugin.
I got the check_generic plugin ( ) and was able to write a generic SSH command that will accept as arguments the remote script to execute, the name of the check for display and both the warning and critical levels. It also uses the $HOSTADDRESS$ macro to obtain the IP for the specific host

Command definition

‘check-generic-by-ssh’ command definition

define command{
command_name check-generic-by-ssh
command_line $USER1$/check_generic -e “ssh nagios@$HOSTADDRESS$ $ARG1$ 2>/dev/null” -n $ARG2$ -w $ARG3$ -c $ARG4$

Service Definition
define service{
use generic-service
host_name myHost
service_description CPU Load Check
check_command check-generic-by-ssh!"~/"!“CPU Load Check”!">75"!">95"