編譯安裝cacti
#原有php沒有啟用snmp 所以先啟用
yum install net-snmp-devel net-snmp-utils -y
#進入php源碼目錄
cd /usr/local/src/php/src/php-5.2.17/ext/snmp
./configure --with-php-config=/usr/local/php1/bin/php-config
make && make install
#編輯php.ini 加入
extension = "snmp.so"
#重啟php-fpm
/usr/local/php1/sbin/php-fpm restart
#安裝cacit
1、安裝rrdtools
cd /opt/src
wgethttp://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz
yum install pango-devel
tar xvf rrdtool-1.4.5.tar.gz
cd rrdtool-1.4.5
./configure --prefix=/opt/rrdtool
make && make install
#讓rrdtool支持中文顯示
vi src/rrd_graph.c
在原來setlocale(LC_CTYPE,"")的位置增加以下內容
setlocale(LC_ALL,"zh_CN.gb2312");
2、安裝spine
wgethttp://www.cacti.net/downloads/spine/cacti-spine-0.8.7h.tar.gz
cd /opt/src
tar xvf cacti-spine-0.8.7h.tar.gz
cd cacti-spine-0.8.7h
./configure --prefix=/opt/spine
make && make install
修改spine配置文件
cd /opt/spine/etc
cp spine.conf.dist spine.conf
vi spine.conf
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass cactiuser
DB_Port 3306
DB_PreG 0
3、安裝cacti
建立用戶
useradd cacti
cd /opt/src
tar xvf cacti-0.8.7h.tar.gz
mv cacti-0.8.7h /home/www/cacti
chown -R root:root /home/www/cacti
修改配置文件(按實際信息修改)
vi home/www/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
$database_ssl = false;
#創建一個數據庫並導入數據
/usr/local/mysql/bin/mysql -u root -p
mysql> create database cacti;
mysql> grant all privileges on cacti.* tocacti@localhostidentified by "cactiuser";
mysql> flush privileges;
/usr/local/mysql/bin/mysql -u root -p cacti < /home/www/cacti/cacti.sql
cd /home/www/cacti
chown -R cacti rra/ log/
http://ip/cacti
按實際路徑設置
默認用戶名和密碼 admin
定時執行
yum install vixie-cron
crontab -u cacti -e
*/1 * * * * /usr/local/php1/bin/php /home/www/cacti/poller.php > /dev/null 2>&1
注意:如果在path中 提示找不到路徑的話 檢查php.ini 是否設置了open_basedir
故障排除
無數據檢查過程
檢查是否有數據返回
snmpwalk -v 2c -c public 10.0.2.88 if
rrdtool 是否有數據
/opt/rrdtool/bin/rrdtool fetch 13.rrd AVERAGE
還有就是要注意選擇的模板是否正確
http://xxxxxx/Linuxjc/1134358.html TechArticle