DOH! I neglected to mention that it's setup as a cron job, in my case
running hourly...
Regards,
Ed Hintz
Geek Guy
[EMAIL PROTECTED]
----------
>From: "Edmund A. Hintz" <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Cc: [EMAIL PROTECTED]
>Subject: ping/page script
>Date: Wed, Jul 19, 2000, 6:34 PM
>
> Hi All,
> Some time back I mentioned that I wanted a script to intermittently ping
> the retrospect server, and page me if it wasn't working. Nobody mentioned
> any pre-existing items, so I set out to write one.
>
> After searching long and hard for a Mac OS based App which would:
>
> A-generate an ICMP ping
> B-was AppleScriptable
> C-cost less that $20
>
> I gave up. Doesn't mean it doesn't exist, just that I couldn't find it after
> several weeks of on and off searching. So, I resorted to Unix and hacked up
> the following perl script. I tested this on a RedHat 6.1 box and a Mandrake
> 7.1 box, it works fine on both. It does require a working installation of
> sendmail, and a pager or cellphone w/email access, since these are
> ubiquitous and cheap nowadays (good excuse to get a cell on the company
> tab). ;-) I decided an email system is more flexible than an attached modem,
> but the last section which sends the email could be fairly easily modified
> to use an attached modem and dial out to a older pager.
>
> My next plan for the project is to expand it and monitor my other
> servers as well, but I'm starting here. I'm painfully aware that the Unix
> requirement is going to lose a large portion of the target audience, so I
> hope this is useful for somebody. If you use it and want to know when I get
> around to updating it for multiple servers drop me an email and I'll try not
> to lose your address... ;-)
>
> Note the ol' catch 22-"Qui custodiet ipsos custodes?" (who will watch
> the watchers). If you're really paranoid about high availability you may
> want to set up another server on an independent network connection running
> the same script... OTOH, if you're really paranoid about high availability
> you're likely already running a much nicer system than this... ;-)
>
>
> #!/usr/bin/perl
>
> use Net::Ping;
>
>
> # This script will attempt to ping a remote server. If the server
> # does not reply, it will attempt 2 more times, waiting for a determined
> # number of seconds between attempts. Upon 3 failures, it will email
> # the specified address of the failure.
> #
> # Variables which need to be set:
> # $ip is the machine to ping
> # $sleep is the number of seconds you wish to wait between pings (300 = 5
> # minutes).
> # $email is the address to which notification is sent (your pager or
> # cellphone email).
>
> $ip = "192.168.1.1";
> $sleep = 300;
> $email = "you\@yourdomain.com";
>
> # User variables set, clear others:
>
> $down = 0;
>
> # All variables set, let's get to work...
>
> while ($down < 3) {
>
> $p = Net::Ping->new("icmp");
>
> if ($p->ping($ip)){
> # print "debug code-its alive";
> die;
> }
>
> else {
> $down++;
> # print "debug code-down is now $down";
> sleep $sleep;
> }
> $p->close();
> }
>
> open(MAIL, "| sendmail -oi $email");
> print MAIL <<EOF;
> From: server\@yourdomain.com
> Reply-to: admin\@yourdomain.com
> Errors-to: admin\@yourdomain.com
> Sender: server\@yourdomain.com
> Subject: Backup server is down
>
> Backup server is not responding.
>
> EOF
> close MAIL;
>
> end
>
> Regards,
>
> Ed Hintz
> Geek Guy
> [EMAIL PROTECTED]
>
>
>
> --
> ----------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Archives: <http://list.working-dogs.com/lists/retro-talk/>
> Problems?: [EMAIL PROTECTED]
>
>
--
----------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives: <http://list.working-dogs.com/lists/retro-talk/>
Problems?: [EMAIL PROTECTED]