nv-l
[Top] [All Lists]

RE: [nv-l] Cursed Cisco Trap Formats

To: <nv-l@lists.tivoli.com>
Subject: RE: [nv-l] Cursed Cisco Trap Formats
From: "Barr, Scott" <Scott_Barr@csgsystems.com>
Date: Fri, 4 Oct 2002 16:26:05 -0500
Here is the perl script - only send an email right now and puts a message in the log, but will send pages later. Thanks for the assistance in figuring out how to do this. Note that this is called from an ruleset action node and not from the command for automatic action.


#!/usr/bin/perl
# ****************************************************************
# *** Interface Trap processor                                 ***
# ****************************************************************
#
open (TRAPDATA, ">>/usr2/intfTraps.log");
 
@data = "">$TimeStamp = join(' ',@data[1],@data[2],@data[3]);
 
$Origin = $ENV{'NVA'};
$Arguments = $ENV{'NVATTR_COUNT'};
 
if ($Arguments == 6 )
{                        
 $ifDesc =  $ENV{'NVATTR_2'};
 $Severity =  $ENV{'NVATTR_6'};
 
 if ($Severity == 0)
 {
  $ifStatus = "Interface Active";
 }
 if ($Severity == 3)
 {
  $ifStatus = "Interface Down";
 }
}
 
if ($Arguments == 7 )
{                        
 $ifDesc =  $ENV{'NVATTR_2'};
 $ifReason =   join(" ","Reason:",$ENV{'NVATTR_4'});
 $Severity =  $ENV{'NVATTR_7'};
 
 if ($Severity == 0)
 {
  $ifStatus = "Interface Active";
 }
 if ($Severity == 3)
 {
  $ifStatus = "Interface Down";
 }
}
 
if ($Arguments == 8 )
{                        
 $ifDesc = $ENV{'NVATTR_4'};
 $Status = $ENV{'NVATTR_3'};
 
 if ($Status == 1)
 {
  $ifStatus = "Interface Active";
 }
 
 if ($Status == 2)
 {
  $ifStatus = "Interface Down";
 }
}
 
$MsgText = join(" ",$TimeStamp,$Origin,$ifDesc,$ifStatus,$ifReason,"\n");
`echo '$MsgText' | mailx -s '$MsgText' scott_barr\@csgsystems.com`;
print TRAPDATA $MsgText;
close (TRAPDATA);

<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web