Created
August 27, 2015 20:49
-
-
Save pathcl/980eac3f729f84605eb6 to your computer and use it in GitHub Desktop.
fixnan cacti
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/bash | |
| rddToolBin="/usr/bin/rrdtool" | |
| rmBin="/bin/rm" | |
| chownBin="/bin/chown" | |
| userThatOwnsDb="www-data" | |
| dbList="someRRd.rrd" | |
| rm -fr /var/www/dump | |
| rm -fr /var/www/restore | |
| mkdir -p /var/www/dump /var/www/restore | |
| cd /var/lib/cacti/rra | |
| for f in $dbList;do | |
| $rddToolBin dump $f /var/www/dump/$f.xml | |
| done | |
| cd /var/www/dump/ | |
| sed -i '/.*<row><v> NaN.*/d' *.xml | |
| cd /var/www/restore | |
| for f in $(ls /var/www/dump/|head -n100);do | |
| #$rddToolBin restore -f /var/www/dump/$f /var/www/restore/${f/.xml/} | |
| $rddToolBin restore -f /var/www/dump/$f /var/lib/cacti/rra/${f/.xml/} | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment