nv-l
[Top] [All Lists]

Re: [nv-l] Formating traps in a script

To: nv-l@lists.us.ibm.com
Subject: Re: [nv-l] Formating traps in a script
From: James Shanks <jshanks@us.ibm.com>
Date: Tue, 11 Apr 2006 10:25:15 -0400
Delivery-date: Tue, 11 Apr 2006 15:25:50 +0100
Envelope-to: nv-l-archive@lists.skills-1st.co.uk
In-reply-to: <OFD821695E.A1D4BCF5-ONC125714D.004B3F05-C125714D.004B4C59@vd.ch>
Reply-to: nv-l@lists.us.ibm.com
Sender: owner-nv-l@lists.us.ibm.com
There is no user tool to available format the trap in your action.  If you
want to send the same message as in the event window, then your script will
have to do the formatting itself, using the trap variables, such as $NVA,
$NVATTR_1 to $NVATTR_50, and so on.  Events passed to actionsvr have three
new varbinds tacked on the end, the severity, source, and category from
trapd.conf.  This is reflected in another variable, $NVATTR_COUNT which
tells how many are present.  You can access the severity as $NVSEV, the
source as $NVSRC, and the category as $NVCAT; or as just one of $NVATTR_n.
All this should be documented in the December 2005 updates to the printed
documentation in the UNIX Admin Guide.

Trying to read trapd.log will not likely work.  trapd sends the trap to all
connected application BEFORE he logs it, and even then, the logging is
buffered I/O.  It will not get written to the log until the next trap
arrives, and even then, the log is not written to any faster than once per
second to prevent logging from slowing down trapd.   So reading trapd.log
is not an effective method to get the formatted trap message trap for your
ruleset.

James Shanks
Level 3 Support  for Tivoli NetView for UNIX and Windows
Tivoli Software / IBM Software Group


                                                                           
             thierry.van-mol@v                                             
             d.ch                                                          
             Sent by:                                                   To 
             owner-nv-l@lists.         nv-l@lists.tivoli.com               
             us.ibm.com                                                 cc 
                                                                           
                                                                   Subject 
             04/11/2006 09:42          [nv-l] Formating traps in a script  
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
             nv-l@lists.us.ibm                                             
                   .com                                                    
                                                                           
                                                                           






In a correlation rule, after a node that selects a generic trap, I have an
action node calling a script to some alert things. My problem is the
following, I want in that script send an email that will contain
some informations and the trap message like it is formatted in the
event window. However, in the script I get only, through environment
variables, the generic and specific trap number. From, there, is there
a tool to get the trap message.

I had the idea to get the information from the trapd.log file, by doing
a grep on the time and node sending the trap. However, I noticed that
when my script is called by the action node, the trapd.log file does
not yet contain the trap (and sometimes yes; a race condition apparently).

Has someone an idea on how to achieve this?


----------------------------------------------------------------------------

Thierry Van Mol                                 email:
thierry.van-mol@vd.ch
Centre Cantonal des Telecommunications          Tel: +41 (0) 21 316 27 05


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

Archive operated by Skills 1st Ltd

See also: The NetView Web