0

I notice that one of my sites wasnt working properly and was giving me 500 errors. Nagios didn't catch it because the HTTP server was still working.

Is there a way i can tell nagios to check the health of my site? I think i'll just write a script which pings certain pages and make a cronjob for it. On error i'd get an email so thats my suitable replacement for the moment will be.

I am running debian linux

2 Answers 2

2

just use the check_http plugin that is part nagios-plugins package. it can monitor http status of the site and can monitor other http parameters as well.

2
  • The check_http plugin also supports checking for specific string which can be useful.
    – Khaled
    Dec 9, 2011 at 10:59
  • Cool, i added this in. I am a nagios noob. How do i know if this worked? i put the below in commands.cfg and restarted nagios. How long do i have to wait? I put all the sites i wanted to check and one invalid site so i can get a report or something down. I added this-> define command{ command_name check_http-MySite command_line /usr/lib/nagios/plugins/check_http -H MySite.com }
    – user274
    Dec 9, 2011 at 11:13
2

If you want to monitor certain page, and you know the expected status, as @Frank mentioned, check_http plugin can do this:

check_http -H domain.com -u URI -e 200
HTTP OK: Status line output matched "200" - 4886 bytes in 0.007 second response time |time=0.007446s;;;0.000000 size=4886B;;;0

But if you want to get alerts whenever a page returns the 500 error, I think you can monitor the Apache's access log with check_logfiles plugin:

check_logfiles --tag=500 --logfile=/var/log/httpd/access_log --criticalpattern="HTTP/1.1\" 500"

You must log in to answer this question.