Skip to content

Instantly share code, notes, and snippets.

@jplitza
Last active August 29, 2015 13:56
Show Gist options
  • Save jplitza/8932894 to your computer and use it in GitHub Desktop.
Save jplitza/8932894 to your computer and use it in GitHub Desktop.
RRA upgrade
#!/bin/sh
for rrd in *.rrd; do
since="$(rrdtool dump $rrd|grep -oE '[[:digit:]]{10}'|sort|tail -n1)"
rrdtool create $rrd.new --start "$since" --step 60 \
DS:upstate:GAUGE:120:0:1 \
DS:clients:GAUGE:120:0:200 \
RRA:AVERAGE:0.5:1:120 \
RRA:AVERAGE:0.5:5:1440 \
RRA:AVERAGE:0.5:60:720 \
RRA:AVERAGE:0.5:720:730
rrdtool dump $rrd|sed -n 's/^.*\/ \(.*\) --> <row><v>\(.*\)<\/v><v>\(.*\)<\/v><\/row>/\1:\2:\3/p'|xargs rrdtool update $rrd.new
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment