Archive for August, 2010

Monitor Non-Standard Ports in Nagios

Posted in How To on August 25th, 2010 by skylercall – Be the first to comment

I have been playing with Nagios over the last couple days. Aside from the steep learning curve I am quite happy with it. The largest frustration I encountered, however, is that no where in their official documentation does it say anything about monitoring services that are on non-standard ports. After searching for a solution I finally came across a few people talking about defining a custom command like this:

define command{
 command_name check_customport
 command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p [PORT]
}

Using this method required extra definitions in my configuration files and even then my services were reported as working when in fact they were not (although, I may have just figured out why).

There is a much simpler way! I was sure there must be a native command for altering which port Nagios checks. Finally, I found it buried in their wiki:

define service{
 use generic-service
 host_name remotehost
 service_description HTTP
 check_command check_http!-p [PORT]
}

It is as simple as appending “!-p [Your Custom Port Goes Here]” to the check_command! My Nagios definitions just got a lot simpler.