Ok, got it. I can make that work.
Thanks for all your help James!!
Craig
-----Original Message-----
From: James Shanks [mailto:jshanks@us.ibm.com]
Sent: Tuesday, March 12, 2002 10:20 AM
To: Treptow, Craig
Cc: nv-l@lists.tivoli.com
Subject: RE: [nv-l] Formatting trap variables like "$+1"
Ah, Now I see. Sorry, Craig.
I re-read the original post and reminded myself of the issue.
The problem here is that what gets passed to nvcorrd is just the contents
of the trap. The content of the first variable is just the integer 6, and
there is nothing you can do to change that, except to issue your own trap
with more in it. What you want to reference is not the content itself,
but the "box" that the variable content came in, as I called it in the
earlier post. But nvcorrd doesn't have access to that. So you cannot do
what you want to do in a ruleset action.
Who has access to the incoming box? trapd. Who can he give it to besides
himself? ovactiond. ovactiond does not use the encoded trap structure
that nvcorrd and all the other daemons do. If you want him to get
something you have to pass it. So your only choice is to have him execute
your script, or some variant of it. To do that you add the command as a
"Command for Automatic Action" to trapd.conf using xnmtrap.
This, for example, should work,
<full_path>.myscript "$+1" "$+2" "$+3" "$+4" "$+5" "$+6" "$+7"
"$+8"
and in the script you have
echo "$1" >> $LOGFILE
and so on.
That is essentailly what I did.
James Shanks
Level 3 Support for Tivoli NetView for UNIX and NT
Tivoli Software / IBM Software Group
"Treptow, Craig" <Treptow.Craig@principal.com>
03/12/2002 10:30 AM
To: nv-l@lists.tivoli.com
cc: James Shanks/Raleigh/IBM@IBMUS
Subject: RE: [nv-l] Formatting trap variables like "$+1"
Hmmm...
I'm doing this right now in the script:
echo "NVA=[$NVA]" > $LOGFILE
echo "NVATTR_1=[$NVATTR_1]" >> $LOGFILE
echo "NVATTR_2=[$NVATTR_2]" >> $LOGFILE
echo "NVATTR_3=[$NVATTR_3]" >> $LOGFILE
echo "NVATTR_4=[$NVATTR_4]" >> $LOGFILE
The NVATTR_1, just gets me '6', not
'cHsrpGrpEntry.cHsrpGrpStandbyState.8.0 6'.
So, I think I'm still missing something, or doing something wrong.
Thanks for your help!!
Craig
-----Original Message-----
From: James Shanks [mailto:jshanks@us.ibm.com]
Sent: Tuesday, March 12, 2002 9:25 AM
To: Treptow, Craig
Cc: nv-l@lists.tivoli.com
Subject: Re: [nv-l] Formatting trap variables like "$+1"
Craig -
Are you passing the NVATTR variables to your script, or just referencing
them?
To pass them you must enclose them in quotation marks, because otherwise
the shell will stop as the first space when it instantiates the variable.
For example, to pass your variables you'd need to say
<full_path>myscript "NVATTR_1" "NVATTR_2" "NVATTR_3"
and so on.
But because these are exported you can just use them in your script.
If you are going to echo them to file, then you could just say
echo "var1 = " NVATTR_1 >> myfile
right in the script.
James Shanks
Level 3 Support for Tivoli NetView for UNIX and NT
Tivoli Software / IBM Software Group
"Treptow, Craig" <Treptow.Craig@principal.com>
03/12/2002 10:06 AM
To: "NetView List (E-mail)" <nv-l@lists.tivoli.com>
cc:
Subject: [nv-l] Formatting trap variables like "$+1"
I am having trouble implementing James Shanks' solution to Karin Binder's
problem back in February and am hoping somebody can help me.
This is the question I'm referring to:
http://www.vk.net/tivoli/Netview-List.nsf/4a25624e007bfc5c85255a850068ca27/5bf179679b67e533ca256b6600544312!OpenDocument
Basically, James suggested using the "$+1" formatting of a trap variable.
It seems straightforward, but I think I am missing something.
I have a similar situation with Cisco HSRP state change traps.
I can format the variable in the trap by doing the "$+1", and in the
events display I do get:
"cHsrpGrpEntry.cHsrpGrpStandbyState.8.0 6", but when I look at the
"NVATTR_*" variables passed to my script in an action node all I have is:
NVA=[offline-dist-1-l3.net.principal.com]
NVATTR_1=[6]
NVATTR_2=[3]
NVATTR_3=[A]
NVATTR_4=[4]
What am I missing to make this work? I'm trying to use the "8.0" to
eventually do some SNMP gets and figure out which interface had the HSRP
state change.
Thanks for any help.
Craig
---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe@lists.tivoli.com
For additional commands, e-mail: nv-l-help@lists.tivoli.com
*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)
---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe@lists.tivoli.com
For additional commands, e-mail: nv-l-help@lists.tivoli.com
*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)
|