]> arthur.barton.de Git - netdata.git/blob - python.d/README.md
Add health tracking for ipfs
[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 # hddtemp
416  
417 Module monitors disk temperatures from one or more hddtemp daemons.
418
419 **Requirement:**
420 Running `hddtemp` in daemonized mode with access on tcp port
421
422 It produces one chart **Temperature** with dynamic number of dimensions (one per disk)
423
424 ### configuration
425
426 Sample:
427
428 ```yaml
429 update_every: 3
430 host: "127.0.0.1"
431 port: 7634
432 ```
433
434 If no configuration is given, module will attempt to connect to hddtemp daemon on `127.0.0.1:7634` address
435
436 ---
437
438 # IPFS
439
440 Module monitors [IPFS](https://ipfs.io) basic information.
441
442 1. **Bandwidth** in kbits/s
443  * in
444  * out
445  
446 2. **Peers**
447  * peers
448  
449 ### configuration
450
451 Only url to IPFS server is needed. 
452
453 Sample:
454
455 ```yaml
456 localhost:
457   name : 'local'
458   url  : 'http://localhost:5001'
459 ```
460
461 ---
462
463 # isc_dhcpd
464
465 Module monitor leases database to show all active leases for given pools.
466
467 **Requirements:**
468  * dhcpd leases file MUST BE readable by netdata
469  * pools MUST BE in CIDR format
470
471 It produces:
472
473 1. **Pools utilization** Aggregate chart for all pools.
474  * utilization in percent
475
476 2. **Total leases**
477  * leases (overall number of leases for all pools)
478  
479 3. **Active leases** for every pools
480   * leases (number of active leases in pool)
481
482   
483 ### configuration
484
485 Sample:
486
487 ```yaml
488 local:
489   leases_path       : '/var/lib/dhcp/dhcpd.leases'
490   pools       : '192.168.3.0/24 192.168.4.0/24 192.168.5.0/24'
491 ```
492
493 In case of python2 you need to  install `py2-ipaddress` to make plugin work.
494 The module will not work If no configuration is given.
495
496 ---
497
498
499 # mdstat
500
501 Module monitor /proc/mdstat
502
503 It produces:
504
505 1. **Health** Number of failed disks in every array (aggregate chart).
506  
507 2. **Disks stats** 
508  * total (number of devices array ideally would have)
509  * inuse (number of devices currently are in use)
510
511 3. **Current status**
512  * resync in percent
513  * recovery in percent
514  * reshape in percent
515  * check in percent
516  
517 4. **Operation status** (if resync/recovery/reshape/check is active)
518  * finish in minutes
519  * speed in megabytes/s
520   
521 ### configuration
522 No configuration is needed.
523
524 ---
525
526 # memcached
527
528 Memcached monitoring module. Data grabbed from [stats interface](https://github.com/memcached/memcached/wiki/Commands#stats).
529
530 1. **Network** in kilobytes/s
531  * read
532  * written
533  
534 2. **Connections** per second
535  * current
536  * rejected
537  * total
538  
539 3. **Items** in cluster
540  * current
541  * total
542  
543 4. **Evicted and Reclaimed** items
544  * evicted
545  * reclaimed
546  
547 5. **GET** requests/s
548  * hits
549  * misses
550
551 6. **GET rate** rate in requests/s
552  * rate
553
554 7. **SET rate** rate in requests/s
555  * rate
556  
557 8. **DELETE** requests/s
558  * hits
559  * misses
560
561 9. **CAS** requests/s
562  * hits
563  * misses
564  * bad value
565  
566 10. **Increment** requests/s
567  * hits
568  * misses
569  
570 11. **Decrement** requests/s
571  * hits
572  * misses
573  
574 12. **Touch** requests/s
575  * hits
576  * misses
577  
578 13. **Touch rate** rate in requests/s
579  * rate
580  
581 ### configuration
582
583 Sample:
584
585 ```yaml
586 localtcpip:
587   name     : 'local'
588   host     : '127.0.0.1'
589   port     : 24242
590 ```
591
592 If no configuration is given, module will attempt to connect to memcached instance on `127.0.0.1:11211` address.
593
594 ---
595
596 # mysql
597
598 Module monitors one or more mysql servers
599
600 **Requirements:**
601  * python library [MySQLdb](https://github.com/PyMySQL/mysqlclient-python) (faster) or [PyMySQL](https://github.com/PyMySQL/PyMySQL) (slower)
602
603 It will produce following charts (if data is available):
604
605 1. **Bandwidth** in kbps
606  * in
607  * out
608
609 2. **Queries** in queries/sec
610  * queries
611  * questions
612  * slow queries
613
614 3. **Operations** in operations/sec
615  * opened tables
616  * flush
617  * commit
618  * delete
619  * prepare
620  * read first
621  * read key
622  * read next
623  * read prev
624  * read random
625  * read random next
626  * rollback
627  * save point
628  * update
629  * write
630
631 4. **Table Locks** in locks/sec
632  * immediate
633  * waited
634
635 5. **Select Issues** in issues/sec
636  * full join
637  * full range join
638  * range
639  * range check
640  * scan
641
642 6. **Sort Issues** in issues/sec
643  * merge passes
644  * range
645  * scan
646
647 ### configuration
648
649 You can provide, per server, the following:
650
651 1. username which have access to database (deafults to 'root')
652 2. password (defaults to none)
653 3. mysql my.cnf configuration file
654 4. mysql socket (optional)
655 5. mysql host (ip or hostname)
656 6. mysql port (defaults to 3306)
657
658 Here is an example for 3 servers:
659
660 ```yaml
661 update_every : 10
662 priority     : 90100
663 retries      : 5
664
665 local:
666   'my.cnf'   : '/etc/mysql/my.cnf'
667   priority   : 90000
668
669 local_2:
670   user     : 'root'
671   pass : 'blablablabla'
672   socket   : '/var/run/mysqld/mysqld.sock'
673   update_every : 1
674
675 remote:
676   user     : 'admin'
677   pass : 'bla'
678   host     : 'example.org'
679   port     : 9000
680   retries  : 20
681 ```
682
683 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`
684
685 ---
686
687 # nginx
688
689 This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote. 
690
691 **Requirements:**
692  * nginx with configured 'ngx_http_stub_status_module'
693  * 'location /stub_status'
694
695 Example nginx configuration can be found in 'python.d/nginx.conf'
696
697 It produces following charts:
698
699 1. **Active Connections**
700  * active
701
702 2. **Requests** in requests/s
703  * requests
704
705 3. **Active Connections by Status**
706  * reading
707  * writing
708  * waiting
709  
710 4. **Connections Rate** in connections/s
711  * accepts
712  * handled
713  
714 ### configuration
715
716 Needs only `url` to server's `stub_status`
717
718 Here is an example for local server:
719
720 ```yaml
721 update_every : 10
722 priority     : 90100
723
724 local:
725   url     : 'http://localhost/stub_status'
726   retries : 10
727 ```
728
729 Without configuration, module attempts to connect to `http://localhost/stub_status`
730
731 ---
732
733 # nginx_log
734
735 Module monitors nginx access log and produces only one chart:
736
737 1. **nginx status codes** in requests/s
738  * 2xx
739  * 3xx
740  * 4xx
741  * 5xx
742
743 ### configuration
744
745 Sample for two vhosts:
746
747 ```yaml
748 site_A:
749   path: '/var/log/nginx/access-A.log'
750
751 site_B:
752   name: 'local'
753   path: '/var/log/nginx/access-B.log'
754 ```
755
756 When no configuration file is found, module tries to parse `/var/log/nginx/access.log` file.
757
758 ---
759
760 # ovpn_status_log
761
762 Module monitor openvpn-status log file. 
763
764 **Requirements:**
765
766  * If you are running multiple OpenVPN instances out of the same directory, MAKE SURE TO EDIT DIRECTIVES which create output files
767  so that multiple instances do not overwrite each other's output files.
768
769  * Make sure NETDATA USER CAN READ openvpn-status.log
770
771  * Update_every interval MUST MATCH interval on which OpenVPN writes operational status to log file.
772  
773 It produces:
774
775 1. **Users** OpenVPN active users
776  * users
777  
778 2. **Traffic** OpenVPN overall bandwidth usage in kilobit/s
779  * in
780  * out
781  
782 ### configuration
783
784 Sample:
785
786 ```yaml
787 default
788  log_path     : '/var/log/openvpn-status.log'
789 ```
790
791 ---
792
793 # phpfpm
794
795 This module will monitor one or more php-fpm instances depending on configuration. 
796
797 **Requirements:**
798  * php-fpm with enabled `status` page
799  * access to `status` page via web server
800  
801 It produces following charts:
802
803 1. **Active Connections**
804  * active
805  * maxActive
806  * idle
807
808 2. **Requests** in requests/s
809  * requests
810  
811 3. **Performance**
812  * reached
813  * slow
814  
815 ### configuration
816
817 Needs only `url` to server's `status`
818  
819 Here is an example for local instance:
820
821 ```yaml
822 update_every : 3
823 priority     : 90100
824
825 local:
826   url     : 'http://localhost/status'
827   retries : 10
828 ```
829
830 Without configuration, module attempts to connect to `http://localhost/status`
831
832 ---
833
834 # postfix
835
836 Simple module executing `postfix -p` to grab postfix queue.
837
838 It produces only two charts:
839
840 1. **Postfix Queue Emails**
841  * emails
842  
843 2. **Postfix Queue Emails Size** in KB
844  * size
845
846 Configuration is not needed.
847
848 ---
849
850 # redis
851
852 Get INFO data from redis instance.
853
854 Following charts are drawn:
855
856 1. **Operations** per second
857  * operations
858
859 2. **Hit rate** in percent
860  * rate
861
862 3. **Memory utilization** in kilobytes
863  * total
864  * lua
865
866 4. **Database keys** 
867  * lines are creates dynamically based on how many databases are there
868  
869 5. **Clients**
870  * connected
871  * blocked
872  
873 6. **Slaves**
874  * connected
875  
876 ### configuration
877
878 ```yaml
879 socket:
880   name     : 'local'
881   socket   : '/var/lib/redis/redis.sock'
882
883 localhost:
884   name     : 'local'
885   host     : 'localhost'
886   port     : 6379
887 ```
888
889 When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
890
891 ---
892
893 # sensors
894
895 System sensors information.
896
897 Charts are created dynamically.
898
899 ### configuration
900
901 For detailed configuration information please read [`sensors.conf`](https://github.com/firehol/netdata/blob/master/conf.d/python.d/sensors.conf) file.
902
903 ---
904
905 # squid
906
907 This module will monitor one or more squid instances depending on configuration.
908
909 It produces following charts:
910
911 1. **Client Bandwidth** in kilobits/s
912  * in
913  * out
914  * hits
915
916 2. **Client Requests** in requests/s
917  * requests
918  * hits
919  * errors
920
921 3. **Server Bandwidth** in kilobits/s
922  * in
923  * out
924  
925 4. **Server Requests** in requests/s
926  * requests
927  * errors
928  
929 ### configuration
930
931 ```yaml
932 priority     : 50000
933
934 local:
935   request : 'cache_object://localhost:3128/counters'
936   host    : 'localhost'
937   port    : 3128
938 ```
939
940 Without any configuration module will try to autodetect where squid presents its `counters` data
941  
942 ---
943
944 # tomcat
945
946 Present tomcat containers memory utilization.
947
948 Charts:
949
950 1. **Requests** per second
951  * accesses
952
953 2. **Volume** in KB/s
954  * volume
955
956 3. **Threads**
957  * current
958  * busy
959  
960 4. **JVM Free Memory** in MB
961  * jvm
962  
963 ### configuration
964
965 ```yaml
966 localhost:
967   name : 'local'
968   url  : 'http://127.0.0.1:8080/manager/status?XML=true'
969   user : 'tomcat_username'
970   pass : 'secret_tomcat_password'
971 ```
972
973 Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials. 
974 So it will probably fail.
975
976 ---