[clue] Downtime.
Mike Nolte
obiwanmikenolte at gmail.com
Thu Sep 4 11:17:23 MDT 2014
It seems like you'd want something that checked the page from outside. If
you scripted something and set it up as a cron, you'd only find out about
it if the server was otherwise functional. I can set up a check on my
Nagios server, though there might be gratis services on the Internet that
do that. If so, I haven't found any.
If you're interested, the simple check that I usually use to check sites
looks like this (Nagios is CRITICAL on exit 2, OK on exit 0):
#!/bin/bash
Catch() {
code=$1
message=$2
if [[ $code -ne 0 ]]
then
echo "ERROR: $message. Returned $code"
exit 2
fi
}
url='http://<some page on my site>'
string='<some string that's on my page when it's working>'
contents=$(curl -s $url)
Catch $? "Could not connect to $url"
echo "$contents" | grep "$string" > /dev/null
Catch $? "Couldn't find $string in $url"
echo "OK: Found $string in $url"
exit 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20140904/937c6546/attachment.html
More information about the clue
mailing list