(20 August 2012)
Problem
I want to monitor a particular URL through nagios, not just http: server availability.
Solution
commands.cfg:
# 'check_http_url' command definition
define command{
command_name check_http_url
command_line $USER1$/check_http -I $HOSTADDRESS$ -u $ARG1$
}
macros.m4:
define(`DOHTTPURL',`define service{
use generic-service
host_name $1
service_description $2
check_command check_http_url!$2
normal_check_interval 20
retry_check_interval 5
} ')dnl
Sample .m4 entry:
In our case, the __gcc.html is a page created by a script so that nagios has a specific target to hit. On one of my hosting systems, if the system is misconfigured, you get the default page, which isn't detectable if you just pull index.html. So by looking for a specific, unique file, you can catch server misconfigurations as well.
(Based on
this)