]> arthur.barton.de Git - netdata.git/blob - conf.d/node.d/snmp.conf.md
added node.d.conf and node.d markdown files to explain configuration
[netdata.git] / conf.d / node.d / snmp.conf.md
1 # SNMP Data Collector\r
2 \r
3 Using this collector, netdata can collect data from any SNMP device.\r
4 \r
5 This collector supports:\r
6 \r
7 - any number of SNMP devices\r
8 - each SNMP device can be used to collect data for any number of charts\r
9 - each chart may have any number of dimensions\r
10 - each SNMP device may have a different update frequency\r
11 - each SNMP device will accept one or more batches to report values (you can set `max_request_size` per SNMP server, to control the size of batches).\r
12 \r
13 The source code of the plugin is [here](https://github.com/firehol/netdata/blob/master/node.d/snmp.node.js).\r
14 \r
15 ## Configuration\r
16 \r
17 You will need to create the file `/etc/netdata/node.d/snmp.conf` with data like the following.\r
18 \r
19 In this example:\r
20 \r
21  - the SNMP device is `10.11.12.8`.\r
22  - the SNMP community is `public`.\r
23  - we will update the values every 10 seconds (`update_every: 10` under the server `10.11.12.8`).\r
24  - we define 2 charts `snmp_switch.bandwidth_port1` and `snmp_switch.bandwidth_port2`, each having 2 dimensions: `in` and `out`.\r
25 \r
26 ```js\r
27 {\r
28     "enable_autodetect": false,\r
29     "update_every": 5,\r
30     "max_request_size": 100,\r
31     "servers": [\r
32         {\r
33             "hostname": "10.11.12.8",\r
34             "community": "public",\r
35             "update_every": 10,\r
36             "max_request_size": 50,\r
37             "options": { "timeout": 10000 },\r
38             "charts": {\r
39                 "snmp_switch.bandwidth_port1": {\r
40                     "title": "Switch Bandwidth for port 1",\r
41                     "units": "kilobits/s",\r
42                     "type": "area",\r
43                     "priority": 1,\r
44                     "family": "ports",\r
45                     "dimensions": {\r
46                         "in": {\r
47                             "oid": "1.3.6.1.2.1.2.2.1.10.1",\r
48                             "algorithm": "incremental",\r
49                             "multiplier": 8,\r
50                             "divisor": 1024\r
51                         },\r
52                         "out": {\r
53                             "oid": "1.3.6.1.2.1.2.2.1.16.1",\r
54                             "algorithm": "incremental",\r
55                             "multiplier": -8,\r
56                             "divisor": 1024\r
57                         }\r
58                     }\r
59                 },\r
60                 "snmp_switch.bandwidth_port2": {\r
61                     "title": "Switch Bandwidth for port 2",\r
62                     "units": "kilobits/s",\r
63                     "type": "area",\r
64                     "priority": 1,\r
65                     "family": "ports",\r
66                     "dimensions": {\r
67                         "in": {\r
68                             "oid": "1.3.6.1.2.1.2.2.1.10.2",\r
69                             "algorithm": "incremental",\r
70                             "multiplier": 8,\r
71                             "divisor": 1024\r
72                         },\r
73                         "out": {\r
74                             "oid": "1.3.6.1.2.1.2.2.1.16.2",\r
75                             "algorithm": "incremental",\r
76                             "multiplier": -8,\r
77                             "divisor": 1024\r
78                         }\r
79                     }\r
80                 }\r
81             }\r
82         }\r
83     ]\r
84 }\r
85 ```\r
86 \r
87 `update_every` is the update frequency for each server, in seconds.\r
88 \r
89 `max_request_size` limits the maximum number of OIDs that will be requested in a single call. The default is 50. Lower this number of you get `TooBig` errors in netdata error.log.\r
90 \r
91 `family` sets the name of the submenu of the dashboard each chart will appear under.\r
92 \r
93 If you need to define many charts using incremental OIDs, you can use something like this:\r
94 \r
95 This is like the previous, but the option `multiply_range` given, will multiply the current chart from `1` to `24` inclusive, producing 24 charts in total for the 24 ports of the switch `10.11.12.8`.\r
96 \r
97 Each of the 24 new charts will have its id (1-24) appended at:\r
98 \r
99 1. its chart unique id, i.e. `snmp_switch.bandwidth_port1` to `snmp_switch.bandwidth_port24`\r
100 2. its `title`, i.e. `Switch Bandwidth for port 1` to `Switch Bandwidth for port 24`\r
101 3. its `oid` (for all dimensions), i.e. dimension `in` will be `1.3.6.1.2.1.2.2.1.10.1` to `1.3.6.1.2.1.2.2.1.10.24`\r
102 3. its priority (which will be incremented for each chart so that the charts will appear on the dashboard in this order)\r
103 \r
104 ```js\r
105 {\r
106     "enable_autodetect": false,\r
107     "update_every": 10,\r
108     "servers": [\r
109         {\r
110             "hostname": "10.11.12.8",\r
111             "community": "public",\r
112             "update_every": 10,\r
113             "options": { "timeout": 20000 },\r
114             "charts": {\r
115                 "snmp_switch.bandwidth_port": {\r
116                     "title": "Switch Bandwidth for port ",\r
117                     "units": "kilobits/s",\r
118                     "type": "area",\r
119                     "priority": 1,\r
120                     "family": "ports",\r
121                     "multiply_range": [ 1, 24 ],\r
122                     "dimensions": {\r
123                         "in": {\r
124                             "oid": "1.3.6.1.2.1.2.2.1.10.",\r
125                             "algorithm": "incremental",\r
126                             "multiplier": 8,\r
127                             "divisor": 1024\r
128                         },\r
129                         "out": {\r
130                             "oid": "1.3.6.1.2.1.2.2.1.16.",\r
131                             "algorithm": "incremental",\r
132                             "multiplier": -8,\r
133                             "divisor": 1024\r
134                         }\r
135                     }\r
136                 }\r
137             }\r
138         }\r
139     ]\r
140 }\r
141 ```\r
142 \r
143 The `options` given for each server, are:\r
144 \r
145  - `timeout`, the time to wait for the SNMP device to respond. The default is 5000 ms.\r
146  - `version`, the SNMP version to use. `0` is Version 1, `1` is Version 2c. The default is Version 1 (`0`).\r
147  - `transport`, the default is `udp4`.\r
148  - `port`, the port of the SNMP device to connect to. The default is `161`.\r
149  - `retries`, the number of attempts to make to fetch the data. The default is `1`.\r
150 \r
151 ## Retreiving names from snmp\r
152 \r
153 You can append a value retrieved from SNMP to the title, by adding `titleoid` to the chart.\r
154 \r
155 You can set a dimension name to a value retrieved from SNMP, by adding `oidname` to the dimension.\r
156 \r
157 Both of the above will participate in `multiply_range`.\r
158 \r
159 \r
160 ## Testing the configuration\r
161 \r
162 To test it, you can run:\r
163 \r
164 ```sh\r
165 /usr/libexec/netdata/plugins.d/node.d.plugin 1 snmp\r
166 ```\r
167 \r
168 The above will run it on your console and you will be able to see what netdata sees, but also errors. You can get a very detailed output by appending `debug` to the command line.\r
169 \r
170 If it works, restart netdata to activate the snmp collector and refresh the dashboard (if your SNMP device responds with a delay, you may need to refresh the dashboard in a few seconds).\r
171 \r
172 ## Data collection speed\r
173 \r
174 Keep in mind that many SNMP switches are routers are very slow. They may not be able to report values per second. If you run `node.d.plugin` in `debug` mode, it will report the time it took for the SNMP device to respond. My switch, for example, needs 7-8 seconds to respond for the traffic on 24 ports (48 OIDs, in/out).\r
175 \r
176 Also, if you use many SNMP clients on the same SNMP device at the same time, values may be skipped. This is a problem of the SNMP device, not this collector.\r
177 \r
178 ## Finding OIDs\r
179 \r
180 Use `snmpwalk`, like this:\r
181 \r
182 ```sh\r
183 snmpwalk -t 20 -v 1 -O fn -c public 10.11.12.8\r
184 ```\r
185 \r
186 - `-t 20` is the timeout in seconds\r
187 - `-v 1` is the SNMP version\r
188 - `-O fn` will display full OIDs in numeric format (you may want to run it also without this option to see human readable output of OIDs)\r
189 - `-c public` is the SNMP community\r
190 - `10.11.12.8` is the SNMP device\r
191 \r
192 Keep in mind that `snmpwalk` outputs the OIDs with a dot in front them. You should remove this dot when adding OIDs to the configuration file of this collector.\r
193 \r
194 ## Example: Linksys SRW2024P\r
195 \r
196 This is what I use for my Linksys SRW2024P. It creates:\r
197 \r
198 1. A chart for power consumption (it is a PoE switch)\r
199 2. Two charts for packets received (total packets received and packets received with errors)\r
200 3. One chart for packets output\r
201 4. 24 charts, one for each port of the switch. It also appends the port names, as defined at the switch, to the chart titles.\r
202 \r
203 This switch also reports various other metrics, like snmp, packets per port, etc. Unfortunately it does not report CPU utilization or backplane utilization.\r
204 \r
205 This switch has a very slow SNMP processors. To respond, it needs about 8 seconds, so I have set the refresh frequency (`update_every`) to 15 seconds.\r
206 \r
207 ```js\r
208 {\r
209         "enable_autodetect": false,\r
210         "update_every": 5,\r
211         "servers": [\r
212                 {\r
213                         "hostname": "10.11.12.8",\r
214                         "community": "public",\r
215                         "update_every": 15,\r
216                         "options": { "timeout": 20000, "version": 1 },\r
217                         "charts": {\r
218                                 "snmp_switch.power": {\r
219                                         "title": "Switch Power Supply",\r
220                                         "units": "watts",\r
221                                         "type": "line",\r
222                                         "priority": 10,\r
223                                         "family": "power",\r
224                                         "dimensions": {\r
225                                                 "supply": {\r
226                                                         "oid": ".1.3.6.1.2.1.105.1.3.1.1.2.1",\r
227                                                         "algorithm": "absolute",\r
228                                                         "multiplier": 1,\r
229                                                         "divisor": 1\r
230                                                 },\r
231                                                 "used": {\r
232                                                         "oid": ".1.3.6.1.2.1.105.1.3.1.1.4.1",\r
233                                                         "algorithm": "absolute",\r
234                                                         "multiplier": 1,\r
235                                                         "divisor": 1\r
236                                                 }\r
237                                         }\r
238                                 }\r
239                                 , "snmp_switch.input": {\r
240                                         "title": "Switch Packets Input",\r
241                                         "units": "packets/s",\r
242                                         "type": "area",\r
243                                         "priority": 20,\r
244                                         "family": "IP",\r
245                                         "dimensions": {\r
246                                                 "receives": {\r
247                                                         "oid": ".1.3.6.1.2.1.4.3.0",\r
248                                                         "algorithm": "incremental",\r
249                                                         "multiplier": 1,\r
250                                                         "divisor": 1\r
251                                                 }\r
252                                                 , "discards": {\r
253                                                         "oid": ".1.3.6.1.2.1.4.8.0",\r
254                                                         "algorithm": "incremental",\r
255                                                         "multiplier": 1,\r
256                                                         "divisor": 1\r
257                                                 }\r
258                                         }\r
259                                 }\r
260                                 , "snmp_switch.input_errors": {\r
261                                         "title": "Switch Received Packets with Errors",\r
262                                         "units": "packets/s",\r
263                                         "type": "line",\r
264                                         "priority": 30,\r
265                                         "family": "IP",\r
266                                         "dimensions": {\r
267                                                 "bad_header": {\r
268                                                         "oid": ".1.3.6.1.2.1.4.4.0",\r
269                                                         "algorithm": "incremental",\r
270                                                         "multiplier": 1,\r
271                                                         "divisor": 1\r
272                                                 }\r
273                                                 , "bad_address": {\r
274                                                         "oid": ".1.3.6.1.2.1.4.5.0",\r
275                                                         "algorithm": "incremental",\r
276                                                         "multiplier": 1,\r
277                                                         "divisor": 1\r
278                                                 }\r
279                                                 , "unknown_protocol": {\r
280                                                         "oid": ".1.3.6.1.2.1.4.7.0",\r
281                                                         "algorithm": "incremental",\r
282                                                         "multiplier": 1,\r
283                                                         "divisor": 1\r
284                                                 }\r
285                                         }\r
286                                 }\r
287                                 , "snmp_switch.output": {\r
288                                         "title": "Switch Output Packets",\r
289                                         "units": "packets/s",\r
290                                         "type": "line",\r
291                                         "priority": 40,\r
292                                         "family": "IP",\r
293                                         "dimensions": {\r
294                                                 "requests": {\r
295                                                         "oid": ".1.3.6.1.2.1.4.10.0",\r
296                                                         "algorithm": "incremental",\r
297                                                         "multiplier": 1,\r
298                                                         "divisor": 1\r
299                                                 }\r
300                                                 , "discards": {\r
301                                                         "oid": ".1.3.6.1.2.1.4.11.0",\r
302                                                         "algorithm": "incremental",\r
303                                                         "multiplier": -1,\r
304                                                         "divisor": 1\r
305                                                 }\r
306                                                 , "no_route": {\r
307                                                         "oid": ".1.3.6.1.2.1.4.12.0",\r
308                                                         "algorithm": "incremental",\r
309                                                         "multiplier": -1,\r
310                                                         "divisor": 1\r
311                                                 }\r
312                                         }\r
313                                 }\r
314                                 , "snmp_switch.bandwidth_port": {\r
315                                         "title": "Switch Bandwidth for port ",\r
316                                         "titleoid": ".1.3.6.1.2.1.31.1.1.1.18.",\r
317                                         "units": "kilobits/s",\r
318                                         "type": "area",\r
319                                         "priority": 100,\r
320                                         "family": "ports",\r
321                                         "multiply_range": [ 1, 24 ],\r
322                                         "dimensions": {\r
323                                                 "in": {\r
324                                                         "oid": ".1.3.6.1.2.1.2.2.1.10.",\r
325                                                         "algorithm": "incremental",\r
326                                                         "multiplier": 8,\r
327                                                         "divisor": 1024\r
328                                                 }\r
329                                                 , "out": {\r
330                                                         "oid": ".1.3.6.1.2.1.2.2.1.16.",\r
331                                                         "algorithm": "incremental",\r
332                                                         "multiplier": -8,\r
333                                                         "divisor": 1024\r
334                                                 }\r
335                                         }\r
336                                 }\r
337                         }\r
338                 }\r
339         ]\r
340 }\r
341 ```\r