Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
I’m looking for the best (appropriate) way to change how the ‘service state’ is returned (reported) from a service. For example; the SSH service on a virtual host machine is desired to be normally ‘off’; when using the check_comand ‘check_ssh’, it returns “Connection refused” (return code of ‘2’) and its State is reported as ‘CRITICAL’. What is desired is that for a return code of ‘2’ the State is reported as ‘OK’ and for a return code of ‘0’ the State is reported as ‘CRITICAL’.
Considered options for a check_ssh_off service so far: Write a completely new service, use a script to change the return code result from the ‘check_ssh’, or just ignore it .
The check_ssh plugin is limited and does not have an "invert" feature for the check result. You will most likely have to create a script to check the port of the server and if it is open, return a critical:
#!/bin/bash
STATE=$( nmap localhost | grep ssh | awk '{print $2}' )
case $STATE in
open )
echo "Critical! SSH port open and listening"
exit 2
;;
closed )
echo "OK - SSH port closed"
exit 0
;;
esac
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.