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