]> arthur.barton.de Git - netdata.git/blob - python.d/README.md
update README in python.d dir
[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 # freeradius
239
240 Uses the `radclient` command to provide freeradius statistics. It is not recommended to run it every second.
241
242 It produces:
243
244 1. **Authentication counters:**
245  * access-accepts
246  * access-rejects
247  * auth-dropped-requests
248  * auth-duplicate-requests
249  * auth-invalid-requests
250  * auth-malformed-requests
251  * auth-unknown-types
252
253 2. **Accounting counters:** [optional]
254  * accounting-requests
255  * accounting-responses
256  * acct-dropped-requests
257  * acct-duplicate-requests
258  * acct-invalid-requests
259  * acct-malformed-requests
260  * acct-unknown-types
261
262 3. **Proxy authentication counters:** [optional]
263  * proxy-access-accepts
264  * proxy-access-rejects
265  * proxy-auth-dropped-requests
266  * proxy-auth-duplicate-requests
267  * proxy-auth-invalid-requests
268  * proxy-auth-malformed-requests
269  * proxy-auth-unknown-types
270
271 4. **Proxy accounting counters:** [optional]
272  * proxy-accounting-requests
273  * proxy-accounting-responses
274  * proxy-acct-dropped-requests
275  * proxy-acct-duplicate-requests
276  * proxy-acct-invalid-requests
277  * proxy-acct-malformed-requests
278  * proxy-acct-unknown-typesa
279
280 ```yaml
281 local:
282   host       : 'localhost'
283   port       : '18121'
284   secret     : 'adminsecret'
285   acct       : False # Freeradius accounting statistics.
286   proxy_auth : False # Freeradius proxy authentication statistics. 
287   proxy_acct : False # Freeradius proxy accounting statistics.
288 ```
289
290 ### configuration
291
292 **Freeradius server configuration:**
293 The configuration for the status server is automatically created in the sites-available directory.
294 By default, server is enabled and can be queried from every client. 
295 FreeRADIUS will only respond to status-server messages, if the status-server virtual server has been enabled.
296 To do this, create a link from the sites-enabled directory to the status file in the sites-available directory:
297    #*cd sites-enabled*
298    #*ln -s ../sites-available/status status*
299 and restart/reload your FREERADIUS server.
300
301 ---
302
303 # hddtemp
304  
305 Module monitors disk temperatures from one or more hddtemp daemons.
306
307 **Requirement:**
308 Running `hddtemp` in daemonized mode with access on tcp port
309
310 It produces one chart **Temperature** with dynamic number of dimensions (one per disk)
311
312 ### configuration
313
314 Sample:
315
316 ```yaml
317 update_every: 3
318 host: "127.0.0.1"
319 port: 7634
320 ```
321
322 If no configuration is given, module will attempt to connect to hddtemp daemon on `127.0.0.1:7634` address
323
324 ---
325
326 # IPFS
327
328 Module monitors [IPFS](https://ipfs.io) basic information.
329
330 1. **Bandwidth** in kbits/s
331  * in
332  * out
333  
334 2. **Peers**
335  * peers
336  
337 ### configuration
338
339 Only url to IPFS server is needed. 
340
341 Sample:
342
343 ```yaml
344 localhost:
345   name : 'local'
346   url  : 'http://localhost:5001'
347 ```
348
349 ---
350
351 # memcached
352
353 Memcached monitoring module. Data grabbed from [stats interface](https://github.com/memcached/memcached/wiki/Commands#stats).
354
355 1. **Network** in kilobytes/s
356  * read
357  * written
358  
359 2. **Connections** per second
360  * current
361  * rejected
362  * total
363  
364 3. **Items** in cluster
365  * current
366  * total
367  
368 4. **Evicted and Reclaimed** items
369  * evicted
370  * reclaimed
371  
372 5. **GET** requests/s
373  * hits
374  * misses
375
376 6. **GET rate** rate in requests/s
377  * rate
378
379 7. **SET rate** rate in requests/s
380  * rate
381  
382 8. **DELETE** requests/s
383  * hits
384  * misses
385
386 9. **CAS** requests/s
387  * hits
388  * misses
389  * bad value
390  
391 10. **Increment** requests/s
392  * hits
393  * misses
394  
395 11. **Decrement** requests/s
396  * hits
397  * misses
398  
399 12. **Touch** requests/s
400  * hits
401  * misses
402  
403 13. **Touch rate** rate in requests/s
404  * rate
405  
406 ### configuration
407
408 Sample:
409
410 ```yaml
411 localtcpip:
412   name     : 'local'
413   host     : '127.0.0.1'
414   port     : 24242
415 ```
416
417 If no configuration is given, module will attempt to connect to memcached instance on `127.0.0.1:11211` address.
418
419 ---
420
421 # mysql
422
423 Module monitors one or more mysql servers
424
425 **Requirements:**
426  * python library [MySQLdb](https://github.com/PyMySQL/mysqlclient-python) (faster) or [PyMySQL](https://github.com/PyMySQL/PyMySQL) (slower)
427
428 It will produce following charts (if data is available):
429
430 1. **Bandwidth** in kbps
431  * in
432  * out
433
434 2. **Queries** in queries/sec
435  * queries
436  * questions
437  * slow queries
438
439 3. **Operations** in operations/sec
440  * opened tables
441  * flush
442  * commit
443  * delete
444  * prepare
445  * read first
446  * read key
447  * read next
448  * read prev
449  * read random
450  * read random next
451  * rollback
452  * save point
453  * update
454  * write
455
456 4. **Table Locks** in locks/sec
457  * immediate
458  * waited
459
460 5. **Select Issues** in issues/sec
461  * full join
462  * full range join
463  * range
464  * range check
465  * scan
466
467 6. **Sort Issues** in issues/sec
468  * merge passes
469  * range
470  * scan
471
472 ### configuration
473
474 You can provide, per server, the following:
475
476 1. username which have access to database (deafults to 'root')
477 2. password (defaults to none)
478 3. mysql my.cnf configuration file
479 4. mysql socket (optional)
480 5. mysql host (ip or hostname)
481 6. mysql port (defaults to 3306)
482
483 Here is an example for 3 servers:
484
485 ```yaml
486 update_every : 10
487 priority     : 90100
488 retries      : 5
489
490 local:
491   'my.cnf'   : '/etc/mysql/my.cnf'
492   priority   : 90000
493
494 local_2:
495   user     : 'root'
496   pass : 'blablablabla'
497   socket   : '/var/run/mysqld/mysqld.sock'
498   update_every : 1
499
500 remote:
501   user     : 'admin'
502   pass : 'bla'
503   host     : 'example.org'
504   port     : 9000
505   retries  : 20
506 ```
507
508 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`
509
510 ---
511
512 # nginx
513
514 This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote. 
515
516 **Requirements:**
517  * nginx with configured 'ngx_http_stub_status_module'
518  * 'location /stub_status'
519
520 Example nginx configuration can be found in 'python.d/nginx.conf'
521
522 It produces following charts:
523
524 1. **Active Connections**
525  * active
526
527 2. **Requests** in requests/s
528  * requests
529
530 3. **Active Connections by Status**
531  * reading
532  * writing
533  * waiting
534  
535 4. **Connections Rate** in connections/s
536  * accepts
537  * handled
538  
539 ### configuration
540
541 Needs only `url` to server's `stub_status`
542
543 Here is an example for local server:
544
545 ```yaml
546 update_every : 10
547 priority     : 90100
548
549 local:
550   url     : 'http://localhost/stub_status'
551   retries : 10
552 ```
553
554 Without configuration, module attempts to connect to `http://localhost/stub_status`
555
556 ---
557
558 # nginx_log
559
560 Module monitors nginx access log and produces only one chart:
561
562 1. **nginx status codes** in requests/s
563  * 2xx
564  * 3xx
565  * 4xx
566  * 5xx
567
568 ### configuration
569
570 Sample for two vhosts:
571
572 ```yaml
573 site_A:
574   path: '/var/log/nginx/access-A.log'
575
576 site_B:
577   name: 'local'
578   path: '/var/log/nginx/access-B.log'
579 ```
580
581 When no configuration file is found, module tries to parse `/var/log/nginx/access.log` file.
582
583 ---
584
585 # phpfpm
586
587 This module will monitor one or more php-fpm instances depending on configuration. 
588
589 **Requirements:**
590  * php-fpm with enabled `status` page
591  * access to `status` page via web server
592  
593 It produces following charts:
594
595 1. **Active Connections**
596  * active
597  * maxActive
598  * idle
599
600 2. **Requests** in requests/s
601  * requests
602  
603 3. **Performance**
604  * reached
605  * slow
606  
607 ### configuration
608
609 Needs only `url` to server's `status`
610  
611 Here is an example for local instance:
612
613 ```yaml
614 update_every : 3
615 priority     : 90100
616
617 local:
618   url     : 'http://localhost/status'
619   retries : 10
620 ```
621
622 Without configuration, module attempts to connect to `http://localhost/status`
623
624 ---
625
626 # postfix
627
628 Simple module executing `postfix -p` to grab postfix queue.
629
630 It produces only two charts:
631
632 1. **Postfix Queue Emails**
633  * emails
634  
635 2. **Postfix Queue Emails Size** in KB
636  * size
637
638 Configuration is not needed.
639
640 ---
641
642 # redis
643
644 Get INFO data from redis instance.
645
646 Following charts are drawn:
647
648 1. **Operations** per second
649  * operations
650
651 2. **Hit rate** in percent
652  * rate
653
654 3. **Memory utilization** in kilobytes
655  * total
656  * lua
657
658 4. **Database keys** 
659  * lines are creates dynamically based on how many databases are there
660  
661 5. **Clients**
662  * connected
663  * blocked
664  
665 6. **Slaves**
666  * connected
667  
668 ### configuration
669
670 ```yaml
671 socket:
672   name     : 'local'
673   socket   : '/var/lib/redis/redis.sock'
674
675 localhost:
676   name     : 'local'
677   host     : 'localhost'
678   port     : 6379
679 ```
680
681 When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
682
683 ---
684
685 # sensors
686
687 System sensors information.
688
689 Charts are created dynamically.
690
691 ### configuration
692
693 For detailed configuration information please read [`sensors.conf`](https://github.com/firehol/netdata/blob/master/conf.d/python.d/sensors.conf) file.
694
695 ---
696
697 # squid
698
699 This module will monitor one or more squid instances depending on configuration.
700
701 It produces following charts:
702
703 1. **Client Bandwidth** in kilobits/s
704  * in
705  * out
706  * hits
707
708 2. **Client Requests** in requests/s
709  * requests
710  * hits
711  * errors
712
713 3. **Server Bandwidth** in kilobits/s
714  * in
715  * out
716  
717 4. **Server Requests** in requests/s
718  * requests
719  * errors
720  
721 ### configuration
722
723 ```yaml
724 priority     : 50000
725
726 local:
727   request : 'cache_object://localhost:3128/counters'
728   host    : 'localhost'
729   port    : 3128
730 ```
731
732 Without any configuration module will try to autodetect where squid presents its `counters` data
733  
734 ---
735
736 # tomcat
737
738 Present tomcat containers memory utilization.
739
740 Charts:
741
742 1. **Requests** per second
743  * accesses
744
745 2. **Volume** in KB/s
746  * volume
747
748 3. **Threads**
749  * current
750  * busy
751  
752 4. **JVM Free Memory** in MB
753  * jvm
754  
755 ### configuration
756
757 ```yaml
758 localhost:
759   name : 'local'
760   url  : 'http://127.0.0.1:8080/manager/status?XML=true'
761   user : 'tomcat_username'
762   pass : 'secret_tomcat_password'
763 ```
764
765 Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials. 
766 So it will probably fail.
767
768 ---