1SNMPTRAPD(8) Net-SNMP SNMPTRAPD(8)
2
3
4
6 snmptrapd - Receive and log SNMP trap messages.
7
9 snmptrapd [OPTIONS] [LISTENING ADDRESSES]
10
12 snmptrapd is an SNMP application that receives and logs SNMP TRAP and
13 INFORM messages.
14
15 Note: the default is to listen on UDP port 162 on all IPv4 interfaces.
16 Since 162 is a privileged port, snmptrapd must typically be run as
17 root.
18
20 -a Ignore authenticationFailure traps.
21
22 -A Append to the log file rather than truncating it.
23
24 -c FILE Read FILE as a configuration file.
25
26 -C Do not read any configuration files except the one optionally
27 specified by the -c option.
28
29 -d Dump (in hexadecimal) the sent and received SNMP packets.
30
31 -D TOKEN[,...]
32 Turn on debugging output for the given TOKEN(s). Try ALL for
33 extremely verbose output.
34
35 -e Print event numbers (rising/falling alarm etc.) from the (obso‐
36 lete) M2M-MIB.
37 This functionality is being deprecated and will be removed in
38 due course.
39
40 -f Do not fork() from the calling shell.
41
42 -F FORMAT
43 When logging to standard output, use the format in the string
44 FORMAT. See the section FORMAT SPECIFICATIONS below for more
45 details.
46
47 -h, --help
48 Display a brief usage message and then exit.
49
50 -H Display a list of configuration file directives understood by
51 the trap daemon and then exit.
52
53 -I [-]INITLIST
54 Specifies which modules should (or should not) be initialized
55 when snmptrapd starts up. If the comma-separated INITLIST is
56 preceded with a '-', it is the list of modules that should not
57 be started. not want to be started. Otherwise, INITLIST Oth‐
58 erwise this is the list of the only modules that should be
59 started.
60
61 To get a list of compiled modules, run snmptrapd with the argu‐
62 ments -Dmib_init -H (assuming debugging support has been com‐
63 piled in).
64
65 -L[efos]
66 Specify where logging output should be directed (standard error
67 or output, to a file or via syslog). See LOGGING OPTIONS in
68 snmpcmd(1) for details.
69
70 -m MIBLIST
71 Specifies a colon separated list of MIB modules to load for
72 this application. This overrides the environment variable
73 MIBS. See snmpcmd(1) for details.
74
75 -M DIRLIST
76 Specifies a colon separated list of directories to search for
77 MIBs. This overrides the environment variable MIBDIRS. See
78 snmpcmd(1) for details.
79
80 -n Do not attempt to translate source addresses of incoming pack‐
81 ets into hostnames.
82
83 -p FILE Save the process ID of the trap daemon in FILE.
84
85 -O [abeEfnqQsStTuUvxX]
86 Specifies how MIB objects and other output should be displayed.
87 See the section OUTPUT OPTIONS in the snmpcmd(1) manual page
88 for details.
89
90 -t Do not log traps to syslog. This disables logging to syslog.
91 This is useful if you want the snmptrapd application to only
92 run traphandle hooks and not to log any traps to any location.
93
94 -v, --version
95 Print version information for the trap daemon and then exit.
96
97 -x ADDRESS
98 Connect to the AgentX master agent on the specified address,
99 rather than the default "/var/agentx/master". See snmpd(8) for
100 details of the format of such addresses.
101
102 --name="value"
103 Allows to specify any token ("name") supported in the
104 snmptrapd.conf file and sets its value to "value". Overrides
105 the corresponding token in the snmptrapd.conf file. See
106 snmptrapd.conf(5) for the full list of tokens.
107
109 snmptrapd interprets format strings similarly to printf(3). It under‐
110 stands the following formatting sequences:
111
112 %% a literal %
113
114 %a the contents of the agent-addr field of the PDU (v1 TRAPs only)
115
116 %A the hostname corresponding to the contents of the agent-addr
117 field of the PDU, if available, otherwise the contents of the
118 agent-addr field of the PDU (v1 TRAPs only).
119
120 %b PDU source address (Note: this is not necessarily an IPv4
121 address)
122
123 %B PDU source hostname if available, otherwise PDU source address
124 (see note above)
125
126 %h current hour on the local system
127
128 %H the hour field from the sysUpTime.0 varbind
129
130 %j current minute on the local system
131
132 %J the minute field from the sysUpTime.0 varbind
133
134 %k current second on the local system
135
136 %K the seconds field from the sysUpTime.0 varbind
137
138 %l current day of month on the local system
139
140 %L the day of month field from the sysUpTime.0 varbind
141
142 %m current (numeric) month on the local system
143
144 %M the numeric month field from the sysUpTime.0 varbind
145
146 %N enterprise string
147
148 %q trap sub-type (numeric, in decimal)
149
150 %P security information from the PDU (community name for v1/v2c,
151 user and context for v3)
152
153 %t decimal number of seconds since the operating system epoch (as
154 returned by time(2))
155
156 %T the value of the sysUpTime.0 varbind in seconds
157
158 %v list of variable-bindings from the notification payload. These
159 will be separated by a tab, or by a comma and a blank if the
160 alternate form is requested See also %V
161
162 %V specifies the variable-bindings separator. This takes a
163 sequence of characters, up to the next % (to embed a % in the
164 string, use \%)
165
166 %w trap type (numeric, in decimal)
167
168 %W trap description
169
170 %y current year on the local system
171
172 %Y the year field from the sysUpTime.0 varbind
173
174 In addition to these values, an optional field width and precision may
175 also be specified , just as in printf(3), and a flag value. The follow‐
176 ing flags are supported:
177
178 - left justify
179
180 0 use leading zeros
181
182 # use alternate form
183
184 The "use alternate form" flag changes the behavior of various format
185 string sequences:
186
187 Time information will be displayed based on GMT (rather than the
188 local timezone)
189
190 The variable-bindings will be a comma-separated list (rather
191 than a tab-separated one)
192
193 The system uptime will be broken down into a human-meaningful
194 format (rather than being a simple integer)
195
196 Examples:
197 To get a message like "14:03 TRAP3.1 from humpty.ucd.edu" you could use
198 something like this:
199
200 snmptrapd -P -F "%02.2h:%02.2j TRAP%w.%q from %A\n"
201
202 If you want the same thing but in GMT rather than local time, use
203
204 snmptrapd -P -F "%#02.2h:%#02.2j TRAP%w.%q from %A\n"
205
207 By default, snmptrapd listens for incoming SNMP TRAP and INFORM packets
208 on UDP port 162 on all IPv4 interfaces. However, it is possible to
209 modify this behaviour by specifying one or more listening addresses as
210 arguments to snmptrapd. See the snmpd(8) manual page for more informa‐
211 tion about the format of listening addresses.
212
214 As of net-snmp 5.0, the snmptrapd application supports the NOTIFICA‐
215 TION-LOG-MIB. It does this by opening an AgentX subagent connection to
216 the master snmpd agent and registering the notification log tables. As
217 long as the snmpd application is started first, it will attach itself
218 to it and thus you should be able to view the last recorded notifica‐
219 tions via the nlmLogTable and nlmLogVariableTable. See the
220 snmptrapd.conf file and the "dontRetainLogs" token for turning off this
221 support. See the NOTIFICATION-LOG-MIB for more details about the MIB
222 itself.
223
225 See the snmptrapd.conf(5) manual page.
226
228 snmpcmd(1), snmpd(8), printf(3), snmptrapd.conf(5), syslog(8), vari‐
229 ables(5)
230
231
232
2334th Berkeley Distribution 15 Jan 2004 SNMPTRAPD(8)