Code

Merge branch 'collectd-4.1'
[collectd.git] / src / collectd-snmp.pod
1 =head1 NAME
3 collectd-snmp - Documentation of collectd's C<snmp plugin>
5 =head1 SYNOPSIS
7   LoadPlugin snmp
8   # ...
9   <Plugin snmp>
10     <Data "powerplus_voltge_input">
11       Type "voltage"
12       Table false
13       Instance "input_line1"
14       Scale 0.1
15       Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1"
16     </Data>
17     <Data "hr_users">
18       Type "users"
19       Table false
20       Instance ""
21       Shift -1
22       Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0"
23     </Data>
24     <Data "std_traffic">
25       Type "if_octets"
26       Table true
27       Instance "IF-MIB::ifDescr"
28       Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
29     </Data>
31     <Host "some.switch.mydomain.org">
32       Address "192.168.0.2"
33       Version 1
34       Community "community_string"
35       Collect "std_traffic"
36       Inverval 120
37     </Host>
38     <Host "some.server.mydomain.org">
39       Address "192.168.0.42"
40       Version 2
41       Community "another_string"
42       Collect "std_traffic" "hr_users"
43     </Host>
44     <Host "some.ups.mydomain.org">
45       Address "192.168.0.3"
46       Version 1
47       Community "more_communities"
48       Collect "powerplus_voltge_input"
49       Interval 300
50     </Host>
51   </Plugin>
53 =head1 DESCRIPTION
55 The C<snmp plugin> queries other hosts using SNMP, the simple network
56 management protocol, and translates the value it receives to collectd's
57 internal format and dispatches them. Depending on the write plugins you have
58 loaded they may be written to disk or submitted to another instance or
59 whatever you configured.
61 Because querying a host via SNMP may produce a timeout multiple threads are
62 used to query hosts in parallel. Depending on the number of hosts between one
63 and ten threads are used.
65 =head1 CONFIGURATION
67 Since the aim of the C<snmp plugin> is to provide a generic interface to SNMP,
68 it's configuration is not trivial and may take some time.
70 There are two types of blocks that can be contained in the
71 C<E<lt>PluginE<nbsp>snmpE<gt>> block: B<Data> and B<Host>:
73 =head2 The B<Data> block
75 The B<Data> block defines a list of values or a table of values that are to be
76 queried. The following options can be set:
78 =over 4
80 =item B<Type> I<type>
82 collectd's type that is to be used, e.E<nbsp>g. "if_octets" for interface
83 traffic or "users" for a user count. The types are read from the B<TypesDB>
84 (see L<collectd.conf(5)>), so you may want to check for which types are
85 defined.
87 =item B<Table> I<true|false>
89 Define if this is a single list of values or a table of values. The difference
90 is the following:
92 When B<Table> is set to B<false>, the OIDs given to B<Values> (see below) are
93 queried using the C<GET> SNMP command (see L<snmpget(1)>) and transmitted to
94 collectd. B<One> value list is dispatched and, eventually, one file will be
95 written.
97 When B<Table> is set to B<true>, the OIDs given to B<Values> (see below) are
98 queried using the C<GETNEXT> SNMP command until the subtree is left. After all
99 the lists (think: all columns of the table) have been read B<several> values
100 sets will be dispatches and, eventually, several files will be written. If you
101 configure a B<Type> (see above) which needs more than one data source (for
102 example C<if_octets> which needs C<rx> and C<tx>) you will need to specify more
103 than one (two, in the example case) OIDs with the B<Values> option. This has
104 nothing to do with the B<Table> setting.
106 For example, if you want to query the number of users on a system, you can use
107 C<HOST-RESOURCES-MIB::hrSystemNumUsers.0>. This is one value and belongs to one
108 value list, therefore B<Table> must be set to B<false>. Please note that, in
109 this case, you have to include the sequence number (zero in this case) in the
110 OID.
112 Counter example: If you want to query the interface table provided by the
113 C<IF-MIB>, e.E<nbsp>g. the bytes transmitted. There are potentially many
114 interfaces, so you will want to set B<Table> to B<true>. Because the
115 C<if_octets> type needs two values, received and transmitted bytes, you need to
116 specify two OIDs in the B<Values> setting, in this case likely
117 C<IF-MIB::ifHCInOctets> and C<IF-MIB::ifHCOutOctets>. But, this is because of
118 the B<Type> setting, not the B<Table> setting.
120 Since the semantic of B<Instance> and B<Values> depends on this setting you
121 need to set it before setting them. Doing vice verse will result in undefined
122 behavior.
124 =item B<Instance> I<Instance>
126 Sets the type-instance of the values that are dispatched. The meaning of this
127 setting depends on whether B<Table> is set to I<true> or I<false>:
129 If B<Table> is set to I<true>, I<Instance> is interpreted as an SNMP-prefix
130 that will return a list of strings. Those strings are then used as the actual
131 type-instance. An example would be the C<IF-MIB::ifDescr> subtree.
132 L<variables(5)> from the SNMP distribution describes the format of OIDs.
134 If B<Table> is set to I<false> the actual string configured for I<Instance> is
135 copied into the value-list. In this case I<Instance> may be empty, i.E<nbsp>e.
136 "".
138 =item B<Values> I<OID> [I<OID> ...]
140 Configures the values to be queried from the SNMP host. The meaning slightly
141 changes with the B<Table> setting. L<variables(5)> from the SNMP distribution
142 describes the format of OIDs.
144 If B<Table> is set to I<true>, each I<OID> must be the prefix of all the
145 values to query, e.E<nbsp>g. C<IF-MIB::ifInOctets> for all the counters of
146 incoming traffic. This subtree is walked (using C<GETNEXT>) until a value from
147 outside the subtree is returned.
149 If B<Table> is set to I<false>, each I<OID> must be the OID of exactly one
150 value, e.E<nbsp>g. C<IF-MIB::ifInOctets.3> for the third counter of incoming
151 traffic.
153 =item B<Scale> I<Value>
155 The gauge-values returned by the SNMP-agent are multiplied by I<Value>.  This
156 is useful when values are transfered as a fixed point real number. For example,
157 thermometers may transfer B<243> but actually mean B<24.3>, so you can specify
158 a scale value of B<0.1> to correct this. The default value is of course B<1.0>.
160 This value is not applied to counter-values.
162 =item B<Shift> I<Value>
164 I<Value> is added to gauge-values returned by the SNMP-agent after they have
165 been multiplied by any B<Scale> value. If, for example, a thermometer returns
166 degrees Kelvin you could specify a shift of B<273.15> here to store values in
167 degrees Celsius. The default value is is course B<0.0>.
169 This value is not applied to counter-values.
171 =back
173 =head2 The Host block
175 The B<Host> block defines which hosts to query, which SNMP community and
176 version to use and which of the defined B<Data> to query.
178 The argument passed to the B<Host> block is used as the hostname in the data
179 stored by collectd.
181 =over 4
183 =item B<Address> I<IP-Address>|I<Hostname>
185 Set the address to connect to.
187 =item B<Version> B<1>|B<2>
189 Set the SNMP version to use. When giving B<2> version 2c is actually used.
190 Version 3 is not supported by this plugin.
192 =item B<Community> I<Community>
194 Pass I<Community> to the host.
196 =item B<Collect> I<Data> [I<Data> ...]
198 Defines which values to collect. I<Data> refers to one of the B<Data> block
199 above. Since the config file is read top-down you need to define the data
200 before using it here.
202 =item B<Interval> I<Seconds>
204 Collect data from this host every I<Seconds> seconds. This value needs to be a
205 multiple of the global B<Interval> setting and, if it is not, will be rounded
206 B<down> to one and a warning is logged in this case. So if your global
207 B<Interval> is set to I<10> and you configure I<25> here, it's rounded down to
208 I<20>. By default the global B<Interval> setting will be used.
210 This option is meant for devices with not much CPU power, e.E<nbsp>g. network
211 equipment such as switches, embedded devices, rack monitoring systems and so
212 on. Since the B<Step> of generated RRD files depends on this setting it's
213 wise to select a reasonable value once and never change it.
215 =back
217 =head1 SEE ALSO
219 L<collectd(1)>,
220 L<collectd.conf(5)>,
221 L<snmpget(1)>,
222 L<snmpgetnext(1)>,
223 L<variables(5)>,
224 L<unix(7)>
226 =head1 AUTHOR
228 Florian Forster E<lt>octo@verplant.orgE<gt>
230 =cut