There's more than one way to do things | |
PerlMonks |
Re: Looking for a simple way to just send an SNMP V1 Trapby quester (Vicar) |
on Jun 11, 2007 at 22:32 UTC ( [id://620589]=note: print w/replies, xml ) | Need Help?? |
Look at "SNMP support for Perl 5" in http://www.switch.ch/misc/leinen/snmp/perl/. This is the same SNMP interface parkace used by MRTG.
For a quick example, adapted from the documentation for snmptrap on that page,
UPDATE:I fixed the definition of ifIndexOID to ifIndex_OID and added the definition of ifDescr_OID. Sorry, I thought I was copying a working example, but evidently it wasn't. Perversely, without correct definitions the program still runs with no warnings, even with warnings and strict enabled, and it sends an snmptrap packet... but the oid=value pairs in the packet are not valid. In order to debug this sort of problem, you can send the snmptrap packets to a system running Wireshark or a Unix system running snmptrapd. But be aware that the NET-SNMP version 5.0.9 version of snmptrapd won't log anything at all for a badly formatted trap packet, unless you include you include the hyperverbose -D (debug) option.
In Section
Seekers of Perl Wisdom
|
|