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