In Nagios, I wanted to let one particular host (out of many) to be checked with a different SSH port. In the checkcommands.cfg file, you will find commands which need to be checked remotely written as follows:
command_name check_somecommand_remote
command_line $USER1$/check_by_ssh -i /usr/local/etc/nagios/keys/id_dsa -l nagioscheck -H $HOSTADDRESS$ -C "/path/to/command -w $ARG1$ -c $ARG2$"
}
This does not allow you to let a host use another SSH port. There are many other hosts which just work fine like this (since all hosts have the default port 22 set), it's just one particular host using SSH port 24. I could also redefine all remote commands by adding a -p 24 but this is inflexible. I would need a new set of commands for each different port number.
On a recently installed machine, the Nagios check for mailq did not work. Instead it returned the following error:
This is on a QMail based machine running on FreeBSD. I compared the setup with an older FreeBSD machine, where the check works properly. This box was also running QMail but with an older set of Nagios plugins. The configuration was equal, except the check_mailq script itself, because it has evolved a little in the meantime.