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