writting a snmptrap handler

Jacky Chan <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi

I am writing a snmptrap handler by shell scrip. I want the script to
collects all snmptrap variables and put the processed items into a
template and then using the snmptrap to regen the messages to the NMS.

I can send the individual message without problem, but when I execute
the test-script to send the $template to NMS, I got an error. Could
you tell me what I missed ?

Something[8]": Unknown Object Identifier (Sub-id not found: (top) ->
Something[8]")

Here is my test-script
#!/bin/sh

host="10.10.10.10"

oid_ar[1]="SNMPv2-SMI::org.1.0"
oid_ar[2]="SNMPv2-SMI::org.2.0"
oid_ar[3]="SNMPv2-SMI::org.3.0"
oid_ar[4]="SNMPv2-SMI::org.4.0"
oid_ar[5]="SNMPv2-SMI::org.5.0"

val_ar[1]="Missing Something[8]"
val_ar[2]="Unknown"
val_aru[3]="PRS-HKOUT-1A"
val_ar[4]="1"
val_ar[5]="0"



outCount=1
while [ "${oid_ar[outCount]}" != '' ];do
template="$template ${oid_ar[$outCount]} s \"${val_ar[$outCount]}\""
outCount=$((outCount+1))
done

/usr/bin/snmptrap -v 1 -c public 1.2.3.4 .1.3.6.1.4.1.1.6.4.0 "$host"
6 204 "" $template

#debug
/usr/bin/snmptrap -v 1 -c public 1.2.3.4 .1.3.6.1.4.1.1.6.4.0 "$host"
6 204 "" ${oid_ar[1]} s "${val_ar[1]}"


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.