Xymon Mailing List Archive search

External Paging Script

list Pnixon
Thu, 21 Sep 2006 16:05:19 -0400
Message-Id: <user-af4704c55e98@xymon.invalid>

Hey all,
 Attached is a paging script I'm using to limit the amount of pages within a
15 minute window to one page per window.

 Script comes with no warranty or support, use at your own will.  I know,
it's kludgey as well.

--Pat

#!/usr/bin/perl

$INTERAL = 900; ## # Of Seconds between Pages
$RCPT = $ENV{'RCPT'};
$RCPTN = "/bb/hms/server/tmp/np-".$RCPT;
$ACKCODE = $ENV{'ACKCODE'};
$BBHOSTSVC = $ENV{'BBHOSTSVC'};
$NOW = `date +%s`;
chomp $NOW;

$mstat = (stat $RCPTN)[9];
$fileage = $NOW-$mstat;


if ( $fileage >= $INTERVAL ) {
        open (PAGER,">$RCPTN");
        system('echo $BBHOSTSVC [$ACKCODE] | mail $RCPT');
        print PAGER " ";
        close (PAGER);
};