diff --git a/README.md b/README.md index 3a9f3c3..02fc208 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,15 @@ Also, HoardD was made to be used with chef (or any other configuration managemen The master branch will be updated only to working versions (i.e: I will *try* not to break it), so you can probably just do a clone/fetch/pull from it on new versions. +### Scripts and specific configuration + +The MySQL script is an example of how to configure specific scripts. It contains a `mysql.json` file that is read by the script when it starts. Just make sure to: + +* Keep the configs with the same name as the plugin (like, mysql.coffee and mysql.json) +* Put/link the configuration on the script path (together with the scripts) + +For real, you can do whatever you want on your scripts, but it's better to make it easier for other people to configure/understand, so let's stick to a default. + Retentions, sample interval and counter metrics ------------------------------------------------ @@ -38,6 +47,12 @@ Counter metrics are ever increasing counters, like the ones used on `/proc/net/i **TL;DR**: use `derivative` to make the graph show differences between two samples and `scale` to make it show per second. The scale is always 1/*data retention value* of the graph. +For example, for network speed: + +``` +scale(derivative(hoard.host.interfaces.eth0.txBytes),0.1) +``` + Writing new scripts -------------------- diff --git a/scripts-available/mysql.coffee b/scripts-available/mysql.coffee index 90a5c0b..6e78df7 100644 --- a/scripts-available/mysql.coffee +++ b/scripts-available/mysql.coffee @@ -2,6 +2,8 @@ Mysql = require 'mysql' Fs = require 'fs' Path = require 'path' +# To configure this plugin use the mysql.json file and put it on the scripts/ directory + # Metrics to get from the statuses generalMetrics = 'rxBytes': 'Bytes_received', @@ -98,14 +100,14 @@ module.exports = (server) -> conn = Mysql.createClient conf conn.query 'SHOW GLOBAL STATUS', (err, res, fields) -> if err - server.cli "Error on STATUS query: #{err}" + server.cli.error "Error on STATUS query: #{err}" for row in res data[row.Variable_name] = row.Value conn.query 'SHOW SLAVE STATUS', (err, res, fields) -> if err - server.cli "Error on SLAVE STATUS query: #{err}" + server.cli.error "Error on SLAVE STATUS query: #{err}" data[key] = value for key, value of res[0]