]> arthur.barton.de Git - netdata.git/commitdiff
include info about YAML in readme
authorpaulfantom <paulfantom@gmail.com>
Sat, 18 Jun 2016 18:17:06 +0000 (20:17 +0200)
committerpaulfantom <paulfantom@gmail.com>
Sat, 18 Jun 2016 18:17:06 +0000 (20:17 +0200)
python.d/README.md

index 7e74a28e15d7bfbb17bf536a7f8cc71743287567..71411ca0a5cb8e689cb01fb8d155975af104f2a9 100644 (file)
@@ -4,8 +4,38 @@
 
 Currently every plugin must be written in python3.
 All third party libraries should be installed system-wide or in `python_modules` directory.
-Also plugins support changing their data collection frequency by setting `update_every` variable in their configuration file.
+Module configurations are written in YAML and **pyYAML is required**.
 
+Every configuration file must have one of two formats:
+1. Configuration for only one job:
+```yaml
+update_every : 2 # update frequency
+retries      : 1 # how many failures in update() is tolerated
+priority     : 20000 # where it is shown on dashboard
+
+other_var1   : bla  # variables passed to module
+other_var2   : alb
+```
+2. Configuration for many jobs (ex. mysql):
+```yaml
+# module defaults:
+update_every : 2
+retries      : 1
+priority     : 20000
+
+local:  # job name
+  update_every : 5 # job update frequency
+  retries      : 2 # job retries
+  other_var1   : some_val # module specific variable
+
+other_job: 
+  priority     : 5 # job position on dashboard
+  retries      : 20 # job retries
+  other_var2   : val # module specific variable
+```
+
+`update_every`, `retries`, and `priority` are always optional.
+---
 
 The following python.d plugins are supported:
 
@@ -72,30 +102,32 @@ You can provide, per server, the following:
 6. mysql host (ip or hostname)
 7. mysql port (defaults to 3306)
 
-Here is an example for 3 servers updating data every 10 seconds
-
-```js
-update_every = 10
-
-config=[
-    {
-        'name'     : 'local',
-        'my.cnf'   : '/etc/mysql/my.cnf'
-    },{
-       'name'     : 'local_2',
-        'user'     : 'root',
-        'password' : 'blablablabla',
-        'socket'   : '/var/run/mysqld/mysqld.sock'
-    },{
-        'name'     : 'remote',
-        'user'     : 'admin',
-        'password' : 'bla',
-        'host'     : 'example.org',
-        'port'     : '9000'
-    }]
+Here is an example for 3 servers:
+
+```yaml
+update_every : 10
+priority     : 90100
+retries      : 5
+
+local:
+  'my.cnf'   : '/etc/mysql/my.cnf'
+  priority   : 90000
+
+local_2:
+  user     : 'root'
+  password : 'blablablabla'
+  socket   : '/var/run/mysqld/mysqld.sock'
+  update_every : 1
+
+remote:
+  user     : 'admin'
+  password : 'bla'
+  host     : 'example.org'
+  port     : 9000
+  retries  : 20
 ```
 
-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`
+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`
 
 ---