Skip to content


rrdtool数据备份与迁移

迁移cacti后图表一直没出来….

调试注意
1.cacti->System Utilities->Technical Support 调试

2.cacti 0.8.7e 不支持rrdtool-1.4.4
可用1.3x,1.2x

3.rrdtool 显示错误ERROR: This RRD was created on another architecture
不同版本不兼容,32bit和64bit也不兼容

解决不兼容方法
1.在原服务器生成xml文件
创建脚本文件
dumprrdtool.sh

#!/bin/sh

rrddump=”/usr/local/rrdtool/bin/rrdtool dump”
xmldir=/tmp/rraxml
cd /opt/htdocs/www/cacti/rra/
for file in `find ./ -mtime -4 |awk -F\/ “{print $NF}”`
#遍历rra目录,查找近4天修改过的rrd文件;
do
${rrddump} ${file} > ${xmldir}/${file}.xml
done


chmod 775 ./dumprrdtool.sh
mkdir /tmp/rraxml
chmod 777 /tmp/rraxml
./dumprrdtool.sh

2.
脚本会将rra文件转成xml文件
将xml传用ssh或rsync等方式传到新服务器上

3.新服务上还原文件
mkdir /tmp/rraxml
chmod 777 /tmp/rraxml
将xml文件放到/tmp/rraxml下
创建脚本restorerrdtool.sh

#!/bin/sh
rrdrestore=”/usr/local/rrdtool/bin/rrdtool restore”
xmldir=/tmp/rraxml/
cd ${xmldir}
for file in `find ./ |awk -F\/ ‘{print $NF}’ |sed s/.xml//g`
do
${rrdrestore} ${xmldir}${file}.xml /tmp/rra/${file}
done

mkdir /tmp/rra
chmod 777 /tmp/rra
./restorerrdtool.sh
再将新生的rra文件复制到cacti/rra目录下

参考:
http://hiadmin.com/?p=559

Posted in Cacti, RRDtool, 技术.

Tagged with , .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. xugang says

    syntax error near unexpected token do



Some HTML is OK

or, reply to this post via trackback.