We have already discussed about the Nagios monitoring tool in the last three posts, there are many features available for the monitoring system. We will configure the web page content monitoring and it very easy to do that.

Login into your client sytem,

By default the Nagios client installed in /usr/local/nagios.

We can check the content monitoring with below format before adding in nrpe.cfg file,

/usr/local/nagios/libexec/check_http -H [HostName]  -I [IP-Address] -c [Critical] -p [Port Number] -m [pagesize-Minimum:Maximum] -u [URL]  -s [String]

Monitoring website home page:

/usr/local/nagios/libexec/check_http -H domainname.com -I -c 5 -p 80 -m 50000:60000 -s 'nagios monitoring tool'

HTTP OK: HTTP/1.1 200 OK - 59334 bytes in 0.004 second response time |time=0.004085s;5.000000;10.000000;0.000000 size=59334B;50000;0;0

Monitor a specific page,

If you want to monitor a specific page,  -u option

/usr/local/nagios/libexec/check_http -H domainname.com -I -c 5 -p 80 -m 10000:20000 -u 'http://domainname.com/demopage/admin.php'
-s'website string content'

HTTP OK: HTTP/1.1 200 OK - 12360 bytes in 0.001 second response time |time=0.001016s;;5.000000;0.000000 size=12360B;10000;0;0

If your configuration  is working fine add to the nrpe.cfg  file ,

open nrpe.cfg file
# cd /usr/local/nagios/etc/

vi  nrpe.cfg
command[check_http]=/usr/local/nagios/libexec/check_http -H domainname.com -I -c 5 -p 80 -m 10000:20000 -u 'http://domainname.com/index.php'  -s'website string content'

In Nagios Server :

Open your host configure file host.domainname.cfg and add the below line

vi /usr/local/nagios/etc/objects/host.domainanme.cfg

define service{
        use                             generic-service
        host_name                       host.hostanme.com
        service_description             DOMAINNAME.COM
        check_command                   check_nrpe!check_http

Once updated, restart the Nagios server and also  check your configuration whether is correct by below command,

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

# /etc/init.d/nagios restart