Open source site monitoring software
September 8, 2005 1:39 AM   Subscribe

Can anybody recommend an open source 'external' site monitoring utility for *nix? By external, I mean the tool should sit on a server that's separate to the one the site being monitored is sitting on. The tool should make regular requests to the monitored site and should send an alert if the page is not returned within a specified time.
posted by jedro to Computers & Internet (18 answers total)
 
You mean like "uptime"? http://uptime.openacs.org/uptime/
posted by handee at 1:43 AM on September 8, 2005


Response by poster: Something like that, except preferably a bit more flexible.
posted by jedro at 1:47 AM on September 8, 2005


Nagios?
posted by NinjaPirate at 2:14 AM on September 8, 2005


Another vote for nagios here. I have it in production at four sites of a large oil and gas firm and it works wonderfully.

There's also Big Brother and OpenNMS. Before I discovered Nagios, I used NOCOL.
posted by mrbill at 2:48 AM on September 8, 2005


Whoops, NOCOL has been superseded by SNIPS. I'd forgotten since its been a few years since I've used it.
posted by mrbill at 2:49 AM on September 8, 2005


Nagios can be a beatch to setup, but is great
posted by ajbattrick at 4:22 AM on September 8, 2005


Mon is excellent. It's totally free, people write all kinds of custom monitors for it, it can page, send email or whatever else you can think up for it.

Simplest use of course would be for it to ping something for you, but you could even use one of the wget monitors to look whether a specific page or pages are up.
posted by poppo at 4:29 AM on September 8, 2005


An http monitor for Mon
posted by poppo at 4:32 AM on September 8, 2005


Nagios for sure. Along with Apache it's one of a handfull of open source apps that are considered enterprise stable.
posted by furtive at 4:32 AM on September 8, 2005


Response by poster: I was hoping there was something simpler to set up than Nagios. All I need it to do is load a page, check for a particular string, and send an alert if the string is not found.
posted by jedro at 5:28 AM on September 8, 2005


I use Big Brother for serious use.

You want simple to set up? I use 'ping' for various similar temporary uses, like so:

while (true) ; do if ( ! ping -c 1 -i 10 fnord ) ; then echo fnord | mail sfenders ; sleep 60 ; fi ; done

To monitor a website just replace ping with wget, and maybe add an elif clause to grep for page content. wget returns an error code on 404 or whatever.
posted by sfenders at 5:44 AM on September 8, 2005


(... err, I forgot the other 'sleep 10' before 'done' above.)
posted by sfenders at 5:47 AM on September 8, 2005


this works in linux, probably in unix, too.

(this is one long line)
wget -o /dev/null -O - google.com | grep -q "Feeling Lucky" || echo "not found"

The "not found" message displays if it can't load the page or if the text is not on the page.

Change the echo to an email command once it's working correctly, then add it to cron, or run in a loop by adding

while true ; do
wget...
sleep 60
done
posted by jjj606 at 5:53 AM on September 8, 2005


Big Brother has gone commercial, and the free version isn't supported much (and can't handle large loads.) Henrik Stoerner rewrote the core as BBGen, then went on to rewrite the rest as the Hobbit Monitor. (As to the name, he says "Names are hard.")

I'm quite happy with it, even as a work in progress. It has a bunch of tests built in, some which run on the client, some across the network. The Big Brother client works with it, and the protocol is the same, so many Big Brother extensions, the Hobbit client is new, and not quite ready for primetime. Writing your own tests isn't hard, we've started monitoring our internal processes with it, using a homerolled program that sends messages to the monitor server, which then alerts as needed.

For monitoring one site, it might look like overkill -- but it answers lots of problems, and with the RRD graphs built in, you can get trends you wouldn't see from just "hit page, does it work?" testing.

Otherwise, I'd modify jjj606's script to....
TEST=`wget -o /dev/null -O - google.com | grep -q "Feeling Lucky" || echo "oops"`
if [ "$TEST" = "oops" ]
then
     wget -o ~/brokenpage -O - google.com
     echo "Webpage Not responding, wget reported $?" | mail -s "Ruh-ro, Shaggy!" youremail@example.com
fi
That way, you get a copy of any errors that are presented, and the actual error code from wget, if any. This can make debugging much easier. Fancier versions will look at the result code and mail out appropriate messages. (Using curl, it returns a 6, I'll echo out "Host not found" -- which tells me I need to check DNS and the hostname first, then find out if the remote host is up.)

Further complications ensue. Or, you can run Hobbit, which already takes much of this into account -- plus, if you can install the client, will also warn you of upcoming problems, like running out of disk space or overloading the CPU.
posted by eriko at 6:17 AM on September 8, 2005 [1 favorite]


Sometimes the method above doesn't work if you're having to use a web site that requires a login. In that case, you can use "curl" instead of "wget" (even supports SSL)
posted by jlstitt at 7:47 AM on September 8, 2005


You should still be able to use wget, jlstitt. Just use the --http-user and --http-passwd options.
posted by bachelor#3 at 2:06 PM on September 8, 2005


You can just use the check_http plugin from Nagios directly, without having to run the whole thing. The script exits with a 0,1,2 or 3 depending on the condition of the service you are checking. Should make it easy to wrap it into other scripts to send email or something...
posted by darkness at 3:23 PM on September 8, 2005


"whole thing" meaning the whole Nagios infrastructure.
posted by darkness at 3:23 PM on September 8, 2005


« Older Turning a Nokia into a Quickcam?   |   What do you wish you'd known when you were 18? Newer »
This thread is closed to new comments.