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 --name="value"
101 Allows one to specify any token ("name") supported in the
102 snmptrapd.conf file and sets its value to "value". Overrides
103 the corresponding token in the snmptrapd.conf file. See
104 snmptrapd.conf(5) for the full list of tokens.
105
107 snmptrapd interprets format strings similarly to printf(3). It under‐
108 stands the following formatting sequences:
109
110 %% a literal %
111
112 %a the contents of the agent-addr field of the PDU (v1 TRAPs only)
113
114 %A the hostname corresponding to the contents of the agent-addr
115 field of the PDU, if available, otherwise the contents of the
116 agent-addr field of the PDU (v1 TRAPs only).
117
118 %b PDU source address (Note: this is not necessarily an IPv4
119 address)
120
121 %B PDU source hostname if available, otherwise PDU source address
122 (see note above)
123
124 %h current hour on the local system
125
126 %H the hour field from the sysUpTime.0 varbind
127
128 %j current minute on the local system
129
130 %J the minute field from the sysUpTime.0 varbind
131
132 %k current second on the local system
133
134 %K the seconds field from the sysUpTime.0 varbind
135
136 %l current day of month on the local system
137
138 %L the day of month field from the sysUpTime.0 varbind
139
140 %m current (numeric) month on the local system
141
142 %M the numeric month field from the sysUpTime.0 varbind
143
144 %N enterprise string
145
146 %q trap sub-type (numeric, in decimal)
147
148 %P security information from the PDU (community name for v1/v2c,
149 user and context for v3)
150
151 %t decimal number of seconds since the operating system epoch (as
152 returned by time(2))
153
154 %T the value of the sysUpTime.0 varbind in seconds
155
156 %v list of variable-bindings from the notification payload. These
157 will be separated by a tab, or by a comma and a blank if the
158 alternate form is requested See also %V
159
160 %V specifies the variable-bindings separator. This takes a
161 sequence of characters, up to the next % (to embed a % in the
162 string, use \%)
163
164 %w trap type (numeric, in decimal)
165
166 %W trap description
167
168 %y current year on the local system
169
170 %Y the year field from the sysUpTime.0 varbind
171
172 In addition to these values, an optional field width and precision may
173 also be specified , just as in printf(3), and a flag value. The follow‐
174 ing flags are supported:
175
176 - left justify
177
178 0 use leading zeros
179
180 # use alternate form
181
182 The "use alternate form" flag changes the behavior of various format
183 string sequences:
184
185 Time information will be displayed based on GMT (rather than the
186 local timezone)
187
188 The variable-bindings will be a comma-separated list (rather
189 than a tab-separated one)
190
191 The system uptime will be broken down into a human-meaningful
192 format (rather than being a simple integer)
193
194 Examples:
195 To get a message like "14:03 TRAP3.1 from humpty.ucd.edu" you could use
196 something like this:
197
198 snmptrapd -P -F "%02.2h:%02.2j TRAP%w.%q from %A\n"
199
200 If you want the same thing but in GMT rather than local time, use
201
202 snmptrapd -P -F "%#02.2h:%#02.2j TRAP%w.%q from %A\n"
203
205 By default, snmptrapd listens for incoming SNMP TRAP and INFORM packets
206 on UDP port 162 on all IPv4 interfaces. However, it is possible to
207 modify this behaviour by specifying one or more listening addresses as
208 arguments to snmptrapd. See the snmpd(8) manual page for more informa‐
209 tion about the format of listening addresses.
210
212 As of net-snmp 5.0, the snmptrapd application supports the NOTIFICA‐
213 TION-LOG-MIB. It does this by opening an AgentX subagent connection to
214 the master snmpd agent and registering the notification log tables. As
215 long as the snmpd application is started first, it will attach itself
216 to it and thus you should be able to view the last recorded notifica‐
217 tions via the nlmLogTable and nlmLogVariableTable. See the
218 snmptrapd.conf file and the "doNotRetainNotificationLogs" token for
219 turning off this support. See the NOTIFICATION-LOG-MIB for more
220 details about the MIB itself.
221
223 See the snmptrapd.conf(5) manual page.
224
226 snmpcmd(1), snmpd(8), printf(3), snmptrapd.conf(5), syslog(8), vari‐
227 ables(5)
228
229
230
231V5.7.2 30 Mar 2011 SNMPTRAPD(8)