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