Hi guys. This should be a fairly simple question for you guys.
I have a webpage that shows three states. Ready, Warning and critical. Can I use check_http to make Nagios got to a warning state when the webpage does?
Cheers
Chris
Hi guys. This should be a fairly simple question for you guys.
I have a webpage that shows three states. Ready, Warning and critical. Can I use check_http to make Nagios got to a warning state when the webpage does?
Cheers
Chris
hey. check_http won’t do this for you, as it just just makes a connect request then results in OK if it receives a return code HTTP 200 (ok), refusals and timeouts result in criticals.
You’re likely gonna hafta make a script that wgets the webpage, then parses the result and gives an alert.
Lets say your webpage that says critical, warning, or ready has this peice of html is at yourwebsite.com/status.html and has this in it for example:
Status: Ready
You could do this for your check plugin:
#!/bin/bash
cd /tmp
#this downloads the status.html page from your site
wget h t t p : / / w w w.mywebsite.com/status.html
STATUS=`grep Status: /tmp/status.html | perl -pe 's/Status\://'`
if "$STATUS" == "Ready" ]
then
echo "OK! Status: Ready"
rm -f /tmp/status.html
exit 0
else
echo "OMG NOT OK!!"
rm -f /tmp/status.html
exit 2
fi
(take out the spaces in the wget link of course. can’t figure out how to make this forum not auto-create a link hehe
catch my drift?