From: "Brian Schröder" Date: 2005-11-21T18:57:39+09:00 Subject: Re: url-monitoring script question On 21/11/05, Torsten Schmidt wrote: > Hi @all, > > i made a script, that monitors some web-sites of our company using net::http > and net::smtp. > > it pings multiple sites and it's based on this script: > http://habtm.com/articles/2005/09/29/website-monitoring-script > > every time an error occures, an email ist sent. > i want to do this every 5 min as a cron-job. > > Is there a way to limit the email-notification, that for example only 3 > emails with the same error are delivered? > > i would like to prevent my mailbox being filled up, when one site is down > for the whole night or so > as it can be done with nagios. > > one problem is, that the script has no 'history' information to recognize, > how many notifications have been sent already. > > any suggestion how that can be done? > > (i hope i made it clear -- sorry for my bad english --) > > Best Regards, > Torsten > > You correctly identified the problem. You need to collect history information somewhere. I would store the error state of each possible error seperately in a file or db. If you store the state (online/offline) for each address, you can mail only when the state changes. cheers, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/