Skip to content

Commit

Permalink
Instructions on configuration for scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
coredump committed Feb 10, 2012
1 parent 08575f8 commit 6ab03a0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -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
------------------------------------------------

Expand All @@ -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
--------------------

Expand Down
6 changes: 4 additions & 2 deletions scripts-available/mysql.coffee
Expand Up @@ -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',
Expand Down Expand Up @@ -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]

Expand Down

0 comments on commit 6ab03a0

Please sign in to comment.