Wednesday, July 23, 2008

check_http as a Nagios Web Service plugin

We typically use nagios to monitor our hardware and hosted services. Now that we are starting to offer more web services, we wanted to replace the ad-hoc curl wrapper we were using with a more standard nagios plugin. After searching for one and not finding any, it occurred to me that if curl can do it, maybe you can trick the standard check_http plugin to also do it. A quick experiment with an https hosted web service (self signed certificate for this test) shows that it works:

./check_http -S -k 'SOAPAction: ping' -r 'Current Status.*OK' -T text/xml -P '<s:envelope s="http://schemas.xmlsoap.org/soap/envelope/"><s:header/><s:body><ping/><s:Body><s:Envelope>' -t 10 -m 512 -p 8083 -H 192.168.1.254 -u /Services/Search/search.svc
HTTP OK HTTP/1.1 200 OK - 0.033 second response time |time=0.032722s;;;0.000000 size=897B;512;0;0

Now time to look at nagios grapher...