First, make sure your check_http command is working correctly. It is in $NAGIOS_HOME/plugins/check_http. Use --help to see your options. You'll note that there are several, but the actual command that Nagios runs is defined in the file commands.cfg. The default is
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}I changed the command_line to
command_line $USER1$/check_http -I $ARG1$ -p $ARG2$
You could of course add additional options supported by check_http.
Next, you need to add hosts to be monitored. I just appended these to localhost.cfg. This is an example for monitoring http://my.machine.indiana.edu:9999 (with IP addres 123.456.789).
define host{
use linux-server ; Name of host template to use
host_name my-machine ; The name we're giving to this host
alias CICC Tomcat ; A longer name associated with the host
address 123.456.789 ; IP address of the host
hostgroups linux-servers ; Host groups this host is associated with
}
use linux-server ; Name of host template to use
host_name my-machine ; The name we're giving to this host
alias CICC Tomcat ; A longer name associated with the host
address 123.456.789 ; IP address of the host
hostgroups linux-servers ; Host groups this host is associated with
}
define service{
use local-service ; Name of service template to use
host_name my-machine
service_description HTTP
check_command check_http!my.machine.indiana.edu!9999
notifications_enabled 0
}
That's it. Maybe there is a better way to do this but I could not find it easily.
No comments:
Post a Comment