Checking an alternative SSH port
In this recipe, we'll learn how to deal with the common situation of a machine running an SSH daemon that is listening on an alternative port. So, a service definition that uses check_ssh
, as used in the Monitoring SSH for any host recipe, fails because the plugin defaults to using the standard SSH TCP port number of 22.
This kind of setup is common in situations where an SSH server should not be open to the general public and is often employed as a "security by obscurity" method to reduce automated attacks against the server. The SSH daemon is therefore configured to listen on a different port, usually with a much higher number; administrators who need to use it are told what the port number is.
We'll deal with this situation and monitor the service in Nagios Core, even though it's running on a non-standard port. We'll do this by defining a new command that checks SSH on a specified port number, and creating a service definition that uses that command. The...