]> arthur.barton.de Git - netdata.git/blob - python.d/README.md
Cleaning up Documentation
[netdata.git] / python.d / README.md
1 # Disclaimer
2
3 Every module should be compatible with python2 and python3.
4 All third party libraries should be installed system-wide or in `python_modules` directory.
5 Module configurations are written in YAML and **pyYAML is required**.
6
7 Every configuration file must have one of two formats:
8
9 - Configuration for only one job:
10
11 ```yaml
12 update_every : 2 # update frequency
13 retries      : 1 # how many failures in update() is tolerated
14 priority     : 20000 # where it is shown on dashboard
15
16 other_var1   : bla  # variables passed to module
17 other_var2   : alb
18 ```
19
20 - Configuration for many jobs (ex. mysql):
21
22 ```yaml
23 # module defaults:
24 update_every : 2
25 retries      : 1
26 priority     : 20000
27
28 local:  # job name
29   update_every : 5 # job update frequency
30   other_var1   : some_val # module specific variable
31
32 other_job: 
33   priority     : 5 # job position on dashboard
34   retries      : 20 # job retries
35   other_var2   : val # module specific variable
36 ```
37
38 `update_every`, `retries`, and `priority` are always optional.
39
40 ---
41
42 The following python.d modules are supported:
43
44 # apache
45
46 This module will monitor one or more apache servers depending on configuration. 
47
48 **Requirements:**
49  * apache with enabled `mod_status`
50
51 It produces the following charts:
52
53 1. **Requests** in requests/s
54  * requests
55
56 2. **Connections**
57  * connections
58
59 3. **Async Connections**
60  * keepalive
61  * closing
62  * writing
63  
64 4. **Bandwidth** in kilobytes/s
65  * sent
66  
67 5. **Workers**
68  * idle
69  * busy
70  
71 6. **Lifetime Avg. Requests/s** in requests/s
72  * requests_sec
73  
74 7. **Lifetime Avg. Bandwidth/s** in kilobytes/s
75  * size_sec
76  
77 8. **Lifetime Avg. Response Size** in bytes/request
78  * size_req
79
80 ### configuration
81
82 Needs only `url` to server's `server-status?auto`
83
84 Here is an example for 2 servers:
85
86 ```yaml
87 update_every : 10
88 priority     : 90100
89
90 local:
91   url      : 'http://localhost/server-status?auto'
92   retries  : 20
93
94 remote:
95   url          : 'http://www.apache.org/server-status?auto'
96   update_every : 5
97   retries      : 4
98 ```
99
100 Without configuration, module attempts to connect to `http://localhost/server-status?auto`
101
102 ---
103
104 # apache_cache
105
106 Module monitors apache mod_cache log and produces only one chart:
107
108 **cached responses** in percent cached
109  * hit
110  * miss
111  * other
112  
113 ### configuration
114
115 Sample:
116
117 ```yaml
118 update_every : 10
119 priority     : 120000
120 retries      : 5
121 log_path     : '/var/log/apache2/cache.log'
122 ```
123
124 If no configuration is given, module will attempt to read log file at `/var/log/apache2/cache.log`
125
126 ---
127
128 # cpufreq
129
130 Module shows current cpu frequency by looking at appropriate files in /sys/devices
131
132 **Requirement:**
133 Processor which presents data scaling frequency data
134
135 It produces one chart with multiple lines (one line per core).
136
137 ### configuration
138
139 Sample:
140
141 ```yaml
142 sys_dir: "/sys/devices"
143 ```
144
145 If no configuration is given, module will search for `scaling_cur_freq` files in `/sys/devices` directory.
146 Directory is also prefixed with `NETDATA_HOST_PREFIX` if specified.
147
148 ---
149
150 # dovecot
151
152 This module provides statistics information from dovecot server. 
153 Statistics are taken from dovecot socket by executing `EXPORT global` command.
154 More information about dovecot stats can be found on [project wiki page.](http://wiki2.dovecot.org/Statistics)
155
156 **Requirement:**
157 Dovecot unix socket with R/W permissions for user netdata or dovecot with configured TCP/IP socket.
158  
159 Module gives information with following charts:
160
161 1. **logins and sessions**
162  * logins
163  * active sessions
164
165 2. **commands** - number of IMAP commands 
166  * commands
167  
168 3. **Faults**
169  * minor
170  * major
171  
172 4. **Context Switches** 
173  * volountary
174  * involountary
175  
176 5. **disk** in bytes/s
177  * read
178  * write
179  
180 6. **bytes** in bytes/s
181  * read
182  * write
183  
184 7. **number of syscalls** in syscalls/s
185  * read
186  * write
187
188 8. **lookups** - number of lookups per second
189  * path
190  * attr
191
192 9. **hits** - number of cache hits 
193  * hits
194
195 10. **attempts** - authorization attemts
196  * success
197  * failure
198
199 11. **cache** - cached authorization hits
200  * hit
201  * miss
202  
203 ### configuration
204
205 Sample:
206
207 ```yaml
208 localtcpip:
209   name     : 'local'
210   host     : '127.0.0.1'
211   port     : 24242
212
213 localsocket:
214   name     : 'local'
215   socket   : '/var/run/dovecot/stats'
216 ```
217
218 If no configuration is given, module will attempt to connect to dovecot using unix socket localized in `/var/run/dovecot/stats`
219
220 ---
221
222 # exim
223
224 Simple module executing `exim -bpc` to grab exim queue. 
225 This command can take a lot of time to finish its execution thus it is not recommended to run it every second.
226
227 It produces only one chart:
228
229 1. **Exim Queue Emails**
230  * emails
231
232 Configuration is not needed.
233
234 ---
235
236 # hddtemp
237  
238 Module monitors disk temperatures from one or more hddtemp daemons.
239
240 **Requirement:**
241 Running `hddtemp` in daemonized mode with access on tcp port
242
243 It produces one chart **Temperature** with dynamic number of dimensions (one per disk)
244
245 ### configuration
246
247 Sample:
248
249 ```yaml
250 update_every: 3
251 host: "127.0.0.1"
252 port: 7634
253 ```
254
255 If no configuration is given, module will attempt to connect to hddtemp daemon on `127.0.0.1:7634` address
256
257 ---
258
259 # IPFS
260
261 Module monitors [IPFS](https://ipfs.io) basic information.
262
263 1. **Bandwidth** in kbits/s
264  * in
265  * out
266  
267 2. **Peers**
268  * peers
269  
270 ### configuration
271
272 Only url to IPFS server is needed. 
273
274 Sample:
275
276 ```yaml
277 localhost:
278   name : 'local'
279   url  : 'http://localhost:5001'
280 ```
281
282 ---
283
284 # memcached
285
286 Memcached monitoring module. Data grabbed from [stats interface](https://github.com/memcached/memcached/wiki/Commands#stats).
287
288 1. **Network** in kilobytes/s
289  * read
290  * written
291  
292 2. **Connections** per second
293  * current
294  * rejected
295  * total
296  
297 3. **Items** in cluster
298  * current
299  * total
300  
301 4. **Evicted and Reclaimed** items
302  * evicted
303  * reclaimed
304  
305 5. **GET** requests/s
306  * hits
307  * misses
308
309 6. **GET rate** rate in requests/s
310  * rate
311
312 7. **SET rate** rate in requests/s
313  * rate
314  
315 8. **DELETE** requests/s
316  * hits
317  * misses
318
319 9. **CAS** requests/s
320  * hits
321  * misses
322  * bad value
323  
324 10. **Increment** requests/s
325  * hits
326  * misses
327  
328 11. **Decrement** requests/s
329  * hits
330  * misses
331  
332 12. **Touch** requests/s
333  * hits
334  * misses
335  
336 13. **Touch rate** rate in requests/s
337  * rate
338  
339 ### configuration
340
341 Sample:
342
343 ```yaml
344 localtcpip:
345   name     : 'local'
346   host     : '127.0.0.1'
347   port     : 24242
348 ```
349
350 If no configuration is given, module will attempt to connect to memcached instance on `127.0.0.1:11211` address.
351
352 ---
353
354 # mysql
355
356 Module monitors one or more mysql servers
357
358 **Requirements:**
359  * python library [MySQLdb](https://github.com/PyMySQL/mysqlclient-python) (faster) or [PyMySQL](https://github.com/PyMySQL/PyMySQL) (slower)
360
361 It will produce following charts (if data is available):
362
363 1. **Bandwidth** in kbps
364  * in
365  * out
366
367 2. **Queries** in queries/sec
368  * queries
369  * questions
370  * slow queries
371
372 3. **Operations** in operations/sec
373  * opened tables
374  * flush
375  * commit
376  * delete
377  * prepare
378  * read first
379  * read key
380  * read next
381  * read prev
382  * read random
383  * read random next
384  * rollback
385  * save point
386  * update
387  * write
388
389 4. **Table Locks** in locks/sec
390  * immediate
391  * waited
392
393 5. **Select Issues** in issues/sec
394  * full join
395  * full range join
396  * range
397  * range check
398  * scan
399
400 6. **Sort Issues** in issues/sec
401  * merge passes
402  * range
403  * scan
404
405 ### configuration
406
407 You can provide, per server, the following:
408
409 1. username which have access to database (deafults to 'root')
410 2. password (defaults to none)
411 3. mysql my.cnf configuration file
412 4. mysql socket (optional)
413 5. mysql host (ip or hostname)
414 6. mysql port (defaults to 3306)
415
416 Here is an example for 3 servers:
417
418 ```yaml
419 update_every : 10
420 priority     : 90100
421 retries      : 5
422
423 local:
424   'my.cnf'   : '/etc/mysql/my.cnf'
425   priority   : 90000
426
427 local_2:
428   user     : 'root'
429   pass : 'blablablabla'
430   socket   : '/var/run/mysqld/mysqld.sock'
431   update_every : 1
432
433 remote:
434   user     : 'admin'
435   pass : 'bla'
436   host     : 'example.org'
437   port     : 9000
438   retries  : 20
439 ```
440
441 If no configuration is given, module will attempt to connect to mysql server via unix socket at `/var/run/mysqld/mysqld.sock` without password and with username `root`
442
443 ---
444
445 # nginx
446
447 This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote. 
448
449 **Requirements:**
450  * nginx with configured 'ngx_http_stub_status_module'
451  * 'location /stub_status'
452
453 Example nginx configuration can be found in 'python.d/nginx.conf'
454
455 It produces following charts:
456
457 1. **Active Connections**
458  * active
459
460 2. **Requests** in requests/s
461  * requests
462
463 3. **Active Connections by Status**
464  * reading
465  * writing
466  * waiting
467  
468 4. **Connections Rate** in connections/s
469  * accepts
470  * handled
471  
472 ### configuration
473
474 Needs only `url` to server's `stub_status`
475
476 Here is an example for local server:
477
478 ```yaml
479 update_every : 10
480 priority     : 90100
481
482 local:
483   url     : 'http://localhost/stub_status'
484   retries : 10
485 ```
486
487 Without configuration, module attempts to connect to `http://localhost/stub_status`
488
489 ---
490
491 # nginx_log
492
493 Module monitors nginx access log and produces only one chart:
494
495 1. **nginx status codes** in requests/s
496  * 2xx
497  * 3xx
498  * 4xx
499  * 5xx
500
501 ### configuration
502
503 Sample for two vhosts:
504
505 ```yaml
506 site_A:
507   path: '/var/log/nginx/access-A.log'
508
509 site_B:
510   name: 'local'
511   path: '/var/log/nginx/access-B.log'
512 ```
513
514 When no configuration file is found, module tries to parse `/var/log/nginx/access.log` file.
515
516 ---
517
518 # phpfpm
519
520 This module will monitor one or more php-fpm instances depending on configuration. 
521
522 **Requirements:**
523  * php-fpm with enabled `status` page
524  * access to `status` page via web server
525  
526 It produces following charts:
527
528 1. **Active Connections**
529  * active
530  * maxActive
531  * idle
532
533 2. **Requests** in requests/s
534  * requests
535  
536 3. **Performance**
537  * reached
538  * slow
539  
540 ### configuration
541
542 Needs only `url` to server's `status`
543  
544 Here is an example for local instance:
545
546 ```yaml
547 update_every : 3
548 priority     : 90100
549
550 local:
551   url     : 'http://localhost/status'
552   retries : 10
553 ```
554
555 Without configuration, module attempts to connect to `http://localhost/status`
556
557 ---
558
559 # postfix
560
561 Simple module executing `postfix -p` to grab postfix queue.
562
563 It produces only two charts:
564
565 1. **Postfix Queue Emails**
566  * emails
567  
568 2. **Postfix Queue Emails Size** in KB
569  * size
570
571 Configuration is not needed.
572
573 ---
574
575 # redis
576
577 Get INFO data from redis instance.
578
579 Following charts are drawn:
580
581 1. **Operations** per second
582  * operations
583
584 2. **Hit rate** in percent
585  * rate
586
587 3. **Memory utilization** in kilobytes
588  * total
589  * lua
590
591 4. **Database keys** 
592  * lines are creates dynamically based on how many databases are there
593  
594 5. **Clients**
595  * connected
596  * blocked
597  
598 6. **Slaves**
599  * connected
600  
601 ### configuration
602
603 ```yaml
604 socket:
605   name     : 'local'
606   socket   : '/var/lib/redis/redis.sock'
607
608 localhost:
609   name     : 'local'
610   host     : 'localhost'
611   port     : 6379
612 ```
613
614 When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
615
616 ---
617
618 # sensors
619
620 System sensors information.
621
622 Charts are created dynamically.
623
624 ### configuration
625
626 For detailed configuration information please read [`sensors.conf`](https://github.com/firehol/netdata/blob/master/conf.d/python.d/sensors.conf) file.
627
628 ---
629
630 # squid
631
632 This module will monitor one or more squid instances depending on configuration.
633
634 It produces following charts:
635
636 1. **Client Bandwidth** in kilobits/s
637  * in
638  * out
639  * hits
640
641 2. **Client Requests** in requests/s
642  * requests
643  * hits
644  * errors
645
646 3. **Server Bandwidth** in kilobits/s
647  * in
648  * out
649  
650 4. **Server Requests** in requests/s
651  * requests
652  * errors
653  
654 ### configuration
655
656 ```yaml
657 priority     : 50000
658
659 local:
660   request : 'cache_object://localhost:3128/counters'
661   host    : 'localhost'
662   port    : 3128
663 ```
664
665 Without any configuration module will try to autodetect where squid presents its `counters` data
666  
667 ---
668
669 # tomcat
670
671 Present tomcat containers memory utilization.
672
673 Charts:
674
675 1. **Requests** per second
676  * accesses
677
678 2. **Volume** in KB/s
679  * volume
680
681 3. **Threads**
682  * current
683  * busy
684  
685 4. **JVM Free Memory** in MB
686  * jvm
687  
688 ### configuration
689
690 ```yaml
691 localhost:
692   name : 'local'
693   url  : 'http://127.0.0.1:8080/manager/status?XML=true'
694   user : 'tomcat_username'
695   pass : 'secret_tomcat_password'
696 ```
697
698 Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials. 
699 So it will probably fail.
700
701 ---