We're using a Nagios installation to watch over our infrastructure and alot of websites. The way the websites are monitored is by using check_http
with the URL passed as a parameter. We use this, because multiple websites are hosted on the same systems, and the URLs can reasonably change because the URL key of products can change.
So the HTTP checks basically look like this:
define service {
host_name ourhostname
service_description Typo 3
check_command check_http!www.ourdomain.com!/
max_check_attempts 3
check_interval 1
retry_interval 1
check_period 24x7
notification_interval 30
notification_period 24x7
contact_groups developers
}
And there's the problem. When a notification worthy problem arises, sendxmpp is called like this:
define command {
command_name notify-service-by-xmpp
command_line echo "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $ARG1$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/sendxmpp -j <server-ip> -u nagios -p <password> $CONTACTPAGER$
}
Where we tried to use $ARG1$
, we would need the checked URL. It seems that the notification has access to the standard variables for the problematic object (for example $HOSTADDRESS$
), but we need the URL.
The problem could also be that I am checking URLs wrong. Usually, you only have a HOSTADDRESS
entry, but it seemed wrong to document the URLs in the host definition, then add multiple commands to check $HOSTADDRESS1$
through $HOSTADDRESS15$
.
Does anybody either have a solution on how to access the command line argument passed to the test, or a better idea on how to check a whole lot of URLs for the same host under different vhosts without opening either multiple different commands or different hosts?