#!/bin/bash
rrddump="/usr/bin/rrdtool dump"
xmldir=/path/to/dump/rraxml
sourcedir=/path/to/cacti/rra
#-mtime -30 changed in past 30 days
#for file in `find /path/to/cacti/rra/ -mtime -30 |awk -F\/ '{print $NF}'`
for file in `ls /path/to/cacti/rra/ |awk -F\/ '{print $NF}'`
do
${rrddump} ${sourcedir}/${file} > ${xmldir}/${file}.xml
done
#!/bin/bash
rrdrestore="/usr/bin/rrdtool restore"
xmldir=/path/to/rraxml
destinationdir=/path/to/rra
#drop .xml and restore to rrd
#for file in `find ${xmldir} |awk -F\/ '{print $NF}' |sed s/.xml//g`
for file in `ls ${xmldir} |awk -F\/ '{print $NF}' |sed s/.xml//g`
do
${rrdrestore} ${xmldir}/${file}.xml ${destinationdir}/${file}
done
chown cactiDN:cactiDN ${destinationdir} -R
No comments:
Post a Comment