pager rotation script

secmgr security at
Tue Aug 24 15:39:23 EDT 2004

I threw this together as a notification method.  It rotates the pagerid passed to qpage based on the week of year in a small data file.  The script logs to syslog so you can see if it is having issues.  In the argus config file it looks like this:

Method "rotation" {
        command:  /usr/local/bin/ --rotation=%R --message="%M"


notify: rotation:rotation_list_file_name

 /usr/local/bin/ looks like this:
use Getopt::Long;
use Date::Manip qw (UnixDate);
use Sys::Syslog;

# write to syslog errors
openlog('pager_rotate', 'ndelay', 'daemon');

# get which file to open and message from the command line.
# Look in /usr/local/etc for the file
GetOptions( "rotation=s" => \$rotation_file,
                "message=s" => \$message);
# the rotation file format is week:pagerid
# pagerid must be defined in the /etc/ file
# try and open file
#open($rf, "< /usr/local/etc/$rotation_file")
#       or syslog('err', "couldn't open /usr/local/etc/$rotation_file");
if (not (open($rf, "< /usr/local/etc/$rotation_file"))) {
        syslog('err', "couldn't open /usr/local/etc/$rotation_file: $!");
        exit ;

# determine what week of the year
my $curr_wk = &UnixDate( "today", "%W" );

# get who to call from file. chop takes off newline

while (<$rf>) {
        ($week, $pagerid) = split /:/, $_, 2;
        last if ($curr_wk == $week);

#launch qpage with pager id and message
syslog('info', "calling qpage with pagerid $pagerid and message $message");
exec "/usr/local/bin/qpage -p $pagerid $message \n" ;
syslog('err', "qpage invoke failed");


More information about the Arguslist mailing list