nv-l
[Top] [All Lists]

RE: [NV-L] Can we break down the var bind further and represent it on th

To: "Tivoli NetView Discussions" <nv-l@lists.ca.ibm.com>
Subject: RE: [NV-L] Can we break down the var bind further and represent it on the event viewer?
From: "Lakka, Rajesh Kumar" <Rajesh.Lakka@in.unisys.com>
Date: Thu, 4 Dec 2008 20:02:18 +0530
Delivery-date: Thu, 04 Dec 2008 14:34:40 +0000
Envelope-to: nv-l-archive@lists.skills-1st.co.uk
In-reply-to: <OF1DAD6B2E.05084441-ON85257512.006867FB-85257512.006B58D4@us.ibm.com>
List-help: <mailto:nv-l-request@lists.ca.ibm.com?subject=help>
List-id: Tivoli NetView Discussions <nv-l.lists.ca.ibm.com>
List-post: <mailto:nv-l@lists.ca.ibm.com>
List-subscribe: <http://lists.ca.ibm.com/mailman/listinfo/nv-l>, <mailto:nv-l-request@lists.ca.ibm.com?subject=subscribe>
List-unsubscribe: <http://lists.ca.ibm.com/mailman/listinfo/nv-l>, <mailto:nv-l-request@lists.ca.ibm.com?subject=unsubscribe>
References: <D566E8CF3538B54D95B925CB69CB4D2A18408118@inblr-exch1.eu.uis.unisys.com> <OF1DAD6B2E.05084441-ON85257512.006867FB-85257512.006B58D4@us.ibm.com>
Reply-to: Tivoli NetView Discussions <nv-l@lists.ca.ibm.com>
Sender: nv-l-bounces@lists.ca.ibm.com
Thread-index: AclT64vo/LWS+zV9Rj2EiIz8ZtTJTACMXpRQ
Thread-topic: [NV-L] Can we break down the var bind further and represent it on the event viewer?

James,
          Thanks for your reply, tried the below mentioned procedure.

Incoming trap original trap was 11234 with the same OID .1.3.6.1.4.1.3183.1.1
For the above original trap action command was given as a batch file with path 

The batch file containing the below script 

nvsnmptrap 129.227.154.102 .1.3.6.1.4.1.3183.1.1 192.62.182.203 6 11234 0 
system.sysDescr.0 octetstring "test trap"

The batch is executed only if it is run as console application. Hidden 
application does not execute the above script(batch file), Why the batchfile 
does not run as a hidden application?

The incoming trap number and the new message containing the redirected trap 
number is same, hence if the original trap is set to logonly the redirected 
trap also does not get displayed. If it is set to other than log only then both 
the incoming and redirected trap get displayed.

But the problem is both incoming and redirected trap have the same trap number 
and OID and hence logonly does not display both.

What we are trying to do is that the incoming trap should not be displayed, 
whereas the redirected trap should get displayed. 

Is there a way to pass the parsed string in script to the incoming trap rather 
than generating another redirected nvsnmptrap event? Can we access the database 
and modify the string before trap event getting displayed?

Thanks,
Rajesh
________________________________________
From: nv-l-bounces@lists.ca.ibm.com [mailto:nv-l-bounces@lists.ca.ibm.com] On 
Behalf Of James Shanks
Sent: Tuesday, December 02, 2008 1:03 AM
To: Tivoli NetView Discussions
Subject: RE: [NV-L] Can we break down the var bind further andrepresent iton 
the event viewer?

Well, I'd start with the NetView documentation. This is not a trivial exercise.

According to the nv-l archives you are using NetView for Windows. In the User's 
Guide, read over Chapter 6, Working with events and event filters, especially 
the sections on Configuring events, Avoiding security problems with 
non-alphanumeric characters in traps and Actions on events. That will cover the 
basics of what you have to do.

Then you can configure this trap to launch a hidden command. I'd start with a 
simple test case. Put this in a file called "echovar.hidden.bat" in \usr\ov\bin:

::
:: The purpose of this script is to echo variables to a file
::  to test a hidden application
::   You must pass variables to the script as $E, $1, $2 etc
::   and variables which might contain spaces must be encapsulated in
::   quotation marks.  Invoke it like this as a hidden command:
::     \usr\ov\bin\echovar.hidden.bat $E $A "$1" "$2" "$3" "$4" "$5"
::
date /t  >> \usr\ov\log\echo-hidden.txt
time /t  >> \usr\ov\log\echo-hidden.txt
echo "enterprise = " %1 >>  \usr\ov\log\echo-hidden.txt
echo "agent = " %2 >> \usr\ov\log\echo-hidden.txt
echo "var1 = " %3 >> \usr\ov\log\echo-hidden.txt
echo "var2 = " %4 >> \usr\ov\log\echo-hidden.txt
echo "var3 = " %5 >> \usr\ov\log\echo-hidden.txt
echo "var4 = " %6 >> \usr\ov\log\echo-hidden.txt
echo "var5 = " %7 >> \usr\ov\log\echo-hidden.txt

And then run trap.exe, select your trap, click on Properties, and at the bottom 
of the Trap Properties panel, put
[drive_letter]: \usr\ov\bin\echovar.hidden.bat $E $A "$1" "$2" "$3" "$4" "$5"
in the box labeled "Run this command when the trap is received". "Run as" 
should say "Hidden Application" (which means it does not require a console for 
display). 

Once you have this working you can set about modifying it. Change the variables 
passed in to get just what you want. Then add mode code map them into an 
nvsnmptrap command to send a trap. You can look that up in the Netview for 
Windows Programmer's Reference. But here's a sample which sends a replica 
NetView Node Down trap
::!/bin/ksh
:: ndwn.trap.bat
::
:: sample bat file script to send a replica Node down trap   (Version 7 style)
::
:: 1. We are not sending the port (it defaults to 162 udp)
:: 2. we could skip sending community name but here we are using a bogus one
:: just to show that trapd doesn't care what one you use but
:: you can configure the Log message to show $C and see what it is.
:: 3. Below the first hostname is the trapd destination -- your box or some 
other
:: 4. The second hostname is the agent sending the trap -- it cannot be a bogus
:: hostname, but you can use a bogus IP address to make it easy to spot. 
:: 5. The contents of the 4th variable in real life are :
::  -- timestamp -- object id of host --
:: Here they are just made up.
::
 nvsnmptrap  -c  public ^
  jshanks1.raleigh.ibm.com  .1.3.6.1.4.1.2.6.3.1  ^
  jshanks2.raleigh.ibm.com  6 58916865  1 ^
.1.3.6.1.4.1.2.6.3.1.1.2.0  Integer 2  ^
.1.3.6.1.4.1.2.6.3.1.1.3.0  OctetStringascii  "jshanks2.raleigh.ibm.com" ^
.1.3.6.1.4.1.2.6.3.1.1.4.0  OctetStringascii  "Node Down" ^
.1.3.6.1.4.1.2.6.3.1.1.5.0  OctetStringascii  "890775021 256" ^
.1.3.6.1.4.1.2.6.3.1.1.6.0  OctetStringascii  "openview"  ^
.1.3.6.1.4.1.2.6.3.1.1.7.0  OctetStringascii  "jshanks2.raleigh.ibm.com" ^
.1.3.6.1.4.1.2.6.3.1.1.8.0  OctetStringascii  "9.27.144.48"  ^
.1.3.6.1.4.1.2.6.3.1.1.9.0  OctetStringascii  "[9.27.144.48]"  

I hope by now you see where to go with this. You are going to have to write 
code to parse the variables passed in and map them to the output trap you want 
to send. If you program in PERL or REXX rather than Windows batch file, it will 
be that much easier. And you can use any enterprise OID you like, including the 
original one, or you can use NetView's .1.3.6.1.4.1.2.6.3.1 Specific id's from 
1000 to 1100 are reserved for that purpose. 

Once you have this working, I'd set the original trap to "Log Only" using 
trap.exe and then the event browser will only display your new one by default.

Happy hacking,


James Shanks
Tivoli Network Availability Management Level Three 
Network Availability Management
Tivoli Software, IBM Corp
1-919-224-1642 | T/L 687-1642 | ITN 26871642

_______________________________________________
NV-L mailing list
NV-L@lists.ca.ibm.com
Unsubscribe:NV-L-leave@lists.ca.ibm.com
http://lists.ca.ibm.com/mailman/listinfo/nv-l (Browser access limited to 
internal IBM'ers only)

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

Archive operated by Skills 1st Ltd

See also: The NetView Web