Gord -
Have you tried this script? What error messages do you get?
1. I think the final "4" in the first line in bogus and should not be there.
The man page for snmptrap says the only thing after the specific id, and before
you start the variables, is the timestamp, and would be just the "1" in your
example.
2. Yes, they should, and the real OIDs that NetView sends have them. But you
need not send the real OID unless you want to, as snmptrap only cares about the
syntax and not the content. It doesn't know what the OID should be, so you can
use
".1.2.0" instead of ".1.3.6.1.4.1.2.6.3.1.1.2.0" . Trapd won't care either so
the traps will display the same.
3. No, the actual OID for a variable sent with the trap need not be sequential.
Any value in dotted decimal notation will do.
6.1 can precede 1.5 .
Here, modify this one
#!/bin/ksh
# ndwn.trap.sh
#
# sample shell script to send a replica Node down trap
#
# we are sending community name but need not. It is optional and will not be
checked.
# we are not sending port (it defaults to 162 udp)
# the first hostname is the trapd destination
# the second hostname is the agent sending the trap -- it can be bogus -- but be
a real machine
# in your network (so the name can be resolved) or you must use an IP Address
# the contents of the 4th variable in real life are :
# -- timestamp -- object id of host in the NetView database --
#
/usr/OV/bin/snmptrap -c doodah \
`hostname` .1.3.6.1.4.1.2.6.3.1 \
jshanks.raleigh.tivoli.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 "jshanks.raleigh.tivoli.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"
But given what I said in #2 above, this would work too
/usr/OV/bin/snmptrap -c doodah \
`hostname` .1.3.6.1.4.1.2.6.3.1 \
jshanks.raleigh.tivoli.com 6 58916865 1 \
.1.2.0 Integer 2 \
.1.3.0 OctetStringascii "jshanks.raleigh.tivoli.com" \
.1.4.0 OctetStringascii "Node Down" \
.1.5.0 OctetStringascii "890775021 256" \
.1.6.0 OctetStringascii "openview"
Once you get one of these to work, just play with it. That should answer your
questions for all practical purposes.
James Shanks
Tivoli (NetView for UNIX) L3 Support
Gord Michaels <gord_michaels@HOTMAIL.COM> on 12/09/99 02:08:54 PM
Please respond to Discussion of IBM NetView and POLYCENTER Manager on NetView
<NV-L@UCSBVM.UCSB.EDU>
To: NV-L@UCSBVM.UCSB.EDU
cc: (bcc: James Shanks/Tivoli Systems)
Subject: snmptrap script question...
Hello All.
I have been writing this short snmptrap script to generate a netview6000
enterprise node down event:
#!/usr/bin/ksh
# Script which will send a node down event...
/usr/OV/bin/snmptrap nv6000 .1.3.6.1.4.1.2.6.3 SCR3 6 58916865 1 4 \
.1.3.6.1.4.1.2.6.3.1.1.2 Integer 14 \
.1.3.6.1.4.1.2.6.3.1.1.3 OctetString "SOME_ROUTER" \
.1.3.6.1.4.1.2.6.3.1.1.4 OctetString "TEST ONLY - Node Down." \
.1.3.6.1.4.1.2.6.3.1.1.5 OctetString "Test Only"
My questions are:
1. I am not quite sure, but I think the '4' at the end of the first line
will indicate the number of variables/arguments sent with the trap? (I took
most of this from an example I seen somewhere else.)
2. After each trap variable OID, should I have a ".0", i.e.
.1.3.6.1.4.1.2.6.3.1.1.2.0 instead of just .1.3.6.1.4.1.2.6.3.1.1.2 ?
3. For traps other than enterprise netview6000, say enterprise
.x.x.x.x.x.x.x.x.x, do the variables/arguments follow the same pattern,
i.e.:
.x.x.x.x.x.x.x.x.x.1.1.2 = variable #1
.x.x.x.x.x.x.x.x.x.1.1.3 = variable #2
.x.x.x.x.x.x.x.x.x.1.1.4 = variable #3
.x.x.x.x.x.x.x.x.x.1.1.5 = variable #4
And of course, if the netview6000 variables require the ".0" at the end then
I assume that others would also.
Any info appreciated.
Sincerely,
Gord Michaels.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
|