nv-l

RE: [nv-l] How to pass Octet String trap parameter to script ?

2003-09-16 12:17:42
Subject: RE: [nv-l] How to pass Octet String trap parameter to script ?
From: James Shanks <jshanks AT us.ibm DOT com>
To: nv-l AT lists.tivoli DOT com
Date: Tue, 16 Sep 2003 12:16:58 -0400

Ah.  Now I see what you are driving at.  You are correct, though the "confusion" is actually deliberate.  
 If the trap data is identified as "Octet String" and yet it contains unprintable characters then trapd displays the entire string in hex because it cannot determine whether the unprintable hex was important or not.    Rather than not display something important, like a MAC address,  it errs on the side of caution and delivers hex instead.  But if you are seeing that hex display in the nvevents display window, then I believe that enclosing the variable in quotes will allow that same hex string to be passed to ovactiond, though I am not certain.  

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



"Allison, Jason (JALLISON)" <JALLISON AT arinc DOT com>

09/16/2003 11:59 AM

       
        To:        nv-l <nv-l AT lists.tivoli DOT com>
        cc:        
        Subject:        RE: [nv-l] How to pass Octet String trap parameter to script ?



If trapd/nvevent gets confused about the type of data in the varbind, I have seen it dump values like the email below shows.  It would be my guess it is getting escaped because the SNMP definition for that trap is not correct.
 
 

Jason Allison
Principal Engineer

ARINC Incorporated

Office:  (410) 266-2006

FAX:  (410) 573-3026

-----Original Message-----
From:
James Shanks [mailto:jshanks AT us.ibm DOT com]
Sent:
Tuesday, September 16, 2003 11:57 AM
To:
nv-l AT lists.tivoli DOT com
Subject:
Re: [nv-l] How to pass Octet String trap parameter to script ?


What's in the display window of nvevents is a construction. nvevents has already set aside a buffer and interpreted it.  What you are passing to your script is raw data from trapd.


If it contains blanks, then you must enclose it in quotes, just as you would any other script input on the command line.    You have to pass

       <myscript>  "$3"  

not just
       <myscript> $3
or the shell will pass only the first word of $3.


In general it doesn't hurt to enclose all of your variables

       <myscript> "$1" "$2" "$3" "$4" "$5"

when you don't know what form the incoming data will take.

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


"Philippe Menard" <PME AT fr.ibm DOT com>

09/16/2003 11:42 AM

       
       To:        nv-l AT lists.tivoli DOT com

       cc:        

       Subject:        [nv-l] How to pass Octet String trap parameter to script ?





All,


AIX 4.3.3 ML10 + NV 7.1.3 + popular patches.


I need to provide a script with the parameters found in a trap.

$1, $2, etc work fine for integers and strings but doesn't for Octet Strings.


It seems that the bytes are passed (and escaped for most of them) by ovactiond.

Is there is way to get the bytes string as displayed in the events window ?

( i.e. a string like "0x01 12 34 ab ..." )

Best regards,

Philippe.


- - -


Philippe MÉNARD
Networking Delivery Support Center
Mail : pme AT fr.ibm DOT com
Phone : +33 (0)4 92 11 48 69
Fax : +33 (0)4 93 24 49 07