Please find the below steps to monitor the website using status codes.

Nagios supports monitoring the website using status coodes and there is a command in /etc/nagios-plugins/config/http.cfg .
Example:- We can use a command like below to monitor a URL like https://domain1.com.

define command{
   command_name    check_https_url
   command_line    /usr/local/nagios/libexec/check_http -H domain1.com -e 200,301,302
}

To add the comnmand to Nagios create a file named https_url.cfg in /etc/nagios-plugins/config/ with the above code (and reload nagios server).

To use the check_https_url add the code below to the host configuration file. For example (in /etc/nagios3/conf.d/server.cfg)

define service {
    host_name           domain1.com
    service_description WEB SERVICE
    check_command       check_https_url!8243!/services/echo%3Fwsdl2
    use                 generic-service
}

Leave a Reply