The snmptrapd CLI application sets up a listener for SNMP notifications (TRAP or INFORM) from the Master SNMP Agent. The SNMP Plugin uses its Subscriber relationship with InfoHub to obtain notification details and sends them to the SNMP Master Agent. Then, snmptrapd receives those notifications in the form of a TRAP or an INFORM. INFORM differs from a TRAP in that it requires acknowledgement message, while the TRAP does not. Because snmptrapd, by default, listens for SNMP notifications on the special privilege UDP port 162 on IPv4 interfaces, you need to run the snmptrapd command as root. At any given time, only one snmptrapd can receive notifications but you can set up one or more listening addresses (refer to the man page entry for snmpd for more information). A typical syntax of the snmptrapd command in the SNMP Plugin is:
snmptrapd[<snmpcmd_common_options>] -m <MIBModule(s)> -Lo -f -t -Oa
-
-f
Disables forking from the calling shell. For more information, refer to the man page entry for snmptrapd.
-
-t
Disables logging of messages to the system log. For more information, refer to the man page entry for snmptrapd. For more information, refer to the man page entry for snmptrapd.
-
snmpcmd_common_options
snmpcmd_common_options are options and agent arguments that are common to most snmp commands. For more information, refer to the man page entry for snmpcmd.
-
-L
Specifies the mechanism and target location for messages coming to snmptrapd. -Lo specifies that the received messages should be logged to STDOUT. For more information, refer to the LOGGING OPTIONS in the man page entry for snmpcmd.
-
-Oa
Displays strings in ASCII form. For more information on the -O option, refer to the man page entry for snmpcmd.
For more information on the snmptrapd command options, refer to the man page of the snmptrapd command.
Examples:
$ sudo snmptrapd -m INFOHUB-1-MIB -Lo -f -t -Oa SNMPv2-SMI::snmpModules.1.1.4.1.0 = OID: INFOHUB-1-MIB::infohubtestMyBoxSyslogDBFILEXTcurr.0 2013-10-23 03:34:10 localhost.localdomain [UDP: [127.0.0.1]:54501->[127.0.0.1]]: SNMPv2-SMI::mib-2.1.3.0 = Timeticks: (118883997) 13 days, 18:13:59.97 SNMPv2-SMI::snmpModules.1.1.4.1.0 = OID: INFOHUB-1-MIB::infohubtestMyBoxSyslogDBFILEXTcurr.0
This example sets up a listener for notifications coming from InfoHub. -Lo specifies that the messages are logged on standard output. The DBFILEXT notification that arrives on snmptrapd is from a Noinfo subscription called DBFILEXT which InfoHub raised due to lack of activity for the DBFILEXT message.
AIX Notes | |
---|---|
On AIX, use the NET-SNMP executable to set up a listener for notifications coming from InfoHub. A sample snmptrapd command might look like: sudo /usr/local/sbin/snmptrapd -m INFOHUB-1-MIB -Oa -Lo -f -t |