]> arthur.barton.de Git - netdata.git/blob - python.d/README.md
Merge pull request #1520 from ktsaou/master
[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 # bind_rndc
129
130 Module parses bind dump file to collect real-time performance metrics
131
132 **Requirements:**
133  * Version of bind must be 9.6 +
134  * Netdata must have permissions to run `rndc status`
135
136 It produces:
137
138 1. **Name server statistics**
139  * requests
140  * responses
141  * success
142  * auth_answer
143  * nonauth_answer
144  * nxrrset
145  * failure
146  * nxdomain
147  * recursion
148  * duplicate
149  * rejections
150  
151 2. **Incoming queries**
152  * RESERVED0
153  * A
154  * NS
155  * CNAME
156  * SOA
157  * PTR
158  * MX
159  * TXT
160  * X25
161  * AAAA
162  * SRV
163  * NAPTR
164  * A6
165  * DS
166  * RSIG
167  * DNSKEY
168  * SPF
169  * ANY
170  * DLV
171  
172 3. **Outgoing queries**
173  * Same as Incoming queries
174
175
176 ### configuration
177
178 Sample:
179
180 ```yaml
181 local:
182   named_stats_path       : '/var/log/bind/named.stats'
183 ```
184
185 If no configuration is given, module will attempt to read named.stats file  at `/var/log/bind/named.stats`
186
187 ---
188
189
190 # cpufreq
191
192 Module shows current cpu frequency by looking at appropriate files in /sys/devices
193
194 **Requirement:**
195 Processor which presents data scaling frequency data
196
197 It produces one chart with multiple lines (one line per core).
198
199 ### configuration
200
201 Sample:
202
203 ```yaml
204 sys_dir: "/sys/devices"
205 ```
206
207 If no configuration is given, module will search for `scaling_cur_freq` files in `/sys/devices` directory.
208 Directory is also prefixed with `NETDATA_HOST_PREFIX` if specified.
209
210 ---
211
212 # dovecot
213
214 This module provides statistics information from dovecot server. 
215 Statistics are taken from dovecot socket by executing `EXPORT global` command.
216 More information about dovecot stats can be found on [project wiki page.](http://wiki2.dovecot.org/Statistics)
217
218 **Requirement:**
219 Dovecot unix socket with R/W permissions for user netdata or dovecot with configured TCP/IP socket.
220  
221 Module gives information with following charts:
222
223 1. **sessions**
224  * active sessions
225
226 2. **logins**
227  * logins
228
229 3. **commands** - number of IMAP commands 
230  * commands
231  
232 4. **Faults**
233  * minor
234  * major
235  
236 5. **Context Switches** 
237  * volountary
238  * involountary
239  
240 6. **disk** in bytes/s
241  * read
242  * write
243  
244 7. **bytes** in bytes/s
245  * read
246  * write
247  
248 8. **number of syscalls** in syscalls/s
249  * read
250  * write
251
252 9. **lookups** - number of lookups per second
253  * path
254  * attr
255
256 10. **hits** - number of cache hits 
257  * hits
258
259 11. **attempts** - authorization attemts
260  * success
261  * failure
262
263 12. **cache** - cached authorization hits
264  * hit
265  * miss
266  
267 ### configuration
268
269 Sample:
270
271 ```yaml
272 localtcpip:
273   name     : 'local'
274   host     : '127.0.0.1'
275   port     : 24242
276
277 localsocket:
278   name     : 'local'
279   socket   : '/var/run/dovecot/stats'
280 ```
281
282 If no configuration is given, module will attempt to connect to dovecot using unix socket localized in `/var/run/dovecot/stats`
283
284 ---
285
286 # exim
287
288 Simple module executing `exim -bpc` to grab exim queue. 
289 This command can take a lot of time to finish its execution thus it is not recommended to run it every second.
290
291 It produces only one chart:
292
293 1. **Exim Queue Emails**
294  * emails
295
296 Configuration is not needed.
297
298 ---
299
300 # fail2ban
301
302 Module monitor fail2ban log file to show all bans for all active jails 
303
304 **Requirements:**
305  * fail2ban.log file MUST BE readable by netdata (A good idea is to add  **create 0640 root netdata** to fail2ban conf at logrotate.d)
306  
307 It produces one chart with multiple lines (one line per jail)
308  
309 ### configuration
310
311 Sample:
312
313 ```yaml
314 local:
315  log_path: '/var/log/fail2ban.log'
316  conf_path: '/etc/fail2ban/jail.local'
317  exclude: 'dropbear apache'
318 ```
319 If no configuration is given, module will attempt to read log file at `/var/log/fail2ban.log` and conf file at `/etc/fail2ban/jail.local`.
320 If conf file is not found default jail is `ssh`.
321
322 ---
323
324 # freeradius
325
326 Uses the `radclient` command to provide freeradius statistics. It is not recommended to run it every second.
327
328 It produces:
329
330 1. **Authentication counters:**
331  * access-accepts
332  * access-rejects
333  * auth-dropped-requests
334  * auth-duplicate-requests
335  * auth-invalid-requests
336  * auth-malformed-requests
337  * auth-unknown-types
338
339 2. **Accounting counters:** [optional]
340  * accounting-requests
341  * accounting-responses
342  * acct-dropped-requests
343  * acct-duplicate-requests
344  * acct-invalid-requests
345  * acct-malformed-requests
346  * acct-unknown-types
347
348 3. **Proxy authentication counters:** [optional]
349  * proxy-access-accepts
350  * proxy-access-rejects
351  * proxy-auth-dropped-requests
352  * proxy-auth-duplicate-requests
353  * proxy-auth-invalid-requests
354  * proxy-auth-malformed-requests
355  * proxy-auth-unknown-types
356
357 4. **Proxy accounting counters:** [optional]
358  * proxy-accounting-requests
359  * proxy-accounting-responses
360  * proxy-acct-dropped-requests
361  * proxy-acct-duplicate-requests
362  * proxy-acct-invalid-requests
363  * proxy-acct-malformed-requests
364  * proxy-acct-unknown-typesa
365
366
367 ### configuration
368
369 Sample:
370
371 ```yaml
372 local:
373   host       : 'localhost'
374   port       : '18121'
375   secret     : 'adminsecret'
376   acct       : False # Freeradius accounting statistics.
377   proxy_auth : False # Freeradius proxy authentication statistics. 
378   proxy_acct : False # Freeradius proxy accounting statistics.
379 ```
380
381 **Freeradius server configuration:**
382
383 The configuration for the status server is automatically created in the sites-available directory.
384 By default, server is enabled and can be queried from every client. 
385 FreeRADIUS will only respond to status-server messages, if the status-server virtual server has been enabled.
386
387 To do this, create a link from the sites-enabled directory to the status file in the sites-available directory:
388  * cd sites-enabled
389  * ln -s ../sites-available/status status
390
391 and restart/reload your FREERADIUS server.
392
393 ---
394
395 # hddtemp
396  
397 Module monitors disk temperatures from one or more hddtemp daemons.
398
399 **Requirement:**
400 Running `hddtemp` in daemonized mode with access on tcp port
401
402 It produces one chart **Temperature** with dynamic number of dimensions (one per disk)
403
404 ### configuration
405
406 Sample:
407
408 ```yaml
409 update_every: 3
410 host: "127.0.0.1"
411 port: 7634
412 ```
413
414 If no configuration is given, module will attempt to connect to hddtemp daemon on `127.0.0.1:7634` address
415
416 ---
417
418 # IPFS
419
420 Module monitors [IPFS](https://ipfs.io) basic information.
421
422 1. **Bandwidth** in kbits/s
423  * in
424  * out
425  
426 2. **Peers**
427  * peers
428  
429 ### configuration
430
431 Only url to IPFS server is needed. 
432
433 Sample:
434
435 ```yaml
436 localhost:
437   name : 'local'
438   url  : 'http://localhost:5001'
439 ```
440
441 ---
442
443 # isc_dhcpd
444
445 Module monitor leases database to show all active leases for given pools.
446
447 **Requirements:**
448  * dhcpd leases file MUST BE readable by netdata
449  * pools MUST BE in CIDR format
450
451 It produces:
452
453 1. **Pools utilization** Aggregate chart for all pools.
454  * utilization in percent
455
456 2. **Total leases**
457  * leases (overall number of leases for all pools)
458  
459 3. **Active leases** for every pools
460   * leases (number of active leases in pool)
461
462   
463 ### configuration
464
465 Sample:
466
467 ```yaml
468 local:
469   leases_path       : '/var/lib/dhcp/dhcpd.leases'
470   pools       : '192.168.3.0/24 192.168.4.0/24 192.168.5.0/24'
471 ```
472
473 In case of python2 you need to  install `py2-ipaddress` to make plugin work.
474 The module will not work If no configuration is given.
475
476 ---
477
478
479 # mdstat
480
481 Module monitor /proc/mdstat
482
483 It produces:
484
485 1. **Health** Number of failed disks in every array (aggregate chart).
486  
487 2. **Disks stats** 
488  * total (number of devices array ideally would have)
489  * inuse (number of devices currently are in use)
490
491 3. **Current status**
492  * resync in percent
493  * recovery in percent
494  * reshape in percent
495  * check in percent
496  
497 4. **Operation status** (if resync/recovery/reshape/check is active)
498  * finish in minutes
499  * speed in megabytes/s
500   
501 ### configuration
502 No configuration is needed.
503
504 ---
505
506 # memcached
507
508 Memcached monitoring module. Data grabbed from [stats interface](https://github.com/memcached/memcached/wiki/Commands#stats).
509
510 1. **Network** in kilobytes/s
511  * read
512  * written
513  
514 2. **Connections** per second
515  * current
516  * rejected
517  * total
518  
519 3. **Items** in cluster
520  * current
521  * total
522  
523 4. **Evicted and Reclaimed** items
524  * evicted
525  * reclaimed
526  
527 5. **GET** requests/s
528  * hits
529  * misses
530
531 6. **GET rate** rate in requests/s
532  * rate
533
534 7. **SET rate** rate in requests/s
535  * rate
536  
537 8. **DELETE** requests/s
538  * hits
539  * misses
540
541 9. **CAS** requests/s
542  * hits
543  * misses
544  * bad value
545  
546 10. **Increment** requests/s
547  * hits
548  * misses
549  
550 11. **Decrement** requests/s
551  * hits
552  * misses
553  
554 12. **Touch** requests/s
555  * hits
556  * misses
557  
558 13. **Touch rate** rate in requests/s
559  * rate
560  
561 ### configuration
562
563 Sample:
564
565 ```yaml
566 localtcpip:
567   name     : 'local'
568   host     : '127.0.0.1'
569   port     : 24242
570 ```
571
572 If no configuration is given, module will attempt to connect to memcached instance on `127.0.0.1:11211` address.
573
574 ---
575
576 # mysql
577
578 Module monitors one or more mysql servers
579
580 **Requirements:**
581  * python library [MySQLdb](https://github.com/PyMySQL/mysqlclient-python) (faster) or [PyMySQL](https://github.com/PyMySQL/PyMySQL) (slower)
582
583 It will produce following charts (if data is available):
584
585 1. **Bandwidth** in kbps
586  * in
587  * out
588
589 2. **Queries** in queries/sec
590  * queries
591  * questions
592  * slow queries
593
594 3. **Operations** in operations/sec
595  * opened tables
596  * flush
597  * commit
598  * delete
599  * prepare
600  * read first
601  * read key
602  * read next
603  * read prev
604  * read random
605  * read random next
606  * rollback
607  * save point
608  * update
609  * write
610
611 4. **Table Locks** in locks/sec
612  * immediate
613  * waited
614
615 5. **Select Issues** in issues/sec
616  * full join
617  * full range join
618  * range
619  * range check
620  * scan
621
622 6. **Sort Issues** in issues/sec
623  * merge passes
624  * range
625  * scan
626
627 ### configuration
628
629 You can provide, per server, the following:
630
631 1. username which have access to database (deafults to 'root')
632 2. password (defaults to none)
633 3. mysql my.cnf configuration file
634 4. mysql socket (optional)
635 5. mysql host (ip or hostname)
636 6. mysql port (defaults to 3306)
637
638 Here is an example for 3 servers:
639
640 ```yaml
641 update_every : 10
642 priority     : 90100
643 retries      : 5
644
645 local:
646   'my.cnf'   : '/etc/mysql/my.cnf'
647   priority   : 90000
648
649 local_2:
650   user     : 'root'
651   pass : 'blablablabla'
652   socket   : '/var/run/mysqld/mysqld.sock'
653   update_every : 1
654
655 remote:
656   user     : 'admin'
657   pass : 'bla'
658   host     : 'example.org'
659   port     : 9000
660   retries  : 20
661 ```
662
663 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`
664
665 ---
666
667 # nginx
668
669 This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote. 
670
671 **Requirements:**
672  * nginx with configured 'ngx_http_stub_status_module'
673  * 'location /stub_status'
674
675 Example nginx configuration can be found in 'python.d/nginx.conf'
676
677 It produces following charts:
678
679 1. **Active Connections**
680  * active
681
682 2. **Requests** in requests/s
683  * requests
684
685 3. **Active Connections by Status**
686  * reading
687  * writing
688  * waiting
689  
690 4. **Connections Rate** in connections/s
691  * accepts
692  * handled
693  
694 ### configuration
695
696 Needs only `url` to server's `stub_status`
697
698 Here is an example for local server:
699
700 ```yaml
701 update_every : 10
702 priority     : 90100
703
704 local:
705   url     : 'http://localhost/stub_status'
706   retries : 10
707 ```
708
709 Without configuration, module attempts to connect to `http://localhost/stub_status`
710
711 ---
712
713 # nginx_log
714
715 Module monitors nginx access log and produces only one chart:
716
717 1. **nginx status codes** in requests/s
718  * 2xx
719  * 3xx
720  * 4xx
721  * 5xx
722
723 ### configuration
724
725 Sample for two vhosts:
726
727 ```yaml
728 site_A:
729   path: '/var/log/nginx/access-A.log'
730
731 site_B:
732   name: 'local'
733   path: '/var/log/nginx/access-B.log'
734 ```
735
736 When no configuration file is found, module tries to parse `/var/log/nginx/access.log` file.
737
738 ---
739
740 # ovpn_status_log
741
742 Module monitor openvpn-status log file. 
743
744 **Requirements:**
745
746  * If you are running multiple OpenVPN instances out of the same directory, MAKE SURE TO EDIT DIRECTIVES which create output files
747  so that multiple instances do not overwrite each other's output files.
748
749  * Make sure NETDATA USER CAN READ openvpn-status.log
750
751  * Update_every interval MUST MATCH interval on which OpenVPN writes operational status to log file.
752  
753 It produces:
754
755 1. **Users** OpenVPN active users
756  * users
757  
758 2. **Traffic** OpenVPN overall bandwidth usage in kilobit/s
759  * in
760  * out
761  
762 ### configuration
763
764 Sample:
765
766 ```yaml
767 default
768  log_path     : '/var/log/openvpn-status.log'
769 ```
770
771 ---
772
773 # phpfpm
774
775 This module will monitor one or more php-fpm instances depending on configuration. 
776
777 **Requirements:**
778  * php-fpm with enabled `status` page
779  * access to `status` page via web server
780  
781 It produces following charts:
782
783 1. **Active Connections**
784  * active
785  * maxActive
786  * idle
787
788 2. **Requests** in requests/s
789  * requests
790  
791 3. **Performance**
792  * reached
793  * slow
794  
795 ### configuration
796
797 Needs only `url` to server's `status`
798  
799 Here is an example for local instance:
800
801 ```yaml
802 update_every : 3
803 priority     : 90100
804
805 local:
806   url     : 'http://localhost/status'
807   retries : 10
808 ```
809
810 Without configuration, module attempts to connect to `http://localhost/status`
811
812 ---
813
814 # postfix
815
816 Simple module executing `postfix -p` to grab postfix queue.
817
818 It produces only two charts:
819
820 1. **Postfix Queue Emails**
821  * emails
822  
823 2. **Postfix Queue Emails Size** in KB
824  * size
825
826 Configuration is not needed.
827
828 ---
829
830 # redis
831
832 Get INFO data from redis instance.
833
834 Following charts are drawn:
835
836 1. **Operations** per second
837  * operations
838
839 2. **Hit rate** in percent
840  * rate
841
842 3. **Memory utilization** in kilobytes
843  * total
844  * lua
845
846 4. **Database keys** 
847  * lines are creates dynamically based on how many databases are there
848  
849 5. **Clients**
850  * connected
851  * blocked
852  
853 6. **Slaves**
854  * connected
855  
856 ### configuration
857
858 ```yaml
859 socket:
860   name     : 'local'
861   socket   : '/var/lib/redis/redis.sock'
862
863 localhost:
864   name     : 'local'
865   host     : 'localhost'
866   port     : 6379
867 ```
868
869 When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
870
871 ---
872
873 # sensors
874
875 System sensors information.
876
877 Charts are created dynamically.
878
879 ### configuration
880
881 For detailed configuration information please read [`sensors.conf`](https://github.com/firehol/netdata/blob/master/conf.d/python.d/sensors.conf) file.
882
883 ---
884
885 # squid
886
887 This module will monitor one or more squid instances depending on configuration.
888
889 It produces following charts:
890
891 1. **Client Bandwidth** in kilobits/s
892  * in
893  * out
894  * hits
895
896 2. **Client Requests** in requests/s
897  * requests
898  * hits
899  * errors
900
901 3. **Server Bandwidth** in kilobits/s
902  * in
903  * out
904  
905 4. **Server Requests** in requests/s
906  * requests
907  * errors
908  
909 ### configuration
910
911 ```yaml
912 priority     : 50000
913
914 local:
915   request : 'cache_object://localhost:3128/counters'
916   host    : 'localhost'
917   port    : 3128
918 ```
919
920 Without any configuration module will try to autodetect where squid presents its `counters` data
921  
922 ---
923
924 # tomcat
925
926 Present tomcat containers memory utilization.
927
928 Charts:
929
930 1. **Requests** per second
931  * accesses
932
933 2. **Volume** in KB/s
934  * volume
935
936 3. **Threads**
937  * current
938  * busy
939  
940 4. **JVM Free Memory** in MB
941  * jvm
942  
943 ### configuration
944
945 ```yaml
946 localhost:
947   name : 'local'
948   url  : 'http://127.0.0.1:8080/manager/status?XML=true'
949   user : 'tomcat_username'
950   pass : 'secret_tomcat_password'
951 ```
952
953 Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials. 
954 So it will probably fail.
955
956 ---