cacti下利用thold插件来进行EMAIL和MSN报警

cacti下利用thold插件来进行EMAIL和MSN报警(监控网卡流量大于10兆),交换机某个网卡流量大于10兆,那么自动报警!!

原来做nagios。后来由于glibc的版本问题,报警功能搁浅了公司从mrtg到cacti和nagios也有半年多了吧最近才从黑客安全里面出来,所以才回头来继续做cacti下的监控报警关于cacti的安装,网上很多很多方法,或者就下载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的话,那么这个插件已经自带的了。就不用在安装了~~~===================================================我们接下来开始配置
我们现在想监控的是交换机端口流量大于10M,那么自动会发email和MSN信息给指定人。因为thold是0.3.9版本,所以里面的一些设置可能和老版本不大一样
1.Console -> Cacti Settings-Alerting/Thold 选项下面这些都是主意修改的地方
Base URL                  这个会自动发现不用写Syslogging                  这个勾要选择,不然他不会给你发邮件Dead Hosts Notifications    这个要选择Dead Host Notification Email   这个是主机down掉会发邮件通知谁(这里写自己的邮局,我的就是
[email]aiyomama@aiyomama.cn[/email]
)From Email Address    写邮件的发送方  这边为了醒目,我就写
[email]xxxxxxxx@aiyomama.cn[/email]
From Name             写problem alert其余的默认就好
Console -> Cacti Settings --Mail / DNS 选项
Mail Services    我用的是SMTP ,根据自己的选择,但是大部分情况用sendmail会出错+From Email Address   
[email]xxxxxxxx@aiyomama.cn[/email]
From Name           problem alert
SMTP Options中都要写真实的自己的邮局,不然smtp的发信机制会发布出去
SMTP Hostname     写自己的,我的是mail.aiyomama.cnSMTP Port           25SMTP Username      
[email]ehco@aiyomama.cn[/email]
SMTP Password        xxxx下面的dns自己写然后Test Email           这边填写测试邮箱名字
[email]test@aiyomama.cn[/email]
完成了这些,点击右上角的Send a Test Email
这个时候在新窗口出现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:
[email]echo@aiyomama.cn[/email]
Password: (Not Shown for Security Reasons)
Sending Message...
Success!  那么代表ok了.
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、Threshold Templates --ADD---Interface-Tffic--traffic_in/out--下一步
High Threshold   这里我填写10  意思就是超过10M那么就自动报警Threshold CDEF    选择Byte to MbitsAlert E-Mail   通知email ,我填写
[email]aiyomama@aiyomama.cn[/email]
其余的都是默认就好了
4.Management--Devices 选择相应的设备名选择Create Graphs for this Host ---Auto-create thresholds 他会自行创建!
5.Management---Thresholds 里面可以看到显示信息。如果流量大于10兆,那么就是红色显示
Email发信目前就算完成了!其余就是测试了或者根据自己的需要修改发送时间!
其中一些方案来自
http://www.hiadmin.com/cacti%e9% ... %e6%8a%a5%e8%ad%a6/
http://blog.s135.com/category_12.htm
http://www.aiyomama.cn/2009/0204/29888.html
============================================================================================================================================================1.发送邮件报警错误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发信机制改成smtp2.如果出现553.3.8.2 认证错误,那么请填写正确smtp信息比如用户名密码
参与0

0同行回答

“答”则兼济天下,请您为题主分忧!

提问者

擅长领域: 服务器Linux云计算
评论110

相关问题

相关资料

问题状态

  • 发布时间:2013-06-24
  • 关注会员:0 人
  • 问题浏览:8831
  • X社区推广