Cacti的安裝配置
Cacti的安裝配置
1.使用如下命令來安裝cacti,這個會自動安裝需要的組件。
- [root@tigertall php.d]# yum install cacti
2.創(chuàng)建mysql數(shù)據(jù)庫
- [root@tigertall php.d]# mysqladmin -uroot -phandomse create cacti
3.導(dǎo)入默認的cacti數(shù)據(jù)庫
如果使用yum默認安裝,創(chuàng)建數(shù)據(jù)庫的腳本
默認在/usr/share/doc/cacti-0.8.7f/cacti.sql
- [root@tigertall php.d]# cd /usr/share/doc/cacti-0.8.7f/
執(zhí)行創(chuàng)建數(shù)據(jù)庫的命令
- [root@tigertall 0.8.7.f]# mysql -uroot -phandomse cacti < cacti.sql
4.創(chuàng)建cacti數(shù)據(jù)庫的用戶和密碼,
登錄到數(shù)據(jù)庫
- [root@tigertall 0.8.7.f]# mysql -u root -p 'pass'
用戶授權(quán),請把用戶名,數(shù)據(jù)庫和密碼換成自己需要的設(shè)置。
- mysql> GRANT ALL ON cacti.* TO cactiuser@localhost
- --> IDENTIFIED BY 'password';
刷新權(quán)限
- mysql> flush privileges;
5.編輯cacti配置,做數(shù)據(jù)連接設(shè)置
- [root@tigertall include]# vi /usr/share/cacti/include/config.php
這里有cacti連接使用的數(shù)據(jù)庫類型,用戶名,密碼信息
- /* make sure these values refect \*/
- /* your actual database/host/user/password */
- $database_type = "mysql";
- $database_default = "cacti";
- $database_hostname = "localhost";
- $database_username = "cactiuser";
- $database_password = "cactiuser";
- $database_port = "3306";
- /* Default session name - Session name must */
- /* contain alpha characters */
- #$cacti_session_name = "Cacti";
把上述配置按照自己的需要設(shè)置
6.目錄權(quán)限設(shè)置
- [root@tigertall include]# cd /usr/share/cacti/
- [root@tigertall cacti]# ll rra
- lrwxrwxrwx 1 root root 18 Jul 17 15:07 rra -> /var/lib/cacti/rra
- [root@tigertall cacti]# ll log
- lrwxrwxrwx 1 root root 15 Jul 17 15:07 log -> /var/log/cacti/
從上述可以看到,rra實際上是var/lib/cacti/rra的一個軟鏈接,
log則是/var/log/cacti的一個軟鏈接。
更改上述目錄的權(quán)限,按需要更改屬主,下面生成數(shù)據(jù)會用到這個用戶。
- [root@tigertall cacti]# chown -R gaohu rra/ log/
7.配置自動作業(yè)時間
編輯crontab。
- [root@tigertall log]# crontab -e
增加如下內(nèi)容,
- */5 * * * * php /usr/share/cacti/poller.php > /dev/null 2>&1
注意:
這個地方不能按照官方文檔來,不能加上執(zhí)行的用戶名,
crontab根本沒有執(zhí)行用戶這個參數(shù)的,官方文檔是這樣的:
- */5 * * * * gaohu php /usr/share/cacti/poller.php > /dev/null 2>&1
按照這個設(shè)置,會報錯的:
- 07/17/2010 10:59:57 PM - POLLER: Poller[0] WARNING:
- Cron is out of sync with the Poller Interval!
- The Poller Interval is '300' seconds,
- with a maximum of a '300' second Cron,
- but 419 seconds have
- passed since the last poll!
會告警說設(shè)置的是300秒,結(jié)果400多秒了還沒有執(zhí)行過。Cacti下如果磁盤監(jiān)控不到、如果圖出不來、網(wǎng)卡流量達到100M以上圖像有問題如果碰到這一系列的問題該怎么辦?本文講述的是Cacti下的問題的解決技巧。
以上內(nèi)容意思是,每隔五分鐘,執(zhí)行下php腳本,統(tǒng)計下數(shù)據(jù)。
一個由此引發(fā)的問題見***。
8.登錄服務(wù)器
初始登錄時,用戶名和密碼為admin,登錄后,會要求立即切換密碼。
【編輯推薦】