天天看點

cacti元件安裝-實時報警

【cacti-plugin-arch更新檔】

cd /tmp

wget http://cactiusers.org/downloads/cacti-plugin-arch.tar.gz

tar -xzvf cacti-plugin-arch.tar.gz

cp cacti-plugin-arch/cacti-plugin-0.8.7b-PA-v2.1.diff /data/www/cacti/

mysql -ucacti -pcactipw cacti < cacti-plugin-arch/pa.sql

cd /data/www/cacti/

patch -p1 -N < cacti-plugin-0.8.7b-PA-v2.1.diff

【安裝settings插件】

wget http://mirror.cactiusers.org/downloads/plugins/settings-0.5.tar.gz

tar  -xzvf settings-0.5.tar.gz

mv settings /data/www/cacti/plugins/

vi /data/www/cacti/include/global.php

$plugins[] = 'settings';    //添加插件資訊

【安裝Threshold插件】

wget http://mirror.cactiusers.org/downloads/plugins/thold-0.4.1.tar.gz

tar -xzvf thold-0.4.1.tar.gz

mv thold /data/www/cacti/plugins/

$plugins[] = 'thold';      //添加插件資訊

設定資料庫資訊以及插件.

mysql -ucacti -pcactipw cacti < /data/www/cacti/plugins/thold/thold.sql

【安裝monitor插件】

tar –zxvf monitor-0.8.2.tar.gz

mv monitor /data/www/cacti/plugins/

$plugins[] = ' monitor ';   //添加插件資訊

添加後顯示如下:

$plugins = array();

$plugins[] = 'settings';

$plugins[] = 'thold';

$plugins[] = ' monitor ';

【設定使用者權限】

【設定thold】

Setting à Alerting/Thold

Dead Hosts Notifications //勾選,當監控伺服器down後就自動發送報警資訊

Send alerts as text   //發送文本報警資訊

From Email Address    //發送郵件位址

Setting à Mail/DNS

【設定Threshold Templates】

1、監控硬碟空間、記憶體使用情況并報警

在”Plugin Management”中安裝、啟用之後,點選Threshold Templates後建立一個名字叫“Host MIB – Hard Drive Space [hdd_used]”的template注意選好Data Type為Percentage,Percent Datasource選hdd_total,填上報警的上閥值High Threshold為合适值,注意,這是百分比,我一般填80填上報警的email位址,以後便可在”Create Graphs”的頁面裡點選”Auto-create thresholds”建立threshold了

2、監控網卡流量并報警

由于cacti裡面自帶的沒有我需要的,不是很直覺,而且換算來換算去很麻煩,網上搜尋了下自己定義CDEF,可以很好的顯示流量。

Create a Console->Graph Management->CDEF->add

 “Byte to Mbits”---這個事名稱

Item Item Value

Item #1 Special Data Source: CURRENT_DATA_SOURCE

Item #2 Custom String: 8

Item #3 Operator: *

Item #4 Custom String: 1024

Item #5 Operator: /

Item #6 Custom String: 1024

Item #7 Operator: /

就是:cdef=CURRENT_DATA_SOURCE,8,*,1024,/,1024,/

資料源 * 8 / 1024 / 1024 (Mbits)

現在我們就可以在Threshold Templates添加監控流量的模闆了

3、監控CPU

【create thresholds】

Management--Devices 選擇相應的裝置名

選擇Create Graphs for this Host ---Auto-create thresholds

會自行建立

報警郵件: