- 論壇徽章:
- 0
|
cacti下利用thold插件來進行EMAIL和MSN報警(監(jiān)控網(wǎng)卡流量大于10兆),交換機某個網(wǎng)卡流量大于10兆,那么自動報警!!
原來做nagios。后來由于glibc的版本問題,報警功能擱淺了公司從mrtg到cacti和nagios也有半年多了吧最近才從黑客安全里面出來,所以才回頭來繼續(xù)做cacti下的監(jiān)控報警關于cacti的安裝,網(wǎng)上很多很多方法,或者就下載cactiEZ自動安裝就好了我原來也做過手工安裝cacti方法,自己blog里面找。
http://www.6xuan.com/read.php/246.htm
======================================下面記下關于email報警的問題如果你是手工編譯cacti安裝的話,那么那么需要安裝插件thold
下載地址
http://mirror.cactiusers.org/downloads/plugins/thold-0.3.9.tar.gz
安裝Threshold插件。將解壓出來的Thold目錄拷貝到cacti/plugins/目錄下,并修改cacti配置文件(cacti目錄下的include/config.php)。在配置中查找$plugins = array();行在此行下面加入: $plugins[] = 'thold';
如果你是安裝的cactiEZ的話,那么這個插件已經(jīng)自帶的了。就不用在安裝了~~~===================================================我們接下來開始配置
我們現(xiàn)在想監(jiān)控的是交換機端口流量大于10M,那么自動會發(fā)email和MSN信息給指定人。因為thold是0.3.9版本,所以里面的一些設置可能和老版本不大一樣
1.Console -> Cacti Settings-Alerting/Thold 選項下面這些都是主意修改的地方
Base URL 這個會自動發(fā)現(xiàn)不用寫Syslogging 這個勾要選擇,不然他不會給你發(fā)郵件Dead Hosts Notifications 這個要選擇Dead Host Notification Email 這個是主機down掉會發(fā)郵件通知誰(這里寫自己的郵局,我的就是
aiyomama@aiyomama.cn
)From Email Address 寫郵件的發(fā)送方 這邊為了醒目,我就寫
xxxxxxxx@aiyomama.cn
From Name 寫problem alert其余的默認就好
Console -> Cacti Settings --Mail / DNS 選項
Mail Services 我用的是SMTP ,根據(jù)自己的選擇,但是大部分情況用sendmail會出錯+From Email Address
xxxxxxxx@aiyomama.cn
From Name problem alert
SMTP Options中都要寫真實的自己的郵局,不然smtp的發(fā)信機制會發(fā)布出去
SMTP Hostname 寫自己的,我的是mail.aiyomama.cnSMTP Port 25SMTP Username
ehco@aiyomama.cn
SMTP Password xxxx下面的dns自己寫然后Test Email 這邊填寫測試郵箱名字
test@aiyomama.cn
完成了這些,點擊右上角的Send a Test Email
這個時候在新窗口出現(xiàn)Checking Configuration...Method: SMTPCreating Message Text...
This is a test message generated from Cacti. This message was sent to test the configuration of your Mail Settings.
Your email settings are currently set as follows
Method: SMTPHost: mail.aiyomama.cnPort: 25Authenication: trueUsername:
echo@aiyomama.cn
Password: (Not Shown for Security Reasons)
Sending Message...
Success! 那么代表ok了.
2.由于cacti里面自帶的沒有我需要的,不是很直觀,而且換算來換算去很麻煩,網(wǎng)上搜索了下自己定義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,/
數(shù)據(jù)源 * 8 / 1024 / 1024 (Mbits)
現(xiàn)在我們就可以在Threshold Templates添加監(jiān)控流量的模板了
3、Threshold Templates --ADD---Interface-Tffic--traffic_in/out--下一步
High Threshold 這里我填寫10 意思就是超過10M那么就自動報警Threshold CDEF 選擇Byte to MbitsAlert E-Mail 通知email ,我填寫
aiyomama@aiyomama.cn
其余的都是默認就好了
4.Management--Devices 選擇相應的設備名選擇Create Graphs for this Host ---Auto-create thresholds 他會自行創(chuàng)建!
5.Management---Thresholds 里面可以看到顯示信息。如果流量大于10兆,那么就是紅色顯示
Email發(fā)信目前就算完成了!其余就是測試了或者根據(jù)自己的需要修改發(fā)送時間!
其中一些方案來自
http://www.hiadmin.com/cacti%e9%85%8d%e7%bd%aee-mail%e6%8a%a5%e8%ad%a6/
http://blog.s135.com/category_12.htm
http://www.aiyomama.cn/2009/0204/29888.html
============================================================================================================================================================1.發(fā)送郵件報警錯誤Checking Configuration...Creating Message Text...This is a test message generated from Cacti. This message was sent to test the configuration of your Mail Settings.Your email settings are currently set as followsMethod: SendmailSendmail Path: /usr/sbin/sendmailSending Message...ERROR: DirectInject command output: 'Recipient names must be specified ' error: ''DirectInject command output: 'Recipient names must be specified ' error: ''===================那么setting---mail/DNS選項或者alert選項中,把sendmail發(fā)信機制改成smtp2.如果出現(xiàn)553.3.8.2 認證錯誤,那么請?zhí)顚懻_smtp信息比如用戶名密碼
本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/12029/showart_2163809.html |
|