node package manager



Build Status NPM version Dependency Status Development Dependency Status

Gittip donate button Flattr donate button PayPayl donate button BitCoin donate button


  • Builds on rrdtool. The network industry standard of saving time-series data to disk with a constant storage footprint.
  • Builds on nodejs for optimal concurrency and the ability to run a server without dealing with cgi-bin, etc.
  • Minimal dependencies. If you have node.js/npm working, all you need is aptitude install rrdtool and you're ready to go
  • Writes RRDs & images to disk, so it works when everything else is down.
  • Idempotent. Metriks will create graphs that don't exist, and generally be eager to get you results.
  • Trivial to add graphs. It should Just Work by default. Write a plugin file in any language. If it outputs a single number, metriks will graph it for you. You can optionally output configuration strings like # 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.
  • Can send out alerts when metrics go outside boundaries

Metriks is basic. If you want advanced, there are plenty of options out there like graphite, mrtg, or (paid) librato. You may also want to have a look at druid, riemann and grafana. However Metriks will never:

  • Require you to deal with perl / cgi-bin / xml / apache / etc
  • Impose steep learning curves
  • Require networked components to be available to do it's job (in favor of graphing locally, optionally aggregating & uploading to e.g. S3)
  • Get in your way
  • Ask for money


Here we'll add a simple graph with response times to different nameservers that looks like this:

kvz-imac-home-4 local-ping

To achieve this, open a text file ./plugins/, 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; do
  echo "ip_${server} $(ping -c 4 ${server} |tail -1 |awk '{print $4}' |cut -d '/' -f 2)"


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


Metriks is still in early stages of development, here's what needs to be done still:

  • More advanced rrd types (COUNTER vs GAUGE, ability to add a custom step, AREA graphs) as req in #1
  • Offer an API that so that you can programatically add values in Nodejs programs. e.g. require('metriks').graph('df').addSeries([{'/': '50%'}])
  • Checkout smokeping sources and try to build a plugin very similar to it. This should expose some limitations and make it more usable in different environments after fixing those.
  • Example plugin: network traffic
  • Example plugin: top-10 memory heavy processes (may require "Dynamically expand ds" first)
  • Example plugins:
  • Something that can generate an index page/json of rrd/images
  • Upload to s3 as a step after rrd -> graph -> upload
  • Aggregate datasources into 1 graph using glob
  • Support for max & min values and a way to communicate problems to the outside world
  • Dynamically expand ds using rrdtool dump / import. It's hard, see
  • More unit test coverage
  • Don't crash the main process on plugin fatals.
  • Show min, max, avg for every ds on every graph by default
  • Install bin globally
  • Add example section to readme with screenshots and plugin code
  • Configurable line titles vs hardcoded ds name
  • Upgrade flat once this bug has been resolved. Until then, prefix all ds keys with a letter.
  • Offer an optional webserver via e.g. send so you can browse through the generated pngs
  • _.findWhere
  • Refactoring: Plugin
  • Refactoring: pluginmanager
  • Refactoring: rrdtool
  • Refactoring: cli
  • Retire thong.tmpl for _.template
  • Retire thong.sprintf for util.format
  • Retire commander for cli
  • Visually show integration test
  • One integration test
  • Test cases
  • Explodetree/flatten, use it for plug-in config (linecolour slice to array) and rrdtool info
  • _.isNumeric
  • Librato colors
  • Graph options need to be interpretted
  • Configurable y-axis
  • Lose rrd.js over rrdtool.js
  • Async.parallel jobs
  • Support for .go plugins


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
cd metriks
npm install


With debug output, and a built-in webserver to browser resulting png graphs on port 8000

./bin/metriks --debug --web-port 8000


make test



/usr/bin/rrdtool graph -
"Latency Graph"
"GPRINT:avmed:median rtt: %.1lf %ss avg"
"GPRINT:median:MAX:%.1lf %ss max"
"GPRINT:median:MIN:%.1lf %ss min"
"GPRINT:median:LAST:%.1lf %ss now"
"COMMENT:6.9 ms sd"
"GPRINT:mesd:AVERAGE:%.1lf %s am/s\l"
"GPRINT:ploss:AVERAGE:packet loss: %.2lf %% avg"
"GPRINT:ploss:MAX:%.2lf %% max"
"GPRINT:ploss:MIN:%.2lf %% min"
"GPRINT:ploss:LAST:%.2lf %% now\l"
"COMMENT:loss color:"