1Mon::SNMP(3) User Contributed Perl Documentation Mon::SNMP(3)
2
3
4
6 Mon::SNMP - decode SNMP trap
7
9 use Mon::SNMP;
10
11 $trap = new Mon::SNMP;
12
13 $trap->buffer($snmptrap);
14
15 %traphash = $trap->decode;
16
17 $error = $trap->error;
18
20 Mon::SNMP provides methods to decode SNMP trap PDUs. It is based on
21 Graham Barr's Convert::BER module, and its purpose is to provide SNMP
22 trap handling to "mon".
23
25 new creates a new Mon::SNMP object.
26
27 buffer ( buffer )
28 Assigns a raw SNMP trap message to the object.
29
30 decode
31 Decodes a SNMP trap message, and returns a hash of the variable
32 assignments for the SNMP header and trap protocol data unit of the
33 associated message. The hash consists of the following members:
34
35 version => SNMP version (1)
36 community => community string
37 ent_OID => enterprise OID of originating agent
38 agentaddr => IP address of originating agent
39 generic_trap => /COLDSTART|WARMSTART|LINKDOWN|LINKUP|AUTHFAIL|EGPNEIGHBORLOSS|ENTERPRISESPECIFIC/
40 specific_trap => specific trap type (integer)
41 timeticks => timeticks (integer)
42 varbindlist => { oid1 => value, oid2 => value, ... }
43
45 All methods return a hash with no elements upon errors which they
46 detect, and the detail of the error is available from the
47
49 use Mon::SNMP;
50
51 $trap = new Mon::SNMP;
52
53 $trap->buffer($snmptrap);
54
55 %traphash = $trap->decode;
56
57 foreach $oid (keys $traphash{"varbindlist"}) {
58 $val = $traphash{"varbindlist"}{$oid};
59 print "oid($oid) = val($val)\n";
60 }
61
63 None.
64
66 Graham Barr's Convert::BER module.
67
70 Mon::SNMP depends upon Convert::BER to do the real work.
71
72
73
74perl v5.30.0 2019-07-26 Mon::SNMP(3)