include info about YAML in readme
paulfantom committed
Jun 18, 2016 at 20:17 UTC
c817dbc88b5dd5885fb02a042ad4f64e2132aa7c
1 file changed
+55
-23
python.d/README.md
+55
-23
@@ -4,8 +4,38 @@
4
5
Currently every plugin must be written in python3.
6
All third party libraries should be installed system-wide or in `python_modules` directory.
7
-Also plugins support changing their data collection frequency by setting `update_every` variable in their configuration file.
7
+Module configurations are written in YAML and **pyYAML is required**.
8
9
+Every configuration file must have one of two formats:
10
+1. Configuration for only one job:
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
+2. Configuration for many jobs (ex. mysql):
20
+```yaml
21
+# module defaults:
22
+update_every : 2
23
+retries : 1
24
+priority : 20000
25
+
26
+local: # job name
27
+ update_every : 5 # job update frequency
28
+ retries : 2 # job retries
29
+ other_var1 : some_val # module specific variable
30
+
31
+other_job:
32
+ priority : 5 # job position on dashboard
33
+ retries : 20 # job retries
34
+ other_var2 : val # module specific variable
35
+```
36
+
37
+`update_every`, `retries`, and `priority` are always optional.
38
+---
39
40
The following python.d plugins are supported:
41
@@ -72,30 +102,32 @@ You can provide, per server, the following:
102
6. mysql host (ip or hostname)
103
7. mysql port (defaults to 3306)
104
75
-Here is an example for 3 servers updating data every 10 seconds
76
-
77
-```js
78
-update_every = 10
79
-
80
-config=[
81
- {
82
- 'name' : 'local',
83
- 'my.cnf' : '/etc/mysql/my.cnf'
84
- },{
85
- 'name' : 'local_2',
86
- 'user' : 'root',
87
- 'password' : 'blablablabla',
88
- 'socket' : '/var/run/mysqld/mysqld.sock'
89
- },{
90
- 'name' : 'remote',
91
- 'user' : 'admin',
92
- 'password' : 'bla',
93
- 'host' : 'example.org',
94
- 'port' : '9000'
95
- }]
105
+Here is an example for 3 servers:
106
+
107
+```yaml
108
+update_every : 10
109
+priority : 90100
110
+retries : 5
111
+
112
+local:
113
+ 'my.cnf' : '/etc/mysql/my.cnf'
114
+ priority : 90000
115
+
116
+local_2:
117
+ user : 'root'
118
+ password : 'blablablabla'
119
+ socket : '/var/run/mysqld/mysqld.sock'
120
+ update_every : 1
121
+
122
+remote:
123
+ user : 'admin'
124
+ password : 'bla'
125
+ host : 'example.org'
126
+ port : 9000
127
+ retries : 20
128
```
129
98
-If no configuration is given, the plugin will attempt to connect to mysql server via unix socket at `/var/run/mysqld/mysqld.sock` without password and username `root`
130
+If no configuration is given, the plugin will attempt to connect to mysql server via unix socket at `/var/run/mysqld/mysqld.sock` without password and with username `root`
131
132
---
133