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

  1. #!/bin/sh
  2.  
  3. rrddump="/usr/local/rrdtool/bin/rrdtool dump"
  4. xmldir=/tmp/rraxml
  5. cd /opt/htdocs/www/cacti/rra/
  6. for file in `find ./ -mtime -4 |awk -F\/ "{print $NF}"`
  7. #遍历rra目录,查找近4天修改过的rrd文件;
  8. do
  9. ${rrddump} ${file} > ${xmldir}/${file}.xml
  10. done
  1. chmod 775 ./dumprrdtool.sh
  2. mkdir /tmp/rraxml
  3. chmod 777 /tmp/rraxml
  4. ./dumprrdtool.sh

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

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

  1. #!/bin/sh
  2. rrdrestore="/usr/local/rrdtool/bin/rrdtool restore"
  3. xmldir=/tmp/rraxml/
  4. cd ${xmldir}
  5. for file in `find ./ |awk -F\/ '{print $NF}' |sed s/.xml//g`
  6. do
  7. ${rrdrestore} ${xmldir}${file}.xml /tmp/rra/${file}
  8. 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.