I have this script that checks processes on aix box. 
My question is within the subroutine.  If the process
is not running the return code is 256.  How do prevent
it from sending multiple alerts to a pager?  What I
want it do is send 1 page at a time for multiple
events.

Piece of my script:

$telalcheck=`ps -ef | grep telalconfe | grep -v grep`;
$tlreturn=$?;
&logmesg("$?","The check for telalconfe (ARS) process
(on $host) indicates the process  is");  

$rapcheck=`ps -ef | grep rappsvc.cfg | grep -v grep`;
$rapreturn=$?;
&logmesg("$?","The check for rappsvc.cfg (ARS) process
(on $host) indicates the process  is");  
   }
sub logmesg {                                         
                         
        local($returncode,$mesg)=@_);                 
                        
        $datetime=localtime;                          
                         
        if ($returncode == 0)                         
                         
              {print LOGFILE "$datetime:$mesg
up/available\n";}                     
              else

        {
        print LOGFILE "SEV_1:$datetime:$mesg is
down/unavailable.:";
        
        print "The return code values are $returncode \n";

        ## Email Remedy Admin that is down
        $from="onefatbug2001\@yahoo.com";
        $to="upage\@skytel.com";
        $subject="";
        $sendmailpath="/usr/sbin/sendmail";
        open (SENDMAIL, "| $sendmailpath -t");
        print SENDMAIL "Subject: $subject\n";
        print SENDMAIL "From: $From\n";
        print SENDMAIL "To: $to\n\n";
        print SENDMAIL "$mesg down/unavailable";
        close (SENDMAIL);

        }
            }                                         
                         


__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to