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 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 "some.ups.mydomain.org">
47 Address "192.168.0.3"
48 Version 1
49 Community "more_communities"
50 Collect "powerplus_voltge_input"
51 Interval 300
52 </Host>
53 </Plugin>
54
56 The "snmp plugin" queries other hosts using SNMP, the simple network
57 management protocol, and translates the value it receives to collectd's
58 internal format and dispatches them. Depending on the write plugins you
59 have loaded they may be written to disk or submitted to another
60 instance or whatever you configured.
61
62 Because querying a host via SNMP may produce a timeout multiple threads
63 are used to query hosts in parallel. Depending on the number of hosts
64 between one and ten threads are used.
65
67 Since the aim of the "snmp plugin" is to provide a generic interface to
68 SNMP, it's configuration is not trivial and may take some time.
69
70 Since the "Net-SNMP" library is used you can use all the environment
71 variables that are interpreted by that package. See snmpcmd(1) for more
72 details.
73
74 There are two types of blocks that can be contained in the
75 "<Plugin snmp>" block: Data and Host:
76
77 The Data block
78 The Data block defines a list of values or a table of values that are
79 to be queried. The following options can be set:
80
81 Type type
82 collectd's type that is to be used, e. g. "if_octets" for interface
83 traffic or "users" for a user count. The types are read from the
84 TypesDB (see collectd.conf(5)), so you may want to check for which
85 types are defined. See types.db(5) for a description of the format
86 of this file.
87
88 Table true|false
89 Define if this is a single list of values or a table of values. The
90 difference is the following:
91
92 When Table is set to false, the OIDs given to Values (see below)
93 are queried using the "GET" SNMP command (see snmpget(1)) and
94 transmitted to collectd. One value list is dispatched and,
95 eventually, one file will be written.
96
97 When Table is set to true, the OIDs given to Values (see below) are
98 queried using the "GETNEXT" SNMP command until the subtree is left.
99 After all the lists (think: all columns of the table) have been
100 read several values sets will be dispatches and, eventually,
101 several files will be written. If you configure a Type (see above)
102 which needs more than one data source (for example "if_octets"
103 which needs "rx" and "tx") you will need to specify more than one
104 (two, in the example case) OIDs with the Values option. This has
105 nothing to do with the Table setting.
106
107 For example, if you want to query the number of users on a system,
108 you can use "HOST-RESOURCES-MIB::hrSystemNumUsers.0". This is one
109 value and belongs to one value list, therefore Table must be set to
110 false. Please note that, in this case, you have to include the
111 sequence number (zero in this case) in the OID.
112
113 Counter example: If you want to query the interface table provided
114 by the "IF-MIB", e. g. the bytes transmitted. There are potentially
115 many interfaces, so you will want to set Table to true. Because the
116 "if_octets" type needs two values, received and transmitted bytes,
117 you need to specify two OIDs in the Values setting, in this case
118 likely "IF-MIB::ifHCInOctets" and "IF-MIB::ifHCOutOctets". But,
119 this is because of the Type setting, not the Table setting.
120
121 Since the semantic of Instance and Values depends on this setting
122 you need to set it before setting them. Doing vice verse will
123 result in undefined behavior.
124
125 Instance Instance
126 Sets the type-instance of the values that are dispatched. The
127 meaning of this setting depends on whether Table is set to true or
128 false:
129
130 If Table is set to true, Instance is interpreted as an SNMP-prefix
131 that will return a list of values. Those values are then used as
132 the actual type-instance. An example would be the "IF-MIB::ifDescr"
133 subtree. variables(5) from the SNMP distribution describes the
134 format of OIDs.
135
136 If Table is set to true and Instance is omitted, then "SUBID" will
137 be used as the instance.
138
139 If Table is set to false the actual string configured for Instance
140 is copied into the value-list. In this case Instance may be empty,
141 i. e. "".
142
143 InstancePrefix String
144 If Table is set to true, you may feel the need to add something to
145 the instance of the files. If set, String is prepended to the
146 instance as determined by querying the agent. When Table is set to
147 false this option has no effect.
148
149 The "UPS-MIB" is an example where you need this setting: It has
150 voltages of the inlets, outlets and the battery of an UPS. However,
151 it doesn't provide a descriptive column for these voltages. In this
152 case having 1, 2, ... as instances is not enough, because the inlet
153 voltages and outlet voltages may both have the subids 1, 2, ... You
154 can use this setting to distinguish between the different voltages.
155
156 Values OID [OID ...]
157 Configures the values to be queried from the SNMP host. The meaning
158 slightly changes with the Table setting. variables(5) from the SNMP
159 distribution describes the format of OIDs.
160
161 If Table is set to true, each OID must be the prefix of all the
162 values to query, e. g. "IF-MIB::ifInOctets" for all the counters of
163 incoming traffic. This subtree is walked (using "GETNEXT") until a
164 value from outside the subtree is returned.
165
166 If Table is set to false, each OID must be the OID of exactly one
167 value, e. g. "IF-MIB::ifInOctets.3" for the third counter of
168 incoming traffic.
169
170 Scale Value
171 The gauge-values returned by the SNMP-agent are multiplied by
172 Value. This is useful when values are transfered as a fixed point
173 real number. For example, thermometers may transfer 243 but
174 actually mean 24.3, so you can specify a scale value of 0.1 to
175 correct this. The default value is, of course, 1.0.
176
177 This value is not applied to counter-values.
178
179 Shift Value
180 Value is added to gauge-values returned by the SNMP-agent after
181 they have been multiplied by any Scale value. If, for example, a
182 thermometer returns degrees Kelvin you could specify a shift of
183 273.15 here to store values in degrees Celsius. The default value
184 is, of course, 0.0.
185
186 This value is not applied to counter-values.
187
188 The Host block
189 The Host block defines which hosts to query, which SNMP community and
190 version to use and which of the defined Data to query.
191
192 The argument passed to the Host block is used as the hostname in the
193 data stored by collectd.
194
195 Address IP-Address|Hostname
196 Set the address to connect to.
197
198 Version 1|2
199 Set the SNMP version to use. When giving 2 version "2c" is actually
200 used. Version 3 is not supported by this plugin.
201
202 Community Community
203 Pass Community to the host.
204
205 Collect Data [Data ...]
206 Defines which values to collect. Data refers to one of the Data
207 block above. Since the config file is read top-down you need to
208 define the data before using it here.
209
210 Interval Seconds
211 Collect data from this host every Seconds seconds. This option is
212 meant for devices with not much CPU power, e. g. network equipment
213 such as switches, embedded devices, rack monitoring systems and so
214 on. Since the Step of generated RRD files depends on this setting
215 it's wise to select a reasonable value once and never change it.
216
218 collectd(1), collectd.conf(5), snmpget(1), snmpgetnext(1),
219 variables(5), unix(7)
220
222 Florian Forster <octo@verplant.org>
223
224
225
2264.9.5 2011-03-26 COLLECTD-SNMP(5)