fix a couple of typos spotted by Debian's lintian tool
[collectd.git] / src / collectd-snmp.pod
1 =encoding UTF-8
2
3 =head1 NAME
4
5 collectd-snmp - Documentation of collectd's C<snmp plugin>
6
7 =head1 SYNOPSIS
8
9   LoadPlugin snmp
10   # ...
11   <Plugin snmp>
12     <Data "powerplus_voltge_input">
13       Type "voltage"
14       Table false
15       Instance "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       Type "users"
21       Table false
22       Instance ""
23       Shift -1
24       Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0"
25     </Data>
26     <Data "std_traffic">
27       Type "if_octets"
28       Table true
29       Instance "IF-MIB::ifDescr"
30       Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
31     </Data>
32
33     <Host "some.switch.mydomain.org">
34       Address "192.168.0.2"
35       Version 1
36       Community "community_string"
37       Collect "std_traffic"
38       Interval 120
39     </Host>
40     <Host "some.server.mydomain.org">
41       Address "192.168.0.42"
42       Version 2
43       Community "another_string"
44       Collect "std_traffic" "hr_users"
45     </Host>
46     <Host "secure.router.mydomain.org">
47       Address "192.168.0.7"
48       Version 3
49       SecurityLevel "authPriv"
50       Username "cosmo"
51       AuthProtocol "SHA"
52       AuthPassphrase "setec_astronomy"
53       PrivacyProtocol "AES"
54       PrivacyPassphrase "too_many_secrets"
55       Collect "std_traffic"
56     </Host>
57     <Host "some.ups.mydomain.org">
58       Address "192.168.0.3"
59       Version 1
60       Community "more_communities"
61       Collect "powerplus_voltge_input"
62       Interval 300
63     </Host>
64   </Plugin>
65
66 =head1 DESCRIPTION
67
68 The C<snmp plugin> queries other hosts using SNMP, the simple network
69 management protocol, and translates the value it receives to collectd's
70 internal format and dispatches them. Depending on the write plugins you have
71 loaded they may be written to disk or submitted to another instance or
72 whatever you configured.
73
74 Because querying a host via SNMP may produce a timeout multiple threads are
75 used to query hosts in parallel. Depending on the number of hosts between one
76 and ten threads are used.
77
78 =head1 CONFIGURATION
79
80 Since the aim of the C<snmp plugin> is to provide a generic interface to SNMP,
81 it's configuration is not trivial and may take some time.
82
83 Since the C<Net-SNMP> library is used you can use all the environment variables
84 that are interpreted by that package. See L<snmpcmd(1)> for more details.
85
86 There are two types of blocks that can be contained in the
87 C<E<lt>PluginE<nbsp>snmpE<gt>> block: B<Data> and B<Host>:
88
89 =head2 The B<Data> block
90
91 The B<Data> block defines a list of values or a table of values that are to be
92 queried. The following options can be set:
93
94 =over 4
95
96 =item B<Type> I<type>
97
98 collectd's type that is to be used, e.E<nbsp>g. "if_octets" for interface
99 traffic or "users" for a user count. The types are read from the B<TypesDB>
100 (see L<collectd.conf(5)>), so you may want to check for which types are
101 defined. See L<types.db(5)> for a description of the format of this file.
102
103 =item B<Table> I<true|false>
104
105 Define if this is a single list of values or a table of values. The difference
106 is the following:
107
108 When B<Table> is set to B<false>, the OIDs given to B<Values> (see below) are
109 queried using the C<GET> SNMP command (see L<snmpget(1)>) and transmitted to
110 collectd. B<One> value list is dispatched and, eventually, one file will be
111 written.
112
113 When B<Table> is set to B<true>, the OIDs given to B<Values> (see below) are
114 queried using the C<GETNEXT> SNMP command until the subtree is left. After all
115 the lists (think: all columns of the table) have been read B<several> values
116 sets will be dispatches and, eventually, several files will be written. If you
117 configure a B<Type> (see above) which needs more than one data source (for
118 example C<if_octets> which needs C<rx> and C<tx>) you will need to specify more
119 than one (two, in the example case) OIDs with the B<Values> option. This has
120 nothing to do with the B<Table> setting.
121
122 For example, if you want to query the number of users on a system, you can use
123 C<HOST-RESOURCES-MIB::hrSystemNumUsers.0>. This is one value and belongs to one
124 value list, therefore B<Table> must be set to B<false>. Please note that, in
125 this case, you have to include the sequence number (zero in this case) in the
126 OID.
127
128 Counter example: If you want to query the interface table provided by the
129 C<IF-MIB>, e.E<nbsp>g. the bytes transmitted. There are potentially many
130 interfaces, so you will want to set B<Table> to B<true>. Because the
131 C<if_octets> type needs two values, received and transmitted bytes, you need to
132 specify two OIDs in the B<Values> setting, in this case likely
133 C<IF-MIB::ifHCInOctets> and C<IF-MIB::ifHCOutOctets>. But, this is because of
134 the B<Type> setting, not the B<Table> setting.
135
136 Since the semantic of B<Instance> and B<Values> depends on this setting you
137 need to set it before setting them. Doing vice verse will result in undefined
138 behavior.
139
140 =item B<Instance> I<Instance>
141
142 Sets the type-instance of the values that are dispatched. The meaning of this
143 setting depends on whether B<Table> is set to I<true> or I<false>:
144
145 If B<Table> is set to I<true>, I<Instance> is interpreted as an SNMP-prefix
146 that will return a list of values. Those values are then used as the actual
147 type-instance. An example would be the C<IF-MIB::ifDescr> subtree.
148 L<variables(5)> from the SNMP distribution describes the format of OIDs.
149
150 If B<Table> is set to I<true> and B<Instance> is omitted, then "SUBID" will be
151 used as the instance.
152
153 If B<Table> is set to I<false> the actual string configured for I<Instance> is
154 copied into the value-list. In this case I<Instance> may be empty, i.E<nbsp>e.
155 "".
156
157 =item B<InstancePrefix> I<String>
158
159 If B<Table> is set to I<true>, you may feel the need to add something to the
160 instance of the files. If set, I<String> is prepended to the instance as
161 determined by querying the agent. When B<Table> is set to I<false> this option
162 has no effect.
163
164 The C<UPS-MIB> is an example where you need this setting: It has voltages of
165 the inlets, outlets and the battery of an UPS. However, it doesn't provide a
166 descriptive column for these voltages. In this case having 1, 2,E<nbsp>... as
167 instances is not enough, because the inlet voltages and outlet voltages may
168 both have the subids 1, 2,E<nbsp>... You can use this setting to distinguish
169 between the different voltages.
170
171 =item B<Values> I<OID> [I<OID> ...]
172
173 Configures the values to be queried from the SNMP host. The meaning slightly
174 changes with the B<Table> setting. L<variables(5)> from the SNMP distribution
175 describes the format of OIDs.
176
177 If B<Table> is set to I<true>, each I<OID> must be the prefix of all the
178 values to query, e.E<nbsp>g. C<IF-MIB::ifInOctets> for all the counters of
179 incoming traffic. This subtree is walked (using C<GETNEXT>) until a value from
180 outside the subtree is returned.
181
182 If B<Table> is set to I<false>, each I<OID> must be the OID of exactly one
183 value, e.E<nbsp>g. C<IF-MIB::ifInOctets.3> for the third counter of incoming
184 traffic.
185
186 =item B<Scale> I<Value>
187
188 The gauge-values returned by the SNMP-agent are multiplied by I<Value>.  This
189 is useful when values are transferred as a fixed point real number. For example,
190 thermometers may transfer B<243> but actually mean B<24.3>, so you can specify
191 a scale value of B<0.1> to correct this. The default value is, of course,
192 B<1.0>.
193
194 This value is not applied to counter-values.
195
196 =item B<Shift> I<Value>
197
198 I<Value> is added to gauge-values returned by the SNMP-agent after they have
199 been multiplied by any B<Scale> value. If, for example, a thermometer returns
200 degrees Kelvin you could specify a shift of B<273.15> here to store values in
201 degrees Celsius. The default value is, of course, B<0.0>.
202
203 This value is not applied to counter-values.
204
205 =item B<Ignore> I<Value> [, I<Value> ...]
206
207 The ignore values allows one to ignore Instances based on their name and the
208 patterns specified by the various values you've entered. The match is a
209 glob-type shell matching.
210
211 =item B<InvertMatch> I<true|false(default)>
212
213 The invertmatch value should be use in combination of the Ignore option.
214 It changes the behaviour of the Ignore option, from a blacklist behaviour
215 when InvertMatch is set to false, to a whitelist when specified to true.
216
217 =back
218
219 =head2 The Host block
220
221 The B<Host> block defines which hosts to query, which SNMP community and
222 version to use and which of the defined B<Data> to query.
223
224 The argument passed to the B<Host> block is used as the hostname in the data
225 stored by collectd.
226
227 =over 4
228
229 =item B<Address> I<IP-Address>|I<Hostname>
230
231 Set the address to connect to.
232
233 =item B<Version> B<1>|B<2>|B<3>
234
235 Set the SNMP version to use. When giving B<2> version C<2c> is actually used.
236
237 =item B<Community> I<Community>
238
239 Pass I<Community> to the host. (Ignored for SNMPv3).
240
241 =item B<Username> I<Username>
242
243 Sets the I<Username> to use for SNMPv3 security.
244
245 =item B<SecurityLevel> I<authPriv>|I<authNoPriv>|I<noAuthNoPriv>
246
247 Selects the security level for SNMPv3 security.
248
249 =item B<Context> I<Context>
250
251 Sets the I<Context> for SNMPv3 security.
252
253 =item B<AuthProtocol> I<MD5>|I<SHA>
254
255 Selects the authentication protocol for SNMPv3 security.
256
257 =item B<AuthPassphrase> I<Passphrase>
258
259 Sets the authentication passphrase for SNMPv3 security. 
260
261 =item B<PrivacyProtocol> I<AES>|I<DES>
262
263 Selects the privacy (encryption) protocol for SNMPv3 security.
264
265 =item B<PrivacyPassphrase> I<Passphrase>
266
267 Sets the privacy (encryption) passphrase for SNMPv3 security. 
268
269 =item B<Collect> I<Data> [I<Data> ...]
270
271 Defines which values to collect. I<Data> refers to one of the B<Data> block
272 above. Since the config file is read top-down you need to define the data
273 before using it here.
274
275 =item B<Interval> I<Seconds>
276
277 Collect data from this host every I<Seconds> seconds. This option is meant for
278 devices with not much CPU power, e.E<nbsp>g. network equipment such as
279 switches, embedded devices, rack monitoring systems and so on. Since the
280 B<Step> of generated RRD files depends on this setting it's wise to select a
281 reasonable value once and never change it.
282
283 =back
284
285 =head1 SEE ALSO
286
287 L<collectd(1)>,
288 L<collectd.conf(5)>,
289 L<snmpget(1)>,
290 L<snmpgetnext(1)>,
291 L<variables(5)>,
292 L<unix(7)>
293
294 =head1 AUTHORS
295
296 Florian Forster E<lt>octo@collectd.orgE<gt>
297 Michael Pilat E<lt>mike@mikepilat.comE<gt>
298
299 =cut