生產運行環境:
操作系統:CentOS release 6.10 (Final)
數據庫:Server version: 5.5.55
程序語言:PHP 5.4.45
Web軟件:Apache/2.2.15 (Unix)
軟件:Cacti Version 0.8.8h
實戰操作步驟如下:
[root@sky9890 src]# wget https://www.cacti.net/downloads/cacti-0.8.8h.zip
[root@sky9890 src]# unzip –d /var/www/html/ cacti-0.8.8h.zip
[root@sky9890 html]#
mysql> create database cacti;
mysql>GRANT ALL ON cacti.* TO username@localhost IDENTIFIED BY 'mima';
mysql>flush privileges;
[root@sky9890 cacti]# mysql –uroot –p cacti <cacti.sql
#echo '*/5 * * ** /usr/bin/php/var/www/html/cacti/poller.php >/dev/null 2>&1' >>/var/spool/cron/root
注意幾個問題:
1.創建緩存目錄,否則不會出圖:
Cache Directory This is the location, on the web server where the RRDfiles and PNG's will be cached. This cache will be managed by the poller.
[root@sky9890 cache]# pwd /var/www/html/cacti/cache
2.爲什麼不採用cacti 1.0以上版本,因大量插件不支持,特別是生產環境,不宜使用新版本。
例如:monitor、realtime、settings、thold等插件。
3.授權給相應的目錄
#chmod 755 /var/www/html/cacti/poller.php
4.當不出圖,不出數據的情況下:
#/usr/bin/php /var/www/html/cacti/poller.php –force
#chmod 777 -R /var/www/html/cacti/rra
#mysqlcheck --auto-repair --databases cacti –p
5.插件配置
[root@sky9890 plugins]# pwd
/var/www/html/cacti/plugins #下載插件到該目錄下
[root@sky9890 include]# pwd
/var/www/html/cacti/include
[root@sky9890 include]# vi config.php #下載名稱與配置名稱一致
$plugins[] ='monitor';
$plugins[] = 'settings';
$plugins[] = 'thold';
$plugins[]='realtime';
$plugins[]='ntop';
6.相關資源鏈接:
下載插件地址:https://docs.cacti.net/plugins/
安裝配置文檔:http://blog.51cto.com/sky9896/1711972
解決安裝、配置、運維常見問題的技術文檔:
http://blog.51cto.com/sky9896/1736331
http://blog.51cto.com/sky9896/1847429
http://blog.51cto.com/sky9896/1716322
http://blog.51cto.com/sky9896/1794426
7.部分監控運行效果圖如下:
WinServer服務器
Linux服務器
8.Cacti系統運維:
1)備份MySQL數據庫
[root@sky9890 sky9890]# mkdir /data/cacti_bak
[root@sky9890 sky9890]# chmod 777 /data/cacti_bak/
[root@sky9890 /]# cd /data/cacti_bak/
[root@sky9890 cacti_bak]#
[root@sky9890 cacti_bak]# mysqldump --user=***** --password=****** --add-drop-table --databases cacti > cacti_db_bak_20181129.sql
[root@sky9890 cacti_bak]# cat cacti_db_bak_20181129.sql #對備份集進行檢查
2)還原MySQL數據庫
[root@sky9890 cacti_bak]# mysql -uroot -p cacti < cacti_db_bak_20181129.sql
Enter password:
3)備份Cacti的重要文件
/var/www/html/cacti
4)清理日誌文件
/var/www/html/cacti/log/
5)清理孤立的rrd文件