]> arthur.barton.de Git - netdata.git/blob - python.d/README.md
Merge pull request #1417 from l2isbad/openvpn_log_plugin
[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. **sessions**
162  * active sessions
163
164 2. **logins**
165  * logins
166
167 3. **commands** - number of IMAP commands 
168  * commands
169  
170 4. **Faults**
171  * minor
172  * major
173  
174 5. **Context Switches** 
175  * volountary
176  * involountary
177  
178 6. **disk** in bytes/s
179  * read
180  * write
181  
182 7. **bytes** in bytes/s
183  * read
184  * write
185  
186 8. **number of syscalls** in syscalls/s
187  * read
188  * write
189
190 9. **lookups** - number of lookups per second
191  * path
192  * attr
193
194 10. **hits** - number of cache hits 
195  * hits
196
197 11. **attempts** - authorization attemts
198  * success
199  * failure
200
201 12. **cache** - cached authorization hits
202  * hit
203  * miss
204  
205 ### configuration
206
207 Sample:
208
209 ```yaml
210 localtcpip:
211   name     : 'local'
212   host     : '127.0.0.1'
213   port     : 24242
214
215 localsocket:
216   name     : 'local'
217   socket   : '/var/run/dovecot/stats'
218 ```
219
220 If no configuration is given, module will attempt to connect to dovecot using unix socket localized in `/var/run/dovecot/stats`
221
222 ---
223
224 # exim
225
226 Simple module executing `exim -bpc` to grab exim queue. 
227 This command can take a lot of time to finish its execution thus it is not recommended to run it every second.
228
229 It produces only one chart:
230
231 1. **Exim Queue Emails**
232  * emails
233
234 Configuration is not needed.
235
236 ---
237
238 # freeradius
239
240 Uses the `radclient` command to provide freeradius statistics. It is not recommended to run it every second.
241
242 It produces:
243
244 1. **Authentication counters:**
245  * access-accepts
246  * access-rejects
247  * auth-dropped-requests
248  * auth-duplicate-requests
249  * auth-invalid-requests
250  * auth-malformed-requests
251  * auth-unknown-types
252
253 2. **Accounting counters:** [optional]
254  * accounting-requests
255  * accounting-responses
256  * acct-dropped-requests
257  * acct-duplicate-requests
258  * acct-invalid-requests
259  * acct-malformed-requests
260  * acct-unknown-types
261
262 3. **Proxy authentication counters:** [optional]
263  * proxy-access-accepts
264  * proxy-access-rejects
265  * proxy-auth-dropped-requests
266  * proxy-auth-duplicate-requests
267  * proxy-auth-invalid-requests
268  * proxy-auth-malformed-requests
269  * proxy-auth-unknown-types
270
271 4. **Proxy accounting counters:** [optional]
272  * proxy-accounting-requests
273  * proxy-accounting-responses
274  * proxy-acct-dropped-requests
275  * proxy-acct-duplicate-requests
276  * proxy-acct-invalid-requests
277  * proxy-acct-malformed-requests
278  * proxy-acct-unknown-typesa
279
280
281 ### configuration
282
283 Sample:
284
285 ```yaml
286 local:
287   host       : 'localhost'
288   port       : '18121'
289   secret     : 'adminsecret'
290   acct       : False # Freeradius accounting statistics.
291   proxy_auth : False # Freeradius proxy authentication statistics. 
292   proxy_acct : False # Freeradius proxy accounting statistics.
293 ```
294
295 **Freeradius server configuration:**
296
297 The configuration for the status server is automatically created in the sites-available directory.
298 By default, server is enabled and can be queried from every client. 
299 FreeRADIUS will only respond to status-server messages, if the status-server virtual server has been enabled.
300
301 To do this, create a link from the sites-enabled directory to the status file in the sites-available directory:
302  * cd sites-enabled
303  * ln -s ../sites-available/status status
304
305 and restart/reload your FREERADIUS server.
306
307 ---
308
309 # hddtemp
310  
311 Module monitors disk temperatures from one or more hddtemp daemons.
312
313 **Requirement:**
314 Running `hddtemp` in daemonized mode with access on tcp port
315
316 It produces one chart **Temperature** with dynamic number of dimensions (one per disk)
317
318 ### configuration
319
320 Sample:
321
322 ```yaml
323 update_every: 3
324 host: "127.0.0.1"
325 port: 7634
326 ```
327
328 If no configuration is given, module will attempt to connect to hddtemp daemon on `127.0.0.1:7634` address
329
330 ---
331
332 # IPFS
333
334 Module monitors [IPFS](https://ipfs.io) basic information.
335
336 1. **Bandwidth** in kbits/s
337  * in
338  * out
339  
340 2. **Peers**
341  * peers
342  
343 ### configuration
344
345 Only url to IPFS server is needed. 
346
347 Sample:
348
349 ```yaml
350 localhost:
351   name : 'local'
352   url  : 'http://localhost:5001'
353 ```
354
355 ---
356
357 # memcached
358
359 Memcached monitoring module. Data grabbed from [stats interface](https://github.com/memcached/memcached/wiki/Commands#stats).
360
361 1. **Network** in kilobytes/s
362  * read
363  * written
364  
365 2. **Connections** per second
366  * current
367  * rejected
368  * total
369  
370 3. **Items** in cluster
371  * current
372  * total
373  
374 4. **Evicted and Reclaimed** items
375  * evicted
376  * reclaimed
377  
378 5. **GET** requests/s
379  * hits
380  * misses
381
382 6. **GET rate** rate in requests/s
383  * rate
384
385 7. **SET rate** rate in requests/s
386  * rate
387  
388 8. **DELETE** requests/s
389  * hits
390  * misses
391
392 9. **CAS** requests/s
393  * hits
394  * misses
395  * bad value
396  
397 10. **Increment** requests/s
398  * hits
399  * misses
400  
401 11. **Decrement** requests/s
402  * hits
403  * misses
404  
405 12. **Touch** requests/s
406  * hits
407  * misses
408  
409 13. **Touch rate** rate in requests/s
410  * rate
411  
412 ### configuration
413
414 Sample:
415
416 ```yaml
417 localtcpip:
418   name     : 'local'
419   host     : '127.0.0.1'
420   port     : 24242
421 ```
422
423 If no configuration is given, module will attempt to connect to memcached instance on `127.0.0.1:11211` address.
424
425 ---
426
427 # mysql
428
429 Module monitors one or more mysql servers
430
431 **Requirements:**
432  * python library [MySQLdb](https://github.com/PyMySQL/mysqlclient-python) (faster) or [PyMySQL](https://github.com/PyMySQL/PyMySQL) (slower)
433
434 It will produce following charts (if data is available):
435
436 1. **Bandwidth** in kbps
437  * in
438  * out
439
440 2. **Queries** in queries/sec
441  * queries
442  * questions
443  * slow queries
444
445 3. **Operations** in operations/sec
446  * opened tables
447  * flush
448  * commit
449  * delete
450  * prepare
451  * read first
452  * read key
453  * read next
454  * read prev
455  * read random
456  * read random next
457  * rollback
458  * save point
459  * update
460  * write
461
462 4. **Table Locks** in locks/sec
463  * immediate
464  * waited
465
466 5. **Select Issues** in issues/sec
467  * full join
468  * full range join
469  * range
470  * range check
471  * scan
472
473 6. **Sort Issues** in issues/sec
474  * merge passes
475  * range
476  * scan
477
478 ### configuration
479
480 You can provide, per server, the following:
481
482 1. username which have access to database (deafults to 'root')
483 2. password (defaults to none)
484 3. mysql my.cnf configuration file
485 4. mysql socket (optional)
486 5. mysql host (ip or hostname)
487 6. mysql port (defaults to 3306)
488
489 Here is an example for 3 servers:
490
491 ```yaml
492 update_every : 10
493 priority     : 90100
494 retries      : 5
495
496 local:
497   'my.cnf'   : '/etc/mysql/my.cnf'
498   priority   : 90000
499
500 local_2:
501   user     : 'root'
502   pass : 'blablablabla'
503   socket   : '/var/run/mysqld/mysqld.sock'
504   update_every : 1
505
506 remote:
507   user     : 'admin'
508   pass : 'bla'
509   host     : 'example.org'
510   port     : 9000
511   retries  : 20
512 ```
513
514 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`
515
516 ---
517
518 # nginx
519
520 This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote. 
521
522 **Requirements:**
523  * nginx with configured 'ngx_http_stub_status_module'
524  * 'location /stub_status'
525
526 Example nginx configuration can be found in 'python.d/nginx.conf'
527
528 It produces following charts:
529
530 1. **Active Connections**
531  * active
532
533 2. **Requests** in requests/s
534  * requests
535
536 3. **Active Connections by Status**
537  * reading
538  * writing
539  * waiting
540  
541 4. **Connections Rate** in connections/s
542  * accepts
543  * handled
544  
545 ### configuration
546
547 Needs only `url` to server's `stub_status`
548
549 Here is an example for local server:
550
551 ```yaml
552 update_every : 10
553 priority     : 90100
554
555 local:
556   url     : 'http://localhost/stub_status'
557   retries : 10
558 ```
559
560 Without configuration, module attempts to connect to `http://localhost/stub_status`
561
562 ---
563
564 # nginx_log
565
566 Module monitors nginx access log and produces only one chart:
567
568 1. **nginx status codes** in requests/s
569  * 2xx
570  * 3xx
571  * 4xx
572  * 5xx
573
574 ### configuration
575
576 Sample for two vhosts:
577
578 ```yaml
579 site_A:
580   path: '/var/log/nginx/access-A.log'
581
582 site_B:
583   name: 'local'
584   path: '/var/log/nginx/access-B.log'
585 ```
586
587 When no configuration file is found, module tries to parse `/var/log/nginx/access.log` file.
588
589 ---
590
591 # phpfpm
592
593 This module will monitor one or more php-fpm instances depending on configuration. 
594
595 **Requirements:**
596  * php-fpm with enabled `status` page
597  * access to `status` page via web server
598  
599 It produces following charts:
600
601 1. **Active Connections**
602  * active
603  * maxActive
604  * idle
605
606 2. **Requests** in requests/s
607  * requests
608  
609 3. **Performance**
610  * reached
611  * slow
612  
613 ### configuration
614
615 Needs only `url` to server's `status`
616  
617 Here is an example for local instance:
618
619 ```yaml
620 update_every : 3
621 priority     : 90100
622
623 local:
624   url     : 'http://localhost/status'
625   retries : 10
626 ```
627
628 Without configuration, module attempts to connect to `http://localhost/status`
629
630 ---
631
632 # postfix
633
634 Simple module executing `postfix -p` to grab postfix queue.
635
636 It produces only two charts:
637
638 1. **Postfix Queue Emails**
639  * emails
640  
641 2. **Postfix Queue Emails Size** in KB
642  * size
643
644 Configuration is not needed.
645
646 ---
647
648 # redis
649
650 Get INFO data from redis instance.
651
652 Following charts are drawn:
653
654 1. **Operations** per second
655  * operations
656
657 2. **Hit rate** in percent
658  * rate
659
660 3. **Memory utilization** in kilobytes
661  * total
662  * lua
663
664 4. **Database keys** 
665  * lines are creates dynamically based on how many databases are there
666  
667 5. **Clients**
668  * connected
669  * blocked
670  
671 6. **Slaves**
672  * connected
673  
674 ### configuration
675
676 ```yaml
677 socket:
678   name     : 'local'
679   socket   : '/var/lib/redis/redis.sock'
680
681 localhost:
682   name     : 'local'
683   host     : 'localhost'
684   port     : 6379
685 ```
686
687 When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
688
689 ---
690
691 # sensors
692
693 System sensors information.
694
695 Charts are created dynamically.
696
697 ### configuration
698
699 For detailed configuration information please read [`sensors.conf`](https://github.com/firehol/netdata/blob/master/conf.d/python.d/sensors.conf) file.
700
701 ---
702
703 # squid
704
705 This module will monitor one or more squid instances depending on configuration.
706
707 It produces following charts:
708
709 1. **Client Bandwidth** in kilobits/s
710  * in
711  * out
712  * hits
713
714 2. **Client Requests** in requests/s
715  * requests
716  * hits
717  * errors
718
719 3. **Server Bandwidth** in kilobits/s
720  * in
721  * out
722  
723 4. **Server Requests** in requests/s
724  * requests
725  * errors
726  
727 ### configuration
728
729 ```yaml
730 priority     : 50000
731
732 local:
733   request : 'cache_object://localhost:3128/counters'
734   host    : 'localhost'
735   port    : 3128
736 ```
737
738 Without any configuration module will try to autodetect where squid presents its `counters` data
739  
740 ---
741
742 # tomcat
743
744 Present tomcat containers memory utilization.
745
746 Charts:
747
748 1. **Requests** per second
749  * accesses
750
751 2. **Volume** in KB/s
752  * volume
753
754 3. **Threads**
755  * current
756  * busy
757  
758 4. **JVM Free Memory** in MB
759  * jvm
760  
761 ### configuration
762
763 ```yaml
764 localhost:
765   name : 'local'
766   url  : 'http://127.0.0.1:8080/manager/status?XML=true'
767   user : 'tomcat_username'
768   pass : 'secret_tomcat_password'
769 ```
770
771 Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials. 
772 So it will probably fail.
773
774 ---