Last active
August 29, 2015 13:56
-
-
Save jplitza/8932894 to your computer and use it in GitHub Desktop.
RRA upgrade
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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