Every variable in a trap is an ordered triple, consisting of
MIB object identifier -- type -- value
and snmptrap wants you to enter the information that way.
You cannot just pass it the values an expect it to determine how to send
them.
Here's an example of using snmptrap in script which I hope will make clear
what you have to do.
Notice that the first instance of hostname is the box to which you are
sending, the second is the one which the trap is from. That will default
if you like. For your purposes, what's important are the variables, and
how they are passed as three pieces (object -type-value) in each one. It
is not necessary for purposes of issuing the command to use the entire
object identifier as shown here for clarity. You could abbreviate this as
just ".1.2.0", ".1.3.0", ".1.4.0", and so on.
Below is a shell script which will issue the specail 58916871 trap to
change the status of an object on the map via the snmptrap command. You
pass it two variables --
(1) the name of the object from object database, and (2) the status you
want this changed to on the map(s).
Here's the script:
#!/bin/ksh
set -x
NAME=$1
STATE=$2
/usr/OV/bin/snmptrap `hostname` .1.3.6.1.4.1.2.6.3.1 \
`hostname` 6 58916871 1 \
.1.3.6.1.4.1.2.6.3.1.1.2.0 Integer 14 \
.1.3.6.1.4.1.2.6.3.1.1.3.0 OctetString $NAME \
.1.3.6.1.4.1.2.6.3.1.1.4.0 OctetString "Object status is" \
.1.3.6.1.4.1.2.6.3.1.1.5.0 OctetString $STATE
Obviously you can make this script more elaborate if you like.
The permissable status values are Unknown, Normal, Marginal, Critical, Up,
Down, User1, and User2.
Hope this helps
James Shanks
Tivoli (NetView for UNIX) L3 Support
"Rama, R. (Reggie)" <ReggieR@NEDCOR.CO.ZA> on 10/05/98 12:31:59 PM
Please respond to Discussion of IBM NetView and POLYCENTER Manager on
NetView et alia <NV-L@UCSBVM.UCSB.EDU>
To: NV-L@UCSBVM.UCSB.EDU
cc: (bcc: James Shanks)
Subject: Error message returned by snmptrap
Hello everybody
I wonder if anyone could assist me with this.
I am using the snmptrap command to send a trap to another machine that does
the paging. When I generate the message
.i.e. format
/usr/OV/bin/snmptrap rars-2.it.nednet.co.za $NVE $NVA $NVG $NVS $NVT
system.sysDescr.0 octetstring $NVA
NV returns the following error message
Variable binding must be specified as multiplies of 3.4 is not a multiple
of
3 extra arguments
I have condensed the message to send only a single [ variable type value]
set and I still get this error message.
Any assistance will be greatly appreciated.
Regards
Reggie Rama
Nedcor IT, S.A
|