NetSNMP::TrapReceiver

Embedded Perl trap handling for Net-SNMP's snmptrapd
Download

NetSNMP::TrapReceiver Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Wes Hardaker
  • Publisher web site:
  • http://search.cpan.org/~hardaker/

NetSNMP::TrapReceiver Tags


NetSNMP::TrapReceiver Description

Embedded Perl trap handling for Net-SNMP's snmptrapd NetSNMP::TrapReceiver is a Perl module used to register Perl subroutines into the Net-SNMP snmptrapd process. Net-SNMP MUST have been configured using --enable-embedded-perl. Registration of functions is then done through the snmptrapd.conf configuration file. This module can NOT be used in a normal perl script to receive traps. It is intended solely for embedded use within the snmptrapd demon.Within the snmptrapd.conf file, the keyword "perl" may be used to call any perl expression and using this ability, you can use the NetSNMP::TrapReceiver module to register functions which will be called every time a given notification (a trap or an inform) is received. Registered functions are called with 2 arguments. The first is a reference to a hash containing information about how the trap was received (what version of the SNMP protocol was used, where it came from, what SNMP user name or community name it was sent under, etc). The second argument is a reference to an array containing the variable bindings (OID and value information) that define the noification itself. Each variable is itself a reference to an array containing three values: a NetSNMP::OID object, the value that came associated with it, and the value's numeric type (see NetSNMP::ASN for further details on SNMP typing information).Subroutines are registered using the NetSNMP::TrapReceiver::register function, which takes two arguments. The first is a string describing the notification you want to register for (such as "linkUp" or "MyMIB::MyTrap" or ".1.3.6.1.4.1.2021...."). Two special keywords can be used in place of an OID: "default" and "all". The "default" keyword indicates you want your handler to be called in the case where no other handlers are called. The "all" keyword indicates that the handler should ALWAYS be called for every notification.SYNOPSISPut the following lines in your snmptrapd.conf file: perl NetSNMP::TrapReceiver::register("trapOID", &myfunc); Requirements: · Perl


NetSNMP::TrapReceiver Related Software