Skip to content

Instantly share code, notes, and snippets.

@jpetazzo
Created February 4, 2012 06:43
Show Gist options
  • Save jpetazzo/1735900 to your computer and use it in GitHub Desktop.
Save jpetazzo/1735900 to your computer and use it in GitHub Desktop.
Example of rrdtool GAUGE to store a value between 0 and 100
#!/bin/sh
rrdtool create foo.rrd --start -2h --step 900 DS:foo:GAUGE:3600:0:100 RRA:AVERAGE:0.5:1:1000
for N in $(seq 20 -1 1)
do
rrdtool update foo.rrd -- -$(($N*600)):$N$N
rrdtool lastupdate foo.rrd
done
rrdtool graph --start -1h foo.png DEF:foo=foo.rrd:foo:AVERAGE LINE:foo#000000:thefoo
rrdtool fetch foo.rrd AVERAGE | tail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment