======Nagios notes====== =====Check status of http(s) site===== // Tested with Nagios Core 3.3.1 on OpenBSD 5.1. AMD64 // ====By hand==== Check for redirection on www.domain.com: /usr/local/libexec/nagios/check_http --hostname=www.domain.com --expect="HTTP/1.1 301 Moved Permanently" Check for HTTP Status 401 Unauthorized on https://portal.domain.com: /usr/local/libexec/nagios/check_http --hostname=portal.domain.com --ssl --expect="HTTP/1.1 401 Unauthorized" Check for the presence of the string "Type your user name and password." on http://login.domain.com/ and https://login.domain.com and follow redirection: /usr/local/libexec/nagios/check_http --hostname=login.domain.com --string="Type your user name and password." --onredirect=follow /usr/local/libexec/nagios/check_http --hostname=login.domain.com --ssl --string="Type your user name and password." --onredirect=follow Check for the presence of the string "XenApp" on http://apps.domain.com/ and https://apps.domain.com/: /usr/local/libexec/nagios/check_http --hostname=apps.domain.com --string="XenApp" /usr/local/libexec/nagios/check_http --hostname=apps.domain.com --ssl --string="XenApp" Check for the presence of the string "MySomething" on http://app.domain.com/app1/ and https://app.domain.com/app1/: /usr/local/libexec/nagios/check_http --hostname=app.domain.com -u /app1/ --string="MySomething" /usr/local/libexec/nagios/check_http --hostname=app.domain.com --ssl -u /app1/ --string="MySomething" For other check_http options examine the output of: /usr/local/libexec/nagios/check_http --help ====From Nagios==== Define the following command: define command { command_name check-url command_line $USER1$/check_http $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ } Define a service using the arguments from the by hand examples above: define service { use local-service-norenotify host_name localhost service_description www.domain.com http redirect check_command check-url!--hostname=www.domain.com!--expect="HTTP/1.1 301 Moved Permanently" } Seperate each argument with a "!". Replace localhost with a placeholder hostname. \\ // You can probably get away with check-url!all_arguments_without_!_separator, but this was not tested. //