[UNMAINTAINED] A lightweight server graphing framework
MIT License
I might revisit this hobby project in the future, but I currently do not have time to maintain this.
metriks.io is a time-series graphing tool that runs on servers. if you can output a number, metriks will create a beautiful graph for you.
it builds on top of 'ancient' rrdtool
which has proven to work well in production. metriks tries to limit infrastructural dependencies and features in order to provide a robust and pleasant experience for simple graphing needs.
plugins can be written in any language, or you can directly start graphing by tapping into metriks with node:
// metriks is under development, plugins work but the following API is still under discussion:
var metriks = require('metriks');
var graph = metriks.create('df');
graph.log({'/dev/sda1', '50%'});
rrdtool
. The network industry standard of saving time-series data to disk with a constant storage footprint.nodejs
for optimal concurrency and the ability to run a server without dealing with cgi-bin, etc.aptitude install rrdtool
and you're ready to go# config.interval: 60
or # graph.title: Load average
to finetune behavior. Newlines (\n
) separate graph lines. Other whitespaces separate graph label from value. See the load plugin for an example how to plot 3 load lines: 1 minute, 5 minute, 15 minute averages.Metriks is basic. If you want advanced, there are plenty other good options out there like graphite, mrtg, observium, cacti, gnuplot, munin, influxdb, or (paid) librato. You may also want to have a look at druid, riemann and grafana. However Metriks will never:
Here we'll add a simple graph with response times to different nameservers that looks like this:
To achieve this, open a text file ./plugins/ping.sh
, chmod +x
it, and make it say:
echo "# config.interval: 60"
echo "# graph.title: Ping resolving nameservers"
echo "# graph.verticalLabel: Roundtrip in ms"
for server in 8.8.8.8 4.2.2.2 208.67.222.222 172.16.0.23; do
echo "ip_${server} $(ping -c 4 ${server} |tail -1 |awk '{print $4}' |cut -d '/' -f 2)"
done
If you want to keep your plugin files outside of the Metriks source directory, simply point metriks to your own plugin dir via:
metriks --plugin-dir ~/metriks/plugins
By default, metriks writes rrds files to ~/metriks/rrd
and images to ~/metriks/png
. But you can change that with
metriks --rrd-dir /var/lib/rrd
metriks --png-dir /var/www/graphs
Metriks contains an simple webserver so you can browse the png
dir via:
metriks --web-port 8000
If you don't want to automatically build png files but are only interested in gathering data in rrd, use
metriks --auto-write-png false
If you want metriks to automatically upload to S3, use:
metriks --auto-upload-s3 true
Metriks will look for the following environment variables to do the s3 upload:
export METRIKS_S3_KEY=ABCDABCDABCDABCDABCD
export METRIKS_S3_SECRET=abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd
export METRIKS_S3_BUCKET=metriks.example.com
The default permission is public-read
, so be careful with that.
You can echo any of these in your plugin.sh
to change behavior of metriks, here are the defaults so you might as well set none of these, and get the same results:
# config->interval : 60
# config->enabled : true
# graphStore->consolidation: 'AVERAGE'
# graphStore->xff : 0.5
# graphStore->step : 1
# graphStore->rows : 300
# graph->width : 1000
# graph->height : 600
# graph->watermark : 'kvz.io'
# graph->font : 'DEFAULT:10:Inconsolata'
# graph->tabwidth : 20
# graph->border : 2
# graph->zoom : 1
# graph->fullSizeMode : true
# graph->dynamicLabels: true
# graph->slopeMode : true
# graph->end : 'now'
# graph->start : 'end-120000s'
# graph->verticalLabel: ''
# lineStore->${dsName}->dsType : 'GAUGE'
# lineStore->${dsName}->heartBeat : 600
# lineStore->${dsName}->min : 'U'
# lineStore->${dsName}->max : 'U'
# line->${dsName}->title : '${dsName}'
# line->${dsName}->color : '#44B824FF' .. '#3A96D0FF'
# line->${dsName}->element : 'LINE1'
# line->${dsName}->consolidation: 'AVERAGE'
Metriks is still in early stages of development, here's what needs to be done still:
require('metriks').graph('df').addSeries([{'/': '50%'}])
connect
webserver to write html to diskupstart
file so people can daemonize/respawn/log metriks easily on ubuntu? Yes. Probably just output a possible config, and let the end user pipe/copy paste/change it, rather than writing to /etc
graph
to store
. graph->lines
to lines
.graph->lines->*->
for config that applies to all datasources->
as a nesting delimiter. People will want to use .
for IPs and suchline.0.color
vs lineColors.0
I'm assuming you already have node 0.8+ and Git available.
To run rrdtool on OSX you'll need XQuartz. Then via Homebrew:
brew install rrdtool coreutils
coreutils is required for timeout
, used in integration tests.
aptitude install rrdtool
npm install -g metriks
git clone https://github.com/kvz/metriks.git
cd metriks
npm install
With debug output, and a built-in webserver to browse resulting png graphs on port 8000
./bin/metriks --debug --web-port 8000
make test