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