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