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