cacti 安裝配置

   mysql,php,apache看lamp的安裝文章

 

二、rrdtool安裝

   1.到http://oss.oetiker.ch/rrdtool/download.en.html下載rrdtool

   2.  先跟新rrdtool要依賴的軟件包

        yum -y install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel intltool

  3.解壓,安裝

    ./configure --prefix=/usr/local/rrdtool && make && make install

    用/usr/local/rrdtool/rrdtool -v 查看是否安裝成功!

 

net-snmp服務的安裝

1.到http://www.net-snmp.org/download/下載net-snmp源碼包,進入解壓後源碼包目錄

(./configure   make && make install)--在監控服務器上安裝方法

2.#./configure --prefix=/usr/local/net-snmp --enable-developer  (加入--enable-developer 是爲了支持cactid的,但是目前沒有采用cactid,你默認版本、用戶名、perl模塊和路徑之類的問題,一路回車)

   make && make install

3.cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf

4.vi /usr/local/net-snmp/share/snmp/snmpd.conf(修改配置)

   說明:對snmpd.conf的編輯只能用空格,不能用Tab鍵,否則會出錯。

  com2sec local     localhost       public
  com2sec mynetwork 10.0.0.0/24      COMMUNITY (其他可以接受的ip地址)

 5.啓動  (這裏的啓動,是啓動snmp的服務器監控端,只有啓動了,才能用snmpwalk測試)

    cd /usr/local/net-snmp/sbin/

    ./snmpd -c ../share/snmp/snmpd.conf

6.測試:/usr/local/net-snmp/bin/snmpwalk -v 2c -c public localhost system

   有返回信息,則安裝成功!

 

 

 

 spine的安裝

1. 在http://www.cacti.net/下載最新版本,解壓

2. ./configure --prefix=/usr/local/spine && make && make install 

用yum安裝的net-snmp時,安裝spine之前還要yum -y install net-snmp-devel

 

 

cacti安裝配置

1. 在http://www.cacti.net/下載最新版本,解壓

2.copy解壓目錄到/usr/local/httpd/htdocs/cacti

3.配置帳號及mysql:

 

useradd cactiuser

mysql -uroot -p

mysql> create database cacti;

mysql> grant all privileges on cacti.* to cactiuser@localhost identified by "cactiuser";

mysql> flush privileges;

mysql> exit

 

 Catci配置:
# mysql cacti -uroot -p < cacti.sql

   mysql cacti 用show tables;查看

   chown -R root.root cacti/
# chown -R cactiuser rra/ log/
# vi include/config.php

  1. $database_type = "mysql";
  2. $database_default = "cacti";
  3. $database_hostname = "localhost";
  4. $database_username = "cactiuser";
  5. $database_password = "cactiuser";
  6. $database_port = "3306";

 配置讓系統每五分鐘去取一次snmp數據:
#crontab -u cactiuser -e   //注意要用cactiuser就是你剛剛建立的那個帳號去運行crontab

*/5 * * * *   /usr/local/php/bin/php /usr/local/www/htdocs/cacti/poller.php > /dev/null 2>&1

或:vi /etc/crontab,增加:

*/5 * * * * cactiuser /usr/local/php/bin/php /usr/local/www/htdocs/cacti/poller.php >/dev/null 2>&1

(用spine時可以改成1分鐘刷一次)

* * * * *   /usr/local/php/bin/php /usr/local/www/htdocs/cacti/poller.php > /dev/null 2>&1

 

 plugin Architecture的安裝

 

wget http://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7e-PA-v2.6.zip

unzip cacti-plugin-0.8.7e-PA-v2.6.zip  
進入解壓目錄,導入數據庫:
mysql cacti < pa.sql

 

cp cacti-plugin-0.8.7e-PA-v2.6.diff /usr/local/www/htdocs/cacti/

cd /usr/local/www/htdocs/cacti/

patch -p1 -N < cacti-plugin-0.8.7e-PA-v2.6.diff

===================

注:若php是系統自帶安裝的這用這個方法打補丁會報錯,則用如下的方法安裝:

仔細讀了一下同級目錄的readme.txt:裏面提示說如果通過rpm包的方式安裝的建議,直接把files裏的文件直接覆蓋。我就鬱悶了,我之所以上一篇文章說要把安裝的cacti更新到最新的版本就是怕出現這樣的版本不一致的情況,結果還是發生了。最後還是覆蓋了一下解決了問題。

rsync -avz ./files-0.8.7e/* /var/www/html/cacti/
===================
修改include/global.php

vi include/global.php
將$config['url_path'] = ‘/’;改爲:$config['url_path'] = ‘/cacti/’;

 

 

 settings安裝

下載:wget wget http://docs.cacti.net/_media/plugin:settings-latest.tgz

cp -r  settings-0.6/ /usr/local/www/htdocs/cacti/plugins/settings

繼續修改include/global.php

#vi include/global.php

在$plugins = array();的後面加上如下內容
$plugins[] = 'settings';

 

安裝thold,monitor插件
monitor插件,提供更簡略、直觀的設備狀態圖示;
thold插件,提供設備異常預警。

cd cacti/plugins
#wget wget http://docs.cacti.net/_media/plugin:settings-latest.tgz

#tar zxvf setting.tgz

#wget http://mirror.cactiusers.org/downloads/plugins/thold-0.4.1.tar.gz
#tar zxvf thold-0.4.1.tar.gz
#wget wget http://mirror.cactiusers.org/downloads/plugins/monitor-0.8.2.tar.gz

#tar zxvf monitor.tar.gz

導入數據庫

 mysql cacti <monitor.sql 

 mysql cacti <thold.sql

#vi include/global.php
在$plugins = array();的後面加上如下內容
$plugins[] = ‘thold’;
$plugins[] = ’settings’;
$plugins[] = monitor;

 

使用插件
使用monitor插件
刷新cacti系統web管理界面,可以看到多出兩個標籤頁(thold、monitor)。
1>打開“Console->Settings->Misc”,可以調整Monitor的各項配置。例如:勾選“Show Icon Legend”可以在監控頁面顯示圖例;
“View”可以選用Tiles類型,以顯示設備狀態表格。
2>爲cacti添加新設備時,勾選上“Monitor Host”項。對已添加的設備可以通過“Management->Devices”進去修改。
3>單擊Web頁面上方的“monitor”標籤鏈接,可以進入查看各設備/主機的狀態圖示。

使用thold插件
1>打開“Console->Settings->Mail/DNS”,可以調整“SMTP Options”和“DNS Options”等配置,用於確保預警郵件能夠發出。
2>打開“Console->Settings->Alerting/Thold”,可以調整Thold的各項配置。例如:“Dead Host Notifications Email”處可填寫設備當機時發送警告信息到哪個郵箱;勾選“Send alerts as text”項,可以設置只發送文本格式的郵件。
3>打開“Templates->Threshold Templates”,可以添加、取出需要關聯到預警系統的模板,例如:可以添加和“Interface-Traffic”模板的關聯,選擇 “traffic_in”、

“traffic_out”數據項,分別設置警告閾值“High Threshold”(如200000000比特/秒);可以添加和“Unix-Disk Space”模板的關聯……。
4>打開“Create->New Graphs”,選擇需要提供預警的設備,單擊右側上方的“Auto-create thresholds”創建預警項目。
5>打開“Management->Thresholds”,可以管理已經創建的預警項目。

 

=========================================================

snmp--一般端口流量分析

針對普通網絡設備的端口,MIB的相關定義是Interface組,主要管理如下信息:
ifIndex                 端口索引號
ifDescr                 端口描述
ifType                端口類型
ifMtu                最大傳輸包字節數
ifSpeed                 端口速度
ifPhysAddress           物理地址
ifOperStatus          操作狀態
ifLastChange          上次狀態更新時間
*ifInOctets          輸入字節數
*ifInUcastPkts       輸入非廣播包數
*ifInNUcastPkts       輸入廣播包數
*ifInDiscards           輸入包丟棄數
*ifInErrors          輸入包錯誤數
*ifInUnknownProtos    輸入未知協議包數
*ifOutOctets          輸出字節數
*ifOutUcastPkts       輸出非廣播包數
*ifOutNUcastPkts        輸出廣播包數
*ifOutDiscards       輸出包丟棄數
*ifOutErrors          輸出包錯誤數
ifOutQLen             輸出隊長
其中,*號標識的是與網絡流量有關的信息。

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章