Re: Sending traps using Perl

Fulko Hew <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAGuV3hOdn6V849TrA97JiFb_TK2TCdDb2gL0pcECBDWzWfVPZA@mail.gmail.com>
On Thu, Sep 29, 2011 at 5:26 AM, <[email protected]> wrote:

> I have some further questions/observations on this subject.
>
> The reason that I have not been able to send my own Enterprise specific
> trap is that it does not have any additional var-binds associated with the
> trap i.e I want to send the trap with an empty associated var-bind list. e.g
> Bart in your example if I send a LinkUp trap as follows the trap is not
> sent.
>
> C:\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 =>
> \"linkUp\");"
>
> I can send my trap like so, but I have ahad at add on an optional var-bind
> the SysLocation field to make it work!:
>

a) You should not be adding 'sysLocation to the varbind.
b) The linkup trap is defined to have a non-optional varbind
c) The varbind must contain the the value of ifIndex (of the interface that
went up).



> C:\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\"]]);"
>
> In response to your earlier question about omitting the uptime field the
> SNMP.pm perl module seems to be making the following call at line 1191:
>
>        my $uptime = $param{uptime} || SNMP::_sys_uptime();
>
> The call to SNMP::sys_uptime() seems to be returning a negative value and
> not the correct sysUpTime. Note the correct sysUptime is obtained when
> performing a get-request on my agent.
>

SysUpTime is defined as a 'TimeTicks' which is defined as an  INTEGER
(0..4294967295),
so what I think you are seeing is a signed interpretation of the value and
not the unsigned
interpretation that it really is.  Ie. DON'T print the 32 bit value as a
signed integer!

------------------------------------------------------------------------------
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
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.