[Top] [All Lists]

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

To: Tivoli NetView Discussions <nv-l@lists.ca.ibm.com>
Subject: RE: [NV-L] Can we break down the var bind further and represent iton the event viewer?
From: James Shanks <jshanks@us.ibm.com>
Date: Mon, 1 Dec 2008 14:32:30 -0500
Delivery-date: Mon, 01 Dec 2008 19:32:34 +0000
Envelope-to: nv-l-archive@lists.skills-1st.co.uk
In-reply-to: <D566E8CF3538B54D95B925CB69CB4D2A18408118@inblr-exch1.eu.uis.unisys.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>
Reply-to: Tivoli NetView Discussions <nv-l@lists.ca.ibm.com>
Sender: nv-l-bounces@lists.ca.ibm.com

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
:: 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  .  ^
  jshanks2.raleigh.ibm.com  6 58916865  1 ^
.  Integer 2  ^
.  OctetStringascii  "jshanks2.raleigh.ibm.com" ^
.  OctetStringascii  "Node Down" ^
.  OctetStringascii  "890775021 256" ^
.  OctetStringascii  "openview"  ^
.  OctetStringascii  "jshanks2.raleigh.ibm.com" ^
.  OctetStringascii  ""  ^
.  OctetStringascii  "[]"  

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 . 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
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