]> arthur.barton.de Git - netdata.git/blob - python.d/README.md
update mysql configuration
[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. 
448
449 **Requirements:**
450  * nginx with configured `stub_status`
451
452 It produces following charts:
453
454 1. **Active Connections**
455  * active
456
457 2. **Requests** in requests/s
458  * requests
459
460 3. **Active Connections by Status**
461  * reading
462  * writing
463  * waiting
464  
465 4. **Connections Rate** in connections/s
466  * accepts
467  * handled
468  
469 ### configuration
470
471 Needs only `url` to server's `stub_status`
472
473 Here is an example for local server:
474
475 ```yaml
476 update_every : 10
477 priority     : 90100
478
479 local:
480   url     : 'http://localhost/stub_status'
481   retries : 10
482 ```
483
484 Without configuration, module attempts to connect to `http://localhost/stub_status`
485
486 ---
487
488 # nginx_log
489
490 Module monitors nginx access log and produces only one chart:
491
492 1. **nginx status codes** in requests/s
493  * 2xx
494  * 3xx
495  * 4xx
496  * 5xx
497
498 ### configuration
499
500 Sample for two vhosts:
501
502 ```yaml
503 site_A:
504   path: '/var/log/nginx/access-A.log'
505
506 site_B:
507   name: 'local'
508   path: '/var/log/nginx/access-B.log'
509 ```
510
511 When no configuration file is found, module tries to parse `/var/log/nginx/access.log` file.
512
513 ---
514
515 # phpfpm
516
517 This module will monitor one or more php-fpm instances depending on configuration. 
518
519 **Requirements:**
520  * php-fpm with enabled `status` page
521  * access to `status` page via web server
522  
523 It produces following charts:
524
525 1. **Active Connections**
526  * active
527  * maxActive
528  * idle
529
530 2. **Requests** in requests/s
531  * requests
532  
533 3. **Performance**
534  * reached
535  * slow
536  
537 ### configuration
538
539 Needs only `url` to server's `status`
540  
541 Here is an example for local instance:
542
543 ```yaml
544 update_every : 3
545 priority     : 90100
546
547 local:
548   url     : 'http://localhost/status'
549   retries : 10
550 ```
551
552 Without configuration, module attempts to connect to `http://localhost/status`
553
554 ---
555
556 # postfix
557
558 Simple module executing `postfix -p` to grab postfix queue.
559
560 It produces only two charts:
561
562 1. **Postfix Queue Emails**
563  * emails
564  
565 2. **Postfix Queue Emails Size** in KB
566  * size
567
568 Configuration is not needed.
569
570 ---
571
572 # redis
573
574 Get INFO data from redis instance.
575
576 Following charts are drawn:
577
578 1. **Operations** per second
579  * operations
580
581 2. **Hit rate** in percent
582  * rate
583
584 3. **Memory utilization** in kilobytes
585  * total
586  * lua
587
588 4. **Database keys** 
589  * lines are creates dynamically based on how many databases are there
590  
591 5. **Clients**
592  * connected
593  * blocked
594  
595 6. **Slaves**
596  * connected
597  
598 ### configuration
599
600 ```yaml
601 socket:
602   name     : 'local'
603   socket   : '/var/lib/redis/redis.sock'
604
605 localhost:
606   name     : 'local'
607   host     : 'localhost'
608   port     : 6379
609 ```
610
611 When no configuration file is found, module tries to connect to TCP/IP socket: `localhost:6379`.
612
613 ---
614
615 # sensors
616
617 System sensors information.
618
619 Charts are created dynamically.
620
621 ### configuration
622
623 For detailed configuration information please read [`sensors.conf`](https://github.com/firehol/netdata/blob/master/conf.d/python.d/sensors.conf) file.
624
625 ---
626
627 # squid
628
629 This module will monitor one or more squid instances depending on configuration.
630
631 It produces following charts:
632
633 1. **Client Bandwidth** in kilobits/s
634  * in
635  * out
636  * hits
637
638 2. **Client Requests** in requests/s
639  * requests
640  * hits
641  * errors
642
643 3. **Server Bandwidth** in kilobits/s
644  * in
645  * out
646  
647 4. **Server Requests** in requests/s
648  * requests
649  * errors
650  
651 ### configuration
652
653 ```yaml
654 priority     : 50000
655
656 local:
657   request : 'cache_object://localhost:3128/counters'
658   host    : 'localhost'
659   port    : 3128
660 ```
661
662 Without any configuration module will try to autodetect where squid presents its `counters` data
663  
664 ---
665
666 # tomcat
667
668 Present tomcat containers memory utilization.
669
670 Charts:
671
672 1. **Requests** per second
673  * accesses
674
675 2. **Volume** in KB/s
676  * volume
677
678 3. **Threads**
679  * current
680  * busy
681  
682 4. **JVM Free Memory** in MB
683  * jvm
684  
685 ### configuration
686
687 ```yaml
688 localhost:
689   name : 'local'
690   url  : 'http://127.0.0.1:8080/manager/status?XML=true'
691   user : 'tomcat_username'
692   pass : 'secret_tomcat_password'
693 ```
694
695 Without configuration, module attempts to connect to `http://localhost:8080/manager/status?XML=true`, without any credentials. 
696 So it will probably fail.
697
698 ---