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