cacti安装和第三方模块的导入
安裝cacti的準備條件:
wget http://www.cacti.net/downloads/cacti-0.8.8b.tar.gz
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
wget https://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz
LAMP環境。而且要開啟gd庫的支持,lamp環境的安裝這里不再給出
mysql-cacti-templates并非必須的。僅僅是為了后面方便演示第三方模板時候使用
一.安裝snmp服務
[root@test1 ~]# yum install net-snmp*
[root@test1 ~]# chkconfig snmpd on
[root@test1 ~]# service snmpd restart
[root@test1 ~]# vi /etc/snmp/snmpd.conf
改動例如以下內容:
?41行下的 com2sec notConfigUser ?default ? ? ? public
? ?? ??com2sec notConfigUser ?127.0.0.1 ?public
?62行下的access ?notConfigGroup "" ? ? ?any ? ? ? noauth ? ?exact ?systemview none none
? ?? ?access ?notConfigGroup "" ? ? ?any ? ? ? noauth ? ?exact ?all ? ?? ? ? ?none none
?85行下的#view all ? ?included ?.1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 80
? ? ? ??view all ? ?included ?.1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 80
[root@test1 ~]# service snmpd restart
二.安裝rrdtool
[root@test1 ~]# tar xf rrdtool-1.4.7.tar.gz
[root@test1 ~]# cd rrdtool-1.4.7
[root@test1 rrdtool-1.4.7]# ./configure --prefix =/usr/local/rrdtool
[root@test1 rrdtool-1.4.7]# make && make install
三.安裝cacti
[root@test1 ~]# tar xf cacti-0.8.8b.tar.gz -C /usr/local/apache/htdocs
[root@test1 ~]# cd /usr/local/apache/htdocs
[root@test1 ~]# cd /usr/local/apache/htdocs
[root@test1 ~]# mv cacti-0.8.8b cacti
進入數據庫中創建一個cacti的數據庫:
mysql> create database cacti;
mysql> grant all on cacti.* to cacti@localhost identified by 'cacti';
mysql> grant all on cacti.* to cacti@127.0.0.1 identified by 'cacti';
mysql> flush privileges;
編輯/etc/crontab,增加例如以下內如:
*/1 * * * * /usr/local/php/bin/php /usr/local/apache/htdocs/cacti/poller.php &> /dev/null
改動cacti的文件夾權限:
[root@test1 cacti]# chown -R root.root cacti/
導入cacti數據庫:
[root@test1 cacti]# /usr/local/mysql/bin/mysql -ucacti -p cacti < cacti.sql
編輯cacti配置文件。改成例如以下內容:
[root@test1 cacti]# cd include
[root@test1 cacti]# vi config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "127.0.0.1";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$database_ssl = false;
在瀏覽器中輸入下面地址:http://192.168.1.145/cacti/install/index.php,就會看到cacti的安裝了,點擊next會發現默認情況下cacti的路徑和php的路徑是不對的。僅僅須要把路徑改了就能夠。rrdtool改成:/usr/local/rrdtool/bin/rrdtool;php改成:/usr/local/php/bin/php
弄好點擊下一步,就能夠來到cacti的登陸界面了,默認的cacti的登陸用戶和password為:admin admin,輸入完畢以后會提示我們改動新的password。直接改成你須要的password就可以,然后運行/usr/local/php/bin/php /usr/local/apache/htdocs/cacti/poller.php,多運行幾次,再進入cacti打開graphs能夠看到圖片已經出來。
安裝過程中可能遇到的問題:
1.運行/usr/local/php/bin/php /usr/local/apache/htdocs/cacti/poller.php報時間錯誤。這是由于php.ini中沒有設置時間,在php.ini中增加date.timezone = "Asia/Shanghai"
2.流量圖出來不到,rra文件下沒有文件。這樣的原因可能非常多,首先檢查執行cacti的用戶進程是否對rra文件夾具有對應的權限。執行snmpwalk -v 2c -c public yourIP if看到是否有對應的信息返回。檢查settings中的對應配置是否正確。
cacti的默認情況下的模板和圖像是非常有限的,主要的流量監控操作也非常easy。可是大多數情況下,我們須要的流量監控不止這點點,所以須要安裝第三方模板。這里以mysql為例來安裝一個第三方的模塊監控
[root@test1 ~]# wget https://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz
[root@test1 ~]# tar –xvf better-cacti-templates-1.1.8.tar.gz
[root@test1 ~]# cd better-cacti-templates-1.1.8
[root@test1 better-cacti-templates-1.1.8]# cp scripts/ss_get_mysql_stats.php /usr/local/apache/htdocs/cacti/scripts/
[root@test1 better-cacti-templates-1.1.8]# cd /usr/local/apache/htdocs/cacti/scripts/
[root@test1 scripts]# vi ss_get_mysql_stats.php
改動
$mysql_user = 'cactiuser';
$mysql_pass = 'cactiuser';
為
$mysql_user = 'cacti';
$mysql_pass = 'cacti';
再次進入cacti的管理界面的Import Templates下導入/better-cacti-templates-1.1.8/templates/cacti_host_template_x_mysql_server_ht_0.8.6i-sver1.1.8.xml,然后在device設備下就能夠看到很多新的模板圖了。
在被監控主機上運行:grant all on *.* to 'cacti'@'%' identified by 'cacti';flush privileges;以后,其余的操作就給普通的操作一樣。
轉載于:https://www.cnblogs.com/jhcelue/p/6905599.html
總結
以上是生活随笔為你收集整理的cacti安装和第三方模块的导入的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c++ 纯虚函数导出
- 下一篇: LeetCode 540 有序数组中的单