5 collectd-snmp - Documentation of collectd's C<snmp plugin>
12 <Data "powerplus_voltge_input">
15 TypeInstance "input_line1"
17 Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1"
23 Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0"
28 TypeInstanceOID "IF-MIB::ifDescr"
29 #FilterOID "IF-MIB::ifOperStatus"
30 #FilterValues "1", "2"
31 Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
34 <Host "some.switch.mydomain.org">
37 Community "community_string"
43 <Host "some.server.mydomain.org">
44 Address "192.168.0.42"
46 Community "another_string"
47 Collect "std_traffic" "hr_users"
49 <Host "secure.router.mydomain.org">
50 Address "192.168.0.7:165"
52 SecurityLevel "authPriv"
55 AuthPassphrase "setec_astronomy"
57 PrivacyPassphrase "too_many_secrets"
60 <Host "some.ups.mydomain.org">
61 Address "tcp:192.168.0.3"
63 Community "more_communities"
64 Collect "powerplus_voltge_input"
73 The C<snmp plugin> queries other hosts using SNMP, the simple network
74 management protocol, and translates the value it receives to collectd's
75 internal format and dispatches them. Depending on the write plugins you have
76 loaded they may be written to disk or submitted to another instance or
77 whatever you configured.
79 Because querying a host via SNMP may produce a timeout the "complex reads"
80 polling method is used. The ReadThreads parameter in the main configuration
81 influences the number of parallel polling jobs which can be undertaken. If
82 you expect timeouts or some polling to take a long time, you should increase
83 this parameter. Note that other plugins also use the same threads.
87 Since the aim of the C<snmp plugin> is to provide a generic interface to SNMP,
88 its configuration is not trivial and may take some time.
90 Since the C<Net-SNMP> library is used you can use all the environment variables
91 that are interpreted by that package. See L<snmpcmd(1)> for more details.
93 There are two types of blocks that can be contained in the
94 C<E<lt>PluginE<nbsp>snmpE<gt>> block: B<Data> and B<Host>:
96 =head2 The B<Data> block
98 The B<Data> block defines a list of values or a table of values that are to be
99 queried. The following options can be set:
103 =item B<Type> I<type>
105 collectd's type that is to be used, e.E<nbsp>g. "if_octets" for interface
106 traffic or "users" for a user count. The types are read from the B<TypesDB>
107 (see L<collectd.conf(5)>), so you may want to check for which types are
108 defined. See L<types.db(5)> for a description of the format of this file.
110 =item B<Table> I<true|false>
112 Define if this is a single list of values or a table of values. The difference
115 When B<Table> is set to B<false>, the OIDs given to B<Values> (see below) are
116 queried using the C<GET> SNMP command (see L<snmpget(1)>) and transmitted to
117 collectd. B<One> value list is dispatched and, eventually, one file will be
120 When B<Table> is set to B<true>, the OIDs given to B<Values>, B<TypeInstanceOID>,
121 B<PluginInstanceOID>, B<HostOID> and B<FilterOID> (see below) are queried using
122 the C<GETNEXT> SNMP command until the subtree is left. After all
123 the lists (think: all columns of the table) have been read B<several> values
124 sets will be dispatches and, eventually, several files will be written. If you
125 configure a B<Type> (see above) which needs more than one data source (for
126 example C<if_octets> which needs C<rx> and C<tx>) you will need to specify more
127 than one (two, in the example case) OIDs with the B<Values> option. This has
128 nothing to do with the B<Table> setting.
130 For example, if you want to query the number of users on a system, you can use
131 C<HOST-RESOURCES-MIB::hrSystemNumUsers.0>. This is one value and belongs to one
132 value list, therefore B<Table> must be set to B<false>. Please note that, in
133 this case, you have to include the sequence number (zero in this case) in the
136 Counter example: If you want to query the interface table provided by the
137 C<IF-MIB>, e.E<nbsp>g. the bytes transmitted. There are potentially many
138 interfaces, so you will want to set B<Table> to B<true>. Because the
139 C<if_octets> type needs two values, received and transmitted bytes, you need to
140 specify two OIDs in the B<Values> setting, in this case likely
141 C<IF-MIB::ifHCInOctets> and C<IF-MIB::ifHCOutOctets>. But, this is because of
142 the B<Type> setting, not the B<Table> setting.
144 Since the semantic of B<Instance> and B<Values> depends on this setting you
145 need to set it before setting them. Doing vice versa will result in undefined
148 =item B<Plugin> I<Plugin>
150 Use I<Plugin> as the plugin name of the values that are dispatched.
153 =item B<PluginInstance> I<Instance>
155 Sets the plugin-instance of the values that are dispatched to I<Instance> value.
157 When B<Table> is set to I<true> and B<PluginInstanceOID> is set then this option
160 Defaults to an empty string.
162 =item B<TypeInstance> I<Instance>
164 Sets the type-instance of the values that are dispatched to I<Instance> value.
166 When B<Table> is set to I<true> and B<TypeInstanceOID> is set then this option
169 Defaults to an empty string.
171 =item B<TypeInstanceOID> I<OID>
173 =item B<PluginInstanceOID> I<OID>
175 =item B<HostOID> I<OID>
177 If B<Table> is set to I<true>, I<OID> is interpreted as an SNMP-prefix that will
178 return a list of values. Those values are then used as the actual type-instance,
179 plugin-instance or host of dispatched metrics. An example would be the
180 C<IF-MIB::ifDescr> subtree. L<variables(5)> from the SNMP distribution describes
181 the format of OIDs. When option is set to empty string, then "SUBID" will be used
184 Prefix may be set for values with use of appropriate B<TypeInstancePrefix>,
185 B<PluginInstancePrefix> and B<HostPrefix> options.
187 When B<Table> is set to I<false> these options has no effect.
189 Defaults: When no one of these options is configured explicitly,
190 B<TypeInstanceOID> defaults to an empty string.
192 =item B<TypeInstancePrefix>
194 =item B<PluginInstancePrefix>
198 These options are intented to be used together with B<TypeInstanceOID>,
199 B<PluginInstanceOID> and B<HostOID> respectively.
201 If set, I<String> is preprended to values received by querying the agent.
203 When B<Table> is set to I<false> these options has no effect.
205 The C<UPS-MIB> is an example where you need this setting: It has voltages of
206 the inlets, outlets and the battery of an UPS. However, it doesn't provide a
207 descriptive column for these voltages. In this case having 1, 2,E<nbsp>... as
208 instances is not enough, because the inlet voltages and outlet voltages may
209 both have the subids 1, 2,E<nbsp>... You can use this setting to distinguish
210 between the different voltages.
212 =item B<Instance> I<Instance>
214 Attention: this option exists for backwards compatibility only and will be
215 removed in next major release. Please use B<TypeInstance> / B<TypeInstanceOID>
218 The meaning of this setting depends on whether B<Table> is set to I<true> or
221 If B<Table> is set to I<true>, option behaves as B<TypeInstanceOID>.
222 If B<Table> is set to I<false>, option behaves as B<TypeInstance>.
224 Note what B<Table> option must be set before setting B<Instance>.
226 =item B<InstancePrefix> I<String>
228 Attention: this option exists for backwards compatibility only and will be
229 removed in next major release. Please use B<TypeInstancePrefix> instead.
231 =item B<Values> I<OID> [I<OID> ...]
233 Configures the values to be queried from the SNMP host. The meaning slightly
234 changes with the B<Table> setting. L<variables(5)> from the SNMP distribution
235 describes the format of OIDs.
237 If B<Table> is set to I<true>, each I<OID> must be the prefix of all the
238 values to query, e.E<nbsp>g. C<IF-MIB::ifInOctets> for all the counters of
239 incoming traffic. This subtree is walked (using C<GETNEXT>) until a value from
240 outside the subtree is returned.
242 If B<Table> is set to I<false>, each I<OID> must be the OID of exactly one
243 value, e.E<nbsp>g. C<IF-MIB::ifInOctets.3> for the third counter of incoming
246 =item B<Scale> I<Value>
248 The gauge-values returned by the SNMP-agent are multiplied by I<Value>. This
249 is useful when values are transferred as a fixed point real number. For example,
250 thermometers may transfer B<243> but actually mean B<24.3>, so you can specify
251 a scale value of B<0.1> to correct this. The default value is, of course,
254 This value is not applied to counter-values.
256 =item B<Shift> I<Value>
258 I<Value> is added to gauge-values returned by the SNMP-agent after they have
259 been multiplied by any B<Scale> value. If, for example, a thermometer returns
260 degrees Kelvin you could specify a shift of B<273.15> here to store values in
261 degrees Celsius. The default value is, of course, B<0.0>.
263 This value is not applied to counter-values.
265 =item B<Ignore> I<Value> [, I<Value> ...]
267 The ignore values allows one to ignore TypeInstances based on their name and
268 the patterns specified by the various values you've entered. The match is a
269 glob-type shell matching.
271 When B<Table> is set to I<false> then this option has no effect.
273 =item B<InvertMatch> I<true|false(default)>
275 The invertmatch value should be use in combination of the Ignore option.
276 It changes the behaviour of the Ignore option, from a blacklist behaviour
277 when InvertMatch is set to false, to a whitelist when specified to true.
279 =item B<FilterOID> I<OID>
281 =item B<FilterValues> I<Value> [, I<Value> ...]
283 =item B<FilterIgnoreSelected> I<true|false(default)>
285 When B<Table> is set to I<true>, these options allow to configure filtering
288 The B<FilterOID> declares I<OID> to fill table column with values.
289 The B<FilterValues> declares values list to do match. Whether table row will be
290 collected or ignored depends on the B<FilterIgnoreSelected> setting.
291 As with other plugins that use the daemon's ignorelist functionality, a string
292 that starts and ends with a slash is interpreted as a regular expression.
294 If no selection is configured at all, B<all> table rows are selected.
296 When B<Table> is set to I<false> then these options has no effect.
298 See B<Table> and F</"IGNORELISTS"> for details.
302 =head2 The Host block
304 The B<Host> block defines which hosts to query, which SNMP community and
305 version to use and which of the defined B<Data> to query.
307 The argument passed to the B<Host> block is used as the hostname in the data
312 =item B<Address> I<IP-Address>|I<Hostname>
314 Set the address to connect to. Address may include transport specifier and/or
317 =item B<Version> B<1>|B<2>|B<3>
319 Set the SNMP version to use. When giving B<2> version C<2c> is actually used.
321 =item B<Community> I<Community>
323 Pass I<Community> to the host. (Ignored for SNMPv3).
325 =item B<Username> I<Username>
327 Sets the I<Username> to use for SNMPv3 security.
329 =item B<SecurityLevel> I<authPriv>|I<authNoPriv>|I<noAuthNoPriv>
331 Selects the security level for SNMPv3 security.
333 =item B<Context> I<Context>
335 Sets the I<Context> for SNMPv3 security.
337 =item B<AuthProtocol> I<MD5>|I<SHA>
339 Selects the authentication protocol for SNMPv3 security.
341 =item B<AuthPassphrase> I<Passphrase>
343 Sets the authentication passphrase for SNMPv3 security.
345 =item B<PrivacyProtocol> I<AES>|I<DES>
347 Selects the privacy (encryption) protocol for SNMPv3 security.
349 =item B<PrivacyPassphrase> I<Passphrase>
351 Sets the privacy (encryption) passphrase for SNMPv3 security.
353 =item B<Collect> I<Data> [I<Data> ...]
355 Defines which values to collect. I<Data> refers to one of the B<Data> block
356 above. Since the config file is read top-down you need to define the data
357 before using it here.
359 =item B<Interval> I<Seconds>
361 Collect data from this host every I<Seconds> seconds. This option is meant for
362 devices with not much CPU power, e.E<nbsp>g. network equipment such as
363 switches, embedded devices, rack monitoring systems and so on. Since the
364 B<Step> of generated RRD files depends on this setting it's wise to select a
365 reasonable value once and never change it.
367 =item B<Timeout> I<Seconds>
369 How long to wait for a response. The C<Net-SNMP> library default is 1 second.
371 =item B<Retries> I<Integer>
373 The number of times that a query should be retried after the Timeout expires.
374 The C<Net-SNMP> library default is 5.
389 Florian Forster E<lt>octo@collectd.orgE<gt>
390 Michael Pilat E<lt>mike@mikepilat.comE<gt>