2011年7月22日 星期五

CactiEZ 自動升級 0.8.7g

一、建立 shell file,執行

#update cacitez
mysqldump -l --add-drop-table cacti > /tmp/mysql.cacti
mysqldump -l --add-drop-table syslog > /tmp/mysql.syslog

mv /var/www/html /var/www/html.old

cd /tmp
wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
tar zxvf cacti-0.8.7g.tar.gz
mv cacti-0.8.7g /var/www/html

yes|cp -r /var/www/html.old/rra /var/www/html/

yes|cp /var/www/html.old/log/* /var/www/html/log

cp /var/www/html.old/scripts/* /var/www/html/scripts --reply=no
cp -R /var/www/html.old/resource/* /var/www/html/resource/ --reply=no

sed -i 's/$database_password = "cactiuser";/$database_password = "CactiMadeEZ";/g' /var/www/html/include/config.php
sed -i 's/#$cacti_session_name = "Cacti";/$cacti_session_name = "CactiEZ";/g' /var/www/html/include/config.php

rm -f /tmp/cacti-0.8.7g.tar.gz

#plugins update
cd /tmp
wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7g-PA-v2.8.zip
unzip cacti-plugin-0.8.7g-PA-v2.8.zip
cd cacti-plugin-arch
yes | cp cacti-plugin-0.8.7g-PA-v2.8.diff LICENSE pa.sql README /var/www/html

yes| cp -r files-0.8.7g/ /var/www/html

cd /var/www/html
patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff

sed -i 's/"Cacti";/"CactiMadeEZ";/g' /var/www/html/include/global.php

cp -r /var/www/html.old/plugins/* /var/www/html/plugins/ --reply=no

cd /tmp
wget http://cactiusers.org/downloads/boost.tar.gz
cd /var/www/html/plugins/
tar zxvf /tmp/boost-2.4.tar.gz

cd /tmp
wget http://cactiusers.org/downloads/thold.tar.gz
cd /var/www/html/plugins/
tar zxvf /tmp/thold-0.4.3.tar.gz

cd /tmp
wget http://www.network-weathermap.com/files/php-weathermap-0.96a.zip
cd /var/www/html/plugins/
unzip -o /tmp/php-weathermap-0.96a.zip

cd /tmp
wget http://sourceforge.net/projects/cacti-reportit/files/cacti-reportit/reportit_v071/reportit_0.7.1.tar.gz/download
cd /var/www/html/plugins/
tar zxvf /tmp/reportit_0.7.1.tar.gz
rm -rf reportit
mv 0.7.1 reportit

二、編輯 /var/www/html/include/global.php

找到$config = array();在下方添加下面文字

$plugins = array();
$plugins[] = 'settings';
$plugins[] = 'boost';
$plugins[] = 'monitor';
$plugins[] = 'discovery';
$plugins[] = 'tools';
$plugins[] = 'syslog';
$plugins[] = 'mactrack';
$plugins[] = 'loginmod';
$plugins[] = 'update';
$plugins[] = 'flowview';
$plugins[] = 'hostinfo';
$plugins[] = 'errorimage';
$plugins[] = 'weathermap';
$plugins[] = 'docs';
$plugins[] = 'reportit';
//$plugins[] = 'ntop';
//$plugins[] = 'ssl';
$plugins[] = 'routerconfigs';
$plugins[] = 'wmi';
$plugins[] = 'realtime';

三、重啟服務


service httpd restart

四、更新失敗的復原方法


cd /
rm -rf /var/www/html
mv /var/www/html.old /var/www/html

mysql cacti < /tmp/mysql.cacti
mysql syslog < /tmp/mysql.syslog
service httpd restart

五、weathermap 錯誤訊息


Notice: Undefined index: action in /var/www/html/plugins/weathermap/setup.php on line 146



將146行改為以下:


if(isset( $_REQUEST["action"] ) && $_REQUEST["action"] == 'viewmapcycle')