Re: Sending traps using Perl
Fulko Hew <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <CAGuV3hO9kE-ZN22430j0i=FqpvYRE5k0J-mB2ht0VP6_7OXdQw@mail.gmail.com> |
On Thu, Sep 29, 2011 at 8:56 AM, <[email protected]> wrote: > Fulko, > > I understand your point that a LinkUp trap needs the additional ifIndex > varbind. I didn't understand why the example I had been given by Bart also > contained a sysDescr var-bind. My point is that I wish to send an enterprise > specific trap that contains no additional var-binds. How do I do this? The > following line is unsuccessful: > > :\Perl\bin\perl -e "use SNMP; $SNMP::verbose=1; $SNMP::debugging=2; > $SNMP::dump_packet=1; my $session = new SNMP::TrapSession(Community => > \"public\", Port => 162, Version => \"2c\"); $session->trap(oid => > \"1.3.6.1.4.1.2257.11.1.1.0.0.9\" ); > > This line results in a trap being sent - Why do I need to put in some > var-bind when I don't want to ??? > hm... I don't know, perhaps someone else can answer this one. Just for laughs I tried sending it as a V1 trap with no varbind, and it worked. > :\Perl\bin\perl -e "use SNMP; $SNMP::verbose=1; $SNMP::debugging=2; > $SNMP::dump_packet=1; my $session = new SNMP::TrapSession(Community => > \"public\", Port => 162, Version => \"2c\"); $session->trap(oid => > \"1.3.6.1.4.1.2257.11.1.1.0.0.9\", [[sysLocation,0,\"Here\"]] ); > > > My other point is that the call to SNMP::sys_uptime() is actually coming > from the trap subroutine in the SNMP.pm perl module not from my own code. > This does not seem to be obtaining the correct value of sysUpTime. e.g. > After running my agent for only a minute, the snmptrapd output displays this > as 391 days or so. > I tried your example on my system, and it provided me an up-time value of 47796740 which (because its in hundreths of a second works out to be 5.5 days, which when I check is how long my Net-SNMP master agent has been running. Not _my_ sub-agent, but the master agent. ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 _______________________________________________ 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