[CentOS] Recommendation On Ping And Alert Tool

William A. Mahaffey III wam at HiWAAY.net
Thu Sep 22 20:11:10 UTC 2005

CentOS mailing list wrote:

> Kennedy Clark wrote:
>> A bit off topic, but I keep looking for an answer to this question 
>> and coming up with nothing... so I thought I would go to the gurus. :-)
>> Can anyone recommend a good package for pinging other devices and 
>> sending an email/alert when they go down?  I'm aware of all kinds of 
>> more complex things with GUIs and a zillion other bells and whistles 
>> we aren't looking for, but we just want a simple tool (could be 
>> daemon or something run from cron) that runs every 1 - 5 minutes and 
>> alerts us when stuff disappears.  Would need some basic logic like 
>> only sending one email/alert when something goes down (vs sending an 
>> email every 1-5 minutes until it comes back up). :-)  We need to 
>> avoid a requirement for an X-windows GUI, but a web-GUI would 
>> probably be fine (a GUI-less command-line thing would probably be best).
> Bash. Here is what I use for monitoring my website
> #!/bin/bash
> URL="http://www.911networks.com"
> EMAIL="artsi at fartsi.com"
> lynx -dump "$URL" > /dev/null
> if [ $? -ne 0 ]; then
>     echo "`date "+%F %T"` - $URL is down" | mail -s "$URL is down" $EMAIL
> fi
> Watch for the wraps and make it executable [chmod 7xx]

This is the sort of thing I was going to suggest. You could go 1 better 
& have it resubmit itself periodically w/ at(1). Maybe get it to do some 
argument parsing so you could pass in the URL, EMAIL, then invoke plural 
instances for however many things you want to monitor ....

	William A. Mahaffey III
	Remember, ignorance is bliss, but
	willful ignorance is LIBERALISM !!!!

More information about the CentOS mailing list