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