How can I use nagios to monitor ssh tunnels?
Solution 1:
Parameters to the command should be configured in the command definition. Something like:
define command {
command_name check_tunneled_ssh
command_line /usr/lib/nagios/plugins/check_ssh -p $ARG1$ $HOSTADDRESS$
}
Then you would use
check_command check_tunneled_ssh!12344
in your service.
Solution 2:
Here's my nagios/etc/objects/commands.cfg, which I believe is standard.
# 'check_ssh' command definition
define command{
command_name check_ssh
command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
}
Which means that I think you've gone wrong by specifying $HOSTADDRESS$ in your check command. Try this in your service definition instead:
check_command check_ssh!-p 12345
Another comment, not related to your 'real' question... I wouldn't make a separate host definition for all the remote servers, I'd just make a new service on the localhost 'host' (seen as that's what's providing the service) for each tunnel.