1COLLECTD-SNMP(5) collectd COLLECTD-SNMP(5)
2
3
4
6 collectd-snmp - Documentation of collectd's "snmp plugin"
7
9 LoadPlugin snmp
10 # ...
11 <Plugin snmp>
12 <Data "powerplus_voltge_input">
13 Table false
14 Type "voltage"
15 TypeInstance "input_line1"
16 Scale 0.1
17 Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1"
18 </Data>
19 <Data "hr_users">
20 Table false
21 Type "users"
22 Shift -1
23 Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0"
24 </Data>
25 <Data "std_traffic">
26 Table true
27 Type "if_octets"
28 TypeInstanceOID "IF-MIB::ifDescr"
29 #FilterOID "IF-MIB::ifOperStatus"
30 #FilterValues "1", "2"
31 Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
32 </Data>
33
34 <Host "some.switch.mydomain.org">
35 Address "192.168.0.2"
36 Version 1
37 Community "community_string"
38 Collect "std_traffic"
39 Interval 120
40 Timeout 10
41 Retries 1
42 </Host>
43 <Host "some.server.mydomain.org">
44 Address "192.168.0.42"
45 Version 2
46 Community "another_string"
47 Collect "std_traffic" "hr_users"
48 </Host>
49 <Host "secure.router.mydomain.org">
50 Address "192.168.0.7:165"
51 Version 3
52 SecurityLevel "authPriv"
53 Username "cosmo"
54 AuthProtocol "SHA"
55 AuthPassphrase "setec_astronomy"
56 PrivacyProtocol "AES"
57 PrivacyPassphrase "too_many_secrets"
58 Collect "std_traffic"
59 </Host>
60 <Host "some.ups.mydomain.org">
61 Address "tcp:192.168.0.3"
62 Version 1
63 Community "more_communities"
64 Collect "powerplus_voltge_input"
65 Interval 300
66 Timeout 5
67 Retries 5
68 </Host>
69 </Plugin>
70
72 The "snmp plugin" queries other hosts using SNMP, the simple network
73 management protocol, and translates the value it receives to collectd's
74 internal format and dispatches them. Depending on the write plugins you
75 have loaded they may be written to disk or submitted to another
76 instance or whatever you configured.
77
78 Because querying a host via SNMP may produce a timeout the "complex
79 reads" polling method is used. The ReadThreads parameter in the main
80 configuration influences the number of parallel polling jobs which can
81 be undertaken. If you expect timeouts or some polling to take a long
82 time, you should increase this parameter. Note that other plugins also
83 use the same threads.
84
86 Since the aim of the "snmp plugin" is to provide a generic interface to
87 SNMP, its configuration is not trivial and may take some time.
88
89 Since the "Net-SNMP" library is used you can use all the environment
90 variables that are interpreted by that package. See snmpcmd(1) for more
91 details.
92
93 There are two types of blocks that can be contained in the
94 "<Plugin snmp>" block: Data and Host:
95
96 The Data block
97 The Data block defines a list of values or a table of values that are
98 to be queried. The following options can be set:
99
100 Type type
101 collectd's type that is to be used, e. g. "if_octets" for interface
102 traffic or "users" for a user count. The types are read from the
103 TypesDB (see collectd.conf(5)), so you may want to check for which
104 types are defined. See types.db(5) for a description of the format
105 of this file.
106
107 Table true|false
108 Define if this is a single list of values or a table of values. The
109 difference is the following:
110
111 When Table is set to false, the OIDs given to Values (see below)
112 are queried using the "GET" SNMP command (see snmpget(1)) and
113 transmitted to collectd. One value list is dispatched and,
114 eventually, one file will be written.
115
116 When Table is set to true, the OIDs given to Values,
117 TypeInstanceOID, PluginInstanceOID, HostOID and FilterOID (see
118 below) are queried using the "GETNEXT" SNMP command until the
119 subtree is left. After all the lists (think: all columns of the
120 table) have been read several values sets will be dispatches and,
121 eventually, several files will be written. If you configure a Type
122 (see above) which needs more than one data source (for example
123 "if_octets" which needs "rx" and "tx") you will need to specify
124 more than one (two, in the example case) OIDs with the Values
125 option. This has nothing to do with the Table setting.
126
127 For example, if you want to query the number of users on a system,
128 you can use "HOST-RESOURCES-MIB::hrSystemNumUsers.0". This is one
129 value and belongs to one value list, therefore Table must be set to
130 false. Please note that, in this case, you have to include the
131 sequence number (zero in this case) in the OID.
132
133 Counter example: If you want to query the interface table provided
134 by the "IF-MIB", e. g. the bytes transmitted. There are potentially
135 many interfaces, so you will want to set Table to true. Because the
136 "if_octets" type needs two values, received and transmitted bytes,
137 you need to specify two OIDs in the Values setting, in this case
138 likely "IF-MIB::ifHCInOctets" and "IF-MIB::ifHCOutOctets". But,
139 this is because of the Type setting, not the Table setting.
140
141 Since the semantic of Instance and Values depends on this setting
142 you need to set it before setting them. Doing vice versa will
143 result in undefined behavior.
144
145 Plugin Plugin
146 Use Plugin as the plugin name of the values that are dispatched.
147 Defaults to "snmp".
148
149 PluginInstance Instance
150 Sets the plugin-instance of the values that are dispatched to
151 Instance value.
152
153 When Table is set to true and PluginInstanceOID is set then this
154 option has no effect.
155
156 Defaults to an empty string.
157
158 TypeInstance Instance
159 Sets the type-instance of the values that are dispatched to
160 Instance value.
161
162 When Table is set to true and TypeInstanceOID is set then this
163 option has no effect.
164
165 Defaults to an empty string.
166
167 TypeInstanceOID OID
168 PluginInstanceOID OID
169 HostOID OID
170 If Table is set to true, OID is interpreted as an SNMP-prefix that
171 will return a list of values. Those values are then used as the
172 actual type-instance, plugin-instance or host of dispatched
173 metrics. An example would be the "IF-MIB::ifDescr" subtree.
174 variables(5) from the SNMP distribution describes the format of
175 OIDs. When option is set to empty string, then "SUBID" will be used
176 as the value.
177
178 Prefix may be set for values with use of appropriate
179 TypeInstancePrefix, PluginInstancePrefix and HostPrefix options.
180
181 When Table is set to false these options has no effect.
182
183 Defaults: When no one of these options is configured explicitly,
184 TypeInstanceOID defaults to an empty string.
185
186 TypeInstancePrefix
187 PluginInstancePrefix
188 HostPrefix
189 These options are intented to be used together with
190 TypeInstanceOID, PluginInstanceOID and HostOID respectively.
191
192 If set, String is preprended to values received by querying the
193 agent.
194
195 When Table is set to false these options has no effect.
196
197 The "UPS-MIB" is an example where you need this setting: It has
198 voltages of the inlets, outlets and the battery of an UPS. However,
199 it doesn't provide a descriptive column for these voltages. In this
200 case having 1, 2, ... as instances is not enough, because the inlet
201 voltages and outlet voltages may both have the subids 1, 2, ... You
202 can use this setting to distinguish between the different voltages.
203
204 Instance Instance
205 Attention: this option exists for backwards compatibility only and
206 will be removed in next major release. Please use TypeInstance /
207 TypeInstanceOID instead.
208
209 The meaning of this setting depends on whether Table is set to true
210 or false.
211
212 If Table is set to true, option behaves as TypeInstanceOID. If
213 Table is set to false, option behaves as TypeInstance.
214
215 Note what Table option must be set before setting Instance.
216
217 InstancePrefix String
218 Attention: this option exists for backwards compatibility only and
219 will be removed in next major release. Please use
220 TypeInstancePrefix instead.
221
222 Values OID [OID ...]
223 Configures the values to be queried from the SNMP host. The meaning
224 slightly changes with the Table setting. variables(5) from the SNMP
225 distribution describes the format of OIDs.
226
227 If Table is set to true, each OID must be the prefix of all the
228 values to query, e. g. "IF-MIB::ifInOctets" for all the counters of
229 incoming traffic. This subtree is walked (using "GETNEXT") until a
230 value from outside the subtree is returned.
231
232 If Table is set to false, each OID must be the OID of exactly one
233 value, e. g. "IF-MIB::ifInOctets.3" for the third counter of
234 incoming traffic.
235
236 Scale Value
237 The gauge-values returned by the SNMP-agent are multiplied by
238 Value. This is useful when values are transferred as a fixed point
239 real number. For example, thermometers may transfer 243 but
240 actually mean 24.3, so you can specify a scale value of 0.1 to
241 correct this. The default value is, of course, 1.0.
242
243 This value is not applied to counter-values.
244
245 Shift Value
246 Value is added to gauge-values returned by the SNMP-agent after
247 they have been multiplied by any Scale value. If, for example, a
248 thermometer returns degrees Kelvin you could specify a shift of
249 273.15 here to store values in degrees Celsius. The default value
250 is, of course, 0.0.
251
252 This value is not applied to counter-values.
253
254 Ignore Value [, Value ...]
255 The ignore values allows one to ignore TypeInstances based on their
256 name and the patterns specified by the various values you've
257 entered. The match is a glob-type shell matching.
258
259 When Table is set to false then this option has no effect.
260
261 InvertMatch true|false(default)
262 The invertmatch value should be use in combination of the Ignore
263 option. It changes the behaviour of the Ignore option, from a
264 blacklist behaviour when InvertMatch is set to false, to a
265 whitelist when specified to true.
266
267 FilterOID OID
268 FilterValues Value [, Value ...]
269 FilterIgnoreSelected true|false(default)
270 When Table is set to true, these options allow to configure
271 filtering based on MIB values.
272
273 The FilterOID declares OID to fill table column with values. The
274 FilterValues declares values list to do match. Whether table row
275 will be collected or ignored depends on the FilterIgnoreSelected
276 setting. As with other plugins that use the daemon's ignorelist
277 functionality, a string that starts and ends with a slash is
278 interpreted as a regular expression.
279
280 If no selection is configured at all, all table rows are selected.
281
282 When Table is set to false then these options has no effect.
283
284 See Table and /"IGNORELISTS" for details.
285
286 The Host block
287 The Host block defines which hosts to query, which SNMP community and
288 version to use and which of the defined Data to query.
289
290 The argument passed to the Host block is used as the hostname in the
291 data stored by collectd.
292
293 Address IP-Address|Hostname
294 Set the address to connect to. Address may include transport
295 specifier and/or port number.
296
297 Version 1|2|3
298 Set the SNMP version to use. When giving 2 version "2c" is actually
299 used.
300
301 Community Community
302 Pass Community to the host. (Ignored for SNMPv3).
303
304 Username Username
305 Sets the Username to use for SNMPv3 security.
306
307 SecurityLevel authPriv|authNoPriv|noAuthNoPriv
308 Selects the security level for SNMPv3 security.
309
310 Context Context
311 Sets the Context for SNMPv3 security.
312
313 AuthProtocol MD5|SHA
314 Selects the authentication protocol for SNMPv3 security.
315
316 AuthPassphrase Passphrase
317 Sets the authentication passphrase for SNMPv3 security.
318
319 PrivacyProtocol AES|DES
320 Selects the privacy (encryption) protocol for SNMPv3 security.
321
322 PrivacyPassphrase Passphrase
323 Sets the privacy (encryption) passphrase for SNMPv3 security.
324
325 Collect Data [Data ...]
326 Defines which values to collect. Data refers to one of the Data
327 block above. Since the config file is read top-down you need to
328 define the data before using it here.
329
330 Interval Seconds
331 Collect data from this host every Seconds seconds. This option is
332 meant for devices with not much CPU power, e. g. network equipment
333 such as switches, embedded devices, rack monitoring systems and so
334 on. Since the Step of generated RRD files depends on this setting
335 it's wise to select a reasonable value once and never change it.
336
337 Timeout Seconds
338 How long to wait for a response. The "Net-SNMP" library default is
339 1 second.
340
341 Retries Integer
342 The number of times that a query should be retried after the
343 Timeout expires. The "Net-SNMP" library default is 5.
344
345 BulkSize Integer
346 Configures the size of SNMP bulk transfers. The default is 0, which
347 disables bulk transfers altogether.
348
350 collectd(1), collectd.conf(5), snmpget(1), snmpgetnext(1),
351 variables(5), unix(7)
352
354 Florian Forster <octo@collectd.org> Michael Pilat <mike@mikepilat.com>
355
356
357
3585.9.1.599.gbb5cfbc 2020-03-08 COLLECTD-SNMP(5)