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