To: | <nv-l@lists.tivoli.com> |
---|---|
Subject: | RE: [nv-l] Cursed Cisco Trap Formats |
From: | "Barr, Scott" <Scott_Barr@csgsystems.com> |
Date: | Thu, 3 Oct 2002 15:02:08 -0500 |
GUYS -
THANKS FOR ALL THE INPUT BUT I DO NOT CARE WHAT THE TRAPD.CONF FORMAT LOOKS
LIKE. I know it is wrong, I have already modified it to display 5
arguments.
I only
care about the data passed into a script - how many variables are passed as
environment variables in an action node call of a script. When you use an action
node, you do not recieve the variables as command line type arguments they are
only available via enviornment variables. Here is a script that deals with frame
relay DLCIs:
#!/usr/bin/perl
# **************************************************************** # *** Frame Relay Trap Processor *** # **************************************************************** # *** Status: invalid (1) *** # *** active (2) *** # *** inactive (3) *** # *** *** # *** frDLCIStatusChange TRAP-TYPE *** # *** ENTERPRISE frame-relay *** # *** VARS {frCircuitIfIndex,frCircuitDlci,frCircuitState } *** # *** DESCRIPTION *** # *** "This trap indicates that the indicated Virtual *** # *** Circuit has changed state. It has either been *** # *** created or invalidated, or has toggled between *** # *** the active and inactive states." *** # **************************************************************** #
open (TRAPDATA, ">>/usr2/SysLogTraps.log"); @data = "">$TimeStamp = join('
',@data[1],@data[2],@data[3]);
$Origin = $ENV{'NVA'};
$frCircuitIndex = $ENV{'NVATTR_1'}; $frCircuitDLCI = $ENV{'NVATTR_2'}; $frCircuitState = $ENV{'NVATTR_3'}; if ($frCircuitState == 1 )
{ # *** DLCI Status Change to Invalid *** $Status = "Invalid"; $MsgText = join(" ",$TimeStamp,"Router: ",$Origin," DLCI: ",$frCircuitDLCI," is now ",$Status,"\n"); `echo '$MsgText' | mailx -s '$MsgText' scott_barr\@csgsystems.com`; print TRAPDATA $MsgText; } elsif ($frCircuitState == 2 )
{ # *** DLCI Status Change to Active *** $Status = "Active"; $MsgText = join(" ",$TimeStamp,"Router: ",$Origin," DLCI: ",$frCircuitDLCI," is now ",$Status,"\n"); `echo '$MsgText' | mailx -s '$MsgText' scott_barr\@csgsystems.com`; print TRAPDATA $MsgText; } elsif ($frCircuitState == 3 )
{ # *** DLCI Status Change to Active *** $Status = "Inactive"; $MsgText = join(" ",$TimeStamp,"Router: ",$Origin," DLCI: ",$frCircuitDLCI," is now ",$Status,"\n"); `echo '$MsgText' | mailx -s '$MsgText' scott_barr\@csgsystems.com`; print TRAPDATA $MsgText; } `echo '$MsgText' >> /usr2/router_avail.log`;
close (TRAPDATA);
Notice that in the beginning of the
script the variables from the trap are pulled out using Environment variables.
There is (that I know of) NO environment variable that tells you how many
environment variables have been passed. Thus, I cannot tell if there are 3, 4 or
5 arguments in the trap. I apologize if my
previous messages haven't made this clear and if my frustration level seems to
be rising.
|
Previous by Date: | RE: [nv-l] Cursed Cisco Trap Formats, Barr, Scott |
---|---|
Next by Date: | RE: [nv-l] Cursed Cisco Trap Formats, James Shanks |
Previous by Thread: | RE: [nv-l] Cursed Cisco Trap Formats, Barr, Scott |
Next by Thread: | RE: [nv-l] Cursed Cisco Trap Formats, James Shanks |
Indexes: | [Date] [Thread] [Top] [All Lists] |
Archive operated by Skills 1st Ltd
See also: The NetView Web