之前已經介紹過了MSN報警機制和CACTI在Windows和Linux下的搭建的方法,今天來講講如何實作飛信報警
畢竟飛信能把資訊傳達到我們的手機上麼
而且免費哈……….
一、 軟體環境:cacti(需Threshold插件)
二、 安裝過程:
Cacti的安裝各位baidu一下,這裡就不詳細介紹了。
安裝Threshold插件
V0.3.9下載下傳位址:http://mirror.cactiusers.org/downloads/plugins/thold-0.3.9.tar.gzv
安裝Threshold插件,隻需将解壓出來的Thold目錄拷貝到cacti/plugins/目錄下,并修改cacti配置檔案(cacti目錄下的include/config.php)。在配置中查找$plugins = array();行,在此行下面加入:
$plugins[] = 'thold';
重新整理cacti首頁,你将看到多出來一個Threshld頁籤。如下所示

三、 配置過程:
1.設定Threshold插件:選中console頁籤,在左側菜單中點選Settings,然後點選Alerting/Thold頁籤
2.設定發送警報通知:在Default Alerting Options中選擇Send notifications
3.設定出現down機的情況時(即Monitor出現如圖所示
)發送警報通知:選擇Dead Hosts notifications
報警郵件範例如下:
Host Error : 192.168.1.220 (192.168.1.220) is DOWN
Message : Host did not respond to SNMP (down機報警)
Host Notice : 192.168.1.207 (192.168.1.207) returned from DOWN state (恢複)
4.設定警報發送純文字的電子郵件沒有圖(預設是HTML電子郵件與圖表嵌入在電子郵件):選擇Send alerts as text
5.設定周末不執行報警檢查:選擇Weekend exemptions
6.設定報警的門檻:Default Trigger Count
7.設定Emailing Options
Mail Services:SMTP。(可以選擇PHP mail,sendmail,SMTP三種方式)
From Email Address:按實際設定
From Name:按需要設定(該處顯示的name就是email的發件人姓名)
8.設定Sendmail Options(Mail Services設定為sendmail需設定此項)
Sendmail Path:/usr/sbin/sendmail(路徑是伺服器上Sendmail的,僅用于郵件服務標明為Sendmail)
9.設定SMTP Options(Mail Services設定SMTP需設定此項)
SMTP Hostname:SMTP伺服器如:mail.test.com
SMTP Port:25
SMTP Username: 通過SMTP發送郵件用來驗證的使用者名,如果你不要求身份驗證留白
SMTP Password:通過SMTP發送郵件用來驗證的密碼,如果你不要求身份驗證留白
測試:點選Send a Test Email,測試成功如下所示:
收到的測試郵件範例:
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: SMTP
Host: mail.ips.com.cn
Port: 25
Authenication: true
Username: john.lv
Password: (Not Shown for Security Reasons)
配置完成後别忘記save。
下面我以磁盤空間報警為例,來設定具體的報警資訊(CPU,DISK,服務,網絡等等)
在console頁籤下左側菜單中點選Threshold Templates 。
在如下圖所示中點選Add按鈕來添加一個Threshold模闆
添加磁盤監控的模闆,無論是linux還是windows都是使用的Host MIB
設定按照百分比來監控的,在Data Field選擇hdd_percent,可以選擇hdd_total,hdd_used,hdd_percent三種
設定以下資訊(參照下圖:)
選擇Enabled 激活檢查和報警提醒
High Threshold文本框中填入0.085,意思是當硬碟使用率超過85%時,發送郵件報警。
Threshold CDEF下拉框選擇Divide by 1024,
Alert E-Mail填入報警的接收郵箱
完成Threshold模闆的添加。
應用剛才建立的Threshold模闆
在console頁籤下點選Management ->Devices,選擇要應用此模闆的Host,點選最上面的Create Graphs for this Host連結,然後點選Auto-create thresholds連結來應用剛建立的Threshold模闆。
設定完成後在console頁籤下左側菜單中點選Thresholds
在此可以管理已建立的警報,如下:
點選threshld頁籤可以檢視警報的觸發情況,如下:
磁盤報警郵件範例: