自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何備份Cacti的數(shù)據(jù)

運(yùn)維 系統(tǒng)運(yùn)維
怎樣備份Cacti上的數(shù)據(jù)?Cacti是一套基于PHP、MySQL、SNMP及RRDTool開發(fā)的網(wǎng)絡(luò)流量監(jiān)測圖形分析工具。Cacti通過snmpget來獲取數(shù)據(jù),使用 RRDtool繪畫圖形。而且提供了非常強(qiáng)大的數(shù)據(jù)和用戶管理功能,那么該如何備份遷移Cacti上的數(shù)據(jù)呢?

  Cacti數(shù)據(jù)備份與遷移:

  一、工作流

  安裝mysql;php;apache;rrdtool后;

  將cacti目錄tarball后,復(fù)制到雙線機(jī)房新監(jiān)控服務(wù)器上解壓;

  cactid目錄tarball后,復(fù)制到雙線機(jī)房新監(jiān)控服務(wù)器上解壓;

  mysql數(shù)據(jù)庫dump或者tarball后,復(fù)制到雙線機(jī)房新監(jiān)控服務(wù)器上解壓;

  1.   #mysqldump -p cacti >cacti.sql  
  2.  

  重新賦予cactiuser對于數(shù)據(jù)庫cacti所有權(quán)限;

  1.   grant all . cacti.* to cactiuser@localhost identified by 'cactipassword';  
  2.  

  二、故障發(fā)生

  打開cacti可以正常登錄和控制,檢查graph management,打開所有的圖無顯示;于是打開debug模式:

  1.   *Turn . Graph Debug Mode.  
  2.  
  3.   RRDTool Says:  
  4.  
  5.   ERROR: This RRD was created . other architecture  
  6.  

  三、解決方案

  google、baidu了一下,發(fā)生這個(gè)問題的原因是因?yàn)樗衦rd庫需要全部重新dump和restore一次;

  好了上腳本:

  從老的cacti服務(wù)器上dump所有的rrd文件為xml file,共計(jì)9K多張:

  1.   #!/bin/sh  
  2.  
  3.   rrddump="/usr/bin/rrdtool dump" 
  4.  
  5.   xmldir=/tmp/rraxml  
  6.  
  7.   for file in `find /var/www/html/cacti/rra/ -mtime -2 |awk -F\/ '{print $NF}'`  
  8.  
  9.   #遍歷rra目錄,查找近2天修改過的rrd文件;  
  10.  
  11.   do  
  12.  
  13.   ${rrddump} ${file} > ${xmldir}/${file}.xml  
  14.  
  15.   done  
  16.  

  tar走rraxml目錄到新監(jiān)控服務(wù)器上解壓:restore腳本如下:

  1.   #!/bin/sh  
  2.  
  3.   rrdrestore="/usr/bin/rrdtool restore" 
  4.  
  5.   xmldir=/tmp/rraxml/  
  6.  
  7.   for file in `find ${xmldir} |awk -F\/ '{print $NF}' |sed s/.xml//g`  
  8.  
  9.   #遍歷xml目錄,并去掉xml后綴,直接還原到rra目錄下  
  10.  
  11.   do  
  12.  
  13.   ${rrdrestore} ${xmldir}${file}.xml /cacti/rra/${file}  
  14.  
  15.   done  
  16.  
  17.   chown cactiuser:cactiuser /cacti/rra -R  
  18.  

  完成后,再次打開cacti監(jiān)控顯示正常;遷移成功;

  用這個(gè)方法其實(shí)是用來備份rra的,這次正好順便備份一下。

【編輯推薦】

使用Cacti監(jiān)控你的網(wǎng)絡(luò)-Cacti的監(jiān)測點(diǎn)的創(chuàng)建(圖)

Nagios監(jiān)控?cái)?shù)據(jù)庫的方法

Cacti介紹(圖)

責(zé)任編輯:zhaolei 來源: sina
相關(guān)推薦

2011-03-25 12:57:13

備份Cacti數(shù)據(jù)

2011-03-31 12:17:07

Cacti備份

2011-03-31 14:34:46

cactimysql備份

2020-09-01 07:00:00

數(shù)據(jù)備份數(shù)據(jù)庫

2011-04-06 08:54:30

Cacti數(shù)據(jù)獲取

2010-06-30 10:52:12

snmp服務(wù)Cacti

2011-03-25 09:00:39

Cacti模板

2011-04-01 16:29:23

Cacti監(jiān)控Tomcat

2011-04-01 16:30:49

cacti監(jiān)控Mysql

2011-04-01 16:29:27

Cacti監(jiān)控apache

2011-03-31 15:41:51

Cacti數(shù)據(jù)表結(jié)構(gòu)

2011-03-24 14:05:18

Cacti

2013-12-03 12:37:28

2011-03-25 11:28:37

Cacti數(shù)據(jù)

2011-03-29 09:08:49

Linux配置Cacti

2011-03-29 09:08:50

Linux配置Cacti

2011-03-29 09:08:47

2011-04-01 09:17:01

備份cactiwindows

2011-03-29 09:08:50

Linux

2011-03-31 10:41:37

Cacti架構(gòu)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號