]> arthur.barton.de Git - netdata.git/blob - python.d/README.md
Merge pull request #998 from shadycuz/master
[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 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. **logins and sessions**
162  * logins
163  * active sessions
164
165 2. **commands** - number of IMAP commands 
166  * commands
167  
168 3. **Faults**
169  * minor
170  * major
171  
172 4. **Context Switches** 
173  * volountary
174  * involountary
175  
176 5. **disk** in bytes/s
177  * read
178  * write
179  
180 6. **bytes** in bytes/s
181  * read
182  * write
183  
184 7. **number of syscalls** in syscalls/s
185  * read
186  * write
187
188 8. **lookups** - number of lookups per second
189  * path
190  * attr
191
192 9. **hits** - number of cache hits 
193  * hits
194
195 10. **attempts** - authorization attemts
196  * success
197  * failure
198
199 11. **cache** - cached authorization hits
200  * hit
201  * miss
202  
203 ### configuration
204
205 Sample:
206
207 ```yaml
208 localtcpip:
209   name     : 'local'
210   host     : '127.0.0.1'
211   port     : 24242
212
213 localsocket:
214   name     : 'local'
215   socket   : '/var/run/dovecot/stats'
216 ```
217
218 If no configuration is given, module will attempt to connect to dovecot using unix socket localized in `/var/run/dovecot/stats`
219
220 ---
221
222 # exim
223
224 Simple module executing `exim -bpc` to grab exim queue. 
225 This command can take a lot of time to finish its execution thus it is not recommended to run it every second.
226
227 It produces only one chart:
228
229 1. **Exim Queue Emails**
230  * emails
231
232 Configuration is not needed.
233
234 ---
235
236 # hddtemp
237  
238 Module monitors disk temperatures from one or more hddtemp daemons
239
240 **Requirement:**
241 Running `hddtemp` in daemonized mode with access on tcp port
242
243 It produces one chart **Temperature** with dynamic number of dimensions (one per disk)
244
245 ### configuration
246
247 Sample:
248
249 ```yaml
250 update_every: 3
251 host: "127.0.0.1"
252 port: 7634
253 ```
254
255 If no configuration is given, module will attempt to connect to hddtemp daemon on `127.0.0.1:7634` address
256
257 ---
258
259 # IPFS
260
261 Module monitors [IPFS](https://ipfs.io) basic information.
262
263 1. **Bandwidth** in kbits/s
264  * in
265  * out
266  
267 2. **Peers**
268  * peers
269  
270 ### configuration
271
272 Only url to IPFS server is needed. 
273
274 Sample:
275
276 ```yaml
277 localhost:
278   name : 'local'
279   url  : 'http://localhost:5001'
280 ```
281
282 ---
283
284 # memcached
285
286 Memcached monitoring module. Data grabbed from [stats interface](https://github.com/memcached/memcached/wiki/Commands#stats).
287
288 1. **Network** in kilobytes/s
289  * read
290  * written
291  
292 2. **Connections** per second
293  * current
294  * rejected
295  * total
296  
297 3. **Items** in cluster
298  * current
299  * total
300  
301 4. **Evicted and Reclaimed** items
302  * evicted
303  * reclaimed
304  
305 5. **GET** requests/s
306  * hits
307  * misses
308
309 6. **GET rate** rate in requests/s
310  * rate
311
312 7. **SET rate** rate in requests/s
313  * rate
314  
315 8. **DELETE** requests/s
316  * hits
317  * misses
318
319 9. **CAS** requests/s
320  * hits
321  * misses
322  * bad value
323  
324 10. **Increment** requests/s
325  * hits
326  * misses
327  
328 11. **Decrement** requests/s
329  * hits
330  * misses
331  
332 12. **Touch** requests/s
333  * hits
334  * misses
335  
336 13. **Touch rate** rate in requests/s
337  * rate
338  
339 ### configuration
340
341 Sample:
342
343 ```yaml
344 localtcpip:
345   name     : 'local'
346   host     : '127.0.0.1'
347   port     : 24242
348 ```
349
350 If no configuration is given, module will attempt to connect to memcached instance on `127.0.0.1:11211` address.
351
352 ---
353
354 # mysql
355
356 Module monitors one or more mysql servers
357
358 **Requirements:**
359  * python library [MySQLdb](https://github.com/PyMySQL/mysqlclient-python) (faster) or [PyMySQL](https://github.com/PyMySQL/PyMySQL) (slower)
360
361 It will produce following charts (if data is available):
362
363 1. **Bandwidth** in kbps
364  * in
365  * out
366
367 2. **Queries** in queries/sec
368  * queries
369  * questions
370  * slow queries
371
372 3. **Operations** in operations/sec
373  * opened tables
374  * flush
375  * commit
376  * delete
377  * prepare
378  * read first
379  * read key
380  * read next
381  * read prev
382  * read random
383  * read random next
384  * rollback
385  * save point
386  * update
387  * write
388
389 4. **Table Locks** in locks/sec
390  * immediate
391  * waited
392
393 5. **Select Issues** in issues/sec
394  * full join
395  * full range join
396  * range
397  * range check
398  * scan
399
400 6. **Sort Issues** in issues/sec
401  * merge passes
402  * range
403  * scan
404
405 ### configuration
406
407 You can provide, per server, the following:
408
409 1. username which have access to database (deafults to 'root')
410 2. password (defaults to none)
411 3. mysql my.cnf configuration file
412 4. mysql socket (optional)
413 5. mysql host (ip or hostname)
414 6. mysql port (defaults to 3306)
415
416 Here is an example for 3 servers:
417
418 ```yaml
419 update_every : 10
420 priority     : 90100
421 retries      : 5
422
423 local:
424   'my.cnf'   : '/etc/mysql/my.cnf'
425   priority   : 90000
426
427 local_2:
428   user     : 'root'
429   pass : 'blablablabla'
430   socket   : '/var/run/mysqld/mysqld.sock'
431   update_every : 1
432
433 remote:
434   user     : 'admin'
435   pass : 'bla'
436   host     : 'example.org'
437   port     : 9000
438   retries  : 20
439 ```
440
441 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`
442
443 ---
444
445 # nginx
446
447 This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote. 
448
449 **Requirements:**
450  * nginx with configured 'ngx_http_stub_status_module'
451  * 'location /stub_status'
452 Example nginx configuration can be found in 'python.d/nginx.conf'
453
454 It produces following charts:
455
456 1. **Active Connections**
457  * active
458
459 2. **Requests** in requests/s
460  * requests
461
462 3. **Active Connections by Status**
463  * reading
464  * writing
465  * waiting
466  
467 4. **Connections Rate** in connections/s
468  * accepts
469  * handled
470  
471 ### configuration
472
473 Needs only `url` to server's `stub_status`
474
475 Here is an example for local server:
476
477 ```yaml
478 update_every : 10
479 priority     : 90100
480
481 local:
482   url     : 'http://localhost/stub_status'
483   retries : 10
484 ```
485
486 Without configuration, module attempts to connect to `http://localhost/stub_status`
487
488 ---
489
490 # nginx_log
491
492 Module monitors nginx access log and produces only one chart:
493
494 1. **nginx status codes** in requests/s
495  * 2xx
496  * 3xx
497  * 4xx
498  * 5xx
499
500 ### configuration
501
502 Sample for two vhosts:
503
504 ```yaml
505 site_A:
506   path: '/var/log/nginx/access-A.log'
507
508 site_B:
509   name: 'local'
510   path: '/var/log/nginx/access-B.log'
511 ```
512
513 When no configuration file is found, module tries to parse `/var/log/nginx/access.log` file.
514
515 ---
516
517 # phpfpm
518
519 This module will monitor one or more php-fpm instances depending on configuration. 
520
521 **Requirements:**
522  * php-fpm with enabled `status` page
523  * access to `status` page via web server
524  
525 It produces following charts:
526
527 1. **Active Connections**
528  * active
529  * maxActive
530  * idle
531
532 2. **Requests** in requests/s
533  * requests
534  
535 3. **Performance**
536  * reached
537  * slow
538  
539 ### configuration
540
541 Needs only `url` to server's `status`
542  
543 Here is an example for local instance:
544
545 ```yaml
546 update_every : 3
547 priority     : 90100
548
549 local:
550   url     : 'http://localhost/status'
551   retries : 10
552 ```
553
554 Without configuration, module attempts to connect to `http://localhost/status`
555
556 ---
557
558 # postfix
559
560 Simple module executing `postfix -p` to grab postfix queue.
561
562 It produces only two charts:
563
564 1. **Postfix Queue Emails**
565  * emails
566  
567 2. **Postfix Queue Emails Size** in KB
568  * size
569
570 Configuration is not needed.
571
572 ---
573
574 # redis
575
576 Get INFO data from redis instance.
577
578 Following charts are drawn:
579
580 1. **Operations** per second
581  * operations
582
583 2. **Hit rate** in percent
584  * rate
585
586 3. **Memory utilization** in kilobytes
587  * total
588  * lua
589
590 4. **Database keys** 
591  * lines are creates dynamically based on how many databases are there
592  
593 5. **Clients**
594  * connected
595  * blocked
596  
597 6. **Slaves**
598  * connected
599  
600 ### configuration
601
602 ```yaml
603 socket:
604   name     : 'local'
605   socket   : '/var/lib/redis/redis.sock'
606
607 localhost:
608   name     : 'local'
609   host     : 'localhost'
610   port     : 6379
611 ```
612
613 When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
614
615 ---
616
617 # sensors
618
619 System sensors information.
620
621 Charts are created dynamically.
622
623 ### configuration
624
625 For detailed configuration information please read [`sensors.conf`](https://github.com/firehol/netdata/blob/master/conf.d/python.d/sensors.conf) file.
626
627 ---
628
629 # squid
630
631 This module will monitor one or more squid instances depending on configuration.
632
633 It produces following charts:
634
635 1. **Client Bandwidth** in kilobits/s
636  * in
637  * out
638  * hits
639
640 2. **Client Requests** in requests/s
641  * requests
642  * hits
643  * errors
644
645 3. **Server Bandwidth** in kilobits/s
646  * in
647  * out
648  
649 4. **Server Requests** in requests/s
650  * requests
651  * errors
652  
653 ### configuration
654
655 ```yaml
656 priority     : 50000
657
658 local:
659   request : 'cache_object://localhost:3128/counters'
660   host    : 'localhost'
661   port    : 3128
662 ```
663
664 Without any configuration module will try to autodetect where squid presents its `counters` data
665  
666 ---
667
668 # tomcat
669
670 Present tomcat containers memory utilization.
671
672 Charts:
673
674 1. **Requests** per second
675  * accesses
676
677 2. **Volume** in KB/s
678  * volume
679
680 3. **Threads**
681  * current
682  * busy
683  
684 4. **JVM Free Memory** in MB
685  * jvm
686  
687 ### configuration
688
689 ```yaml
690 localhost:
691   name : 'local'
692   url  : 'http://127.0.0.1:8080/manager/status?XML=true'
693   user : 'tomcat_username'
694   pass : 'secret_tomcat_password'
695 ```
696
697 Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials. 
698 So it will probably fail.
699
700 ---