作者xxoo1122 (声声慢)
看板MIS
标题[心得] Cacti+SMS简讯告警
时间Sat Aug 23 13:31:08 2014
Cacti一直都是网管人的最爱,Cacti也推出一段时间了但是一直没有好的SMS简讯告警
的外挂,势必得自己改程式
解题思路:要在thold的email alert function 中另外call sms的php程式
并且把alert message传递到sms的php程式.
1.首先得安装好Cacti+thold
2.接着我们的先选好一家简讯服务商,我用的是every8d(
http://tw.every8d.com/),
可以在every8d的官方网站找到API2.1 的范例程式
(
http://tw.every8d.com/template/every8d/document/download.html),
在php的资料夹中有两个档案index.php,SMSHttp.php,避免档名重复所以把index.php
改成sms.php,然後把这两个php档放在/usr/share/cacti/plugins/thold 中
3.再来修改thold_functions.php这只程式,找到
function thold_mail($to, $from, $subject, $message, $filename, $headers = '')
移动到function 的最尾端可以看到return ''; ,在return '';前加入
$sms = shell_exec('php /usr/share/cacti/plugins/thold/sms.php '
.escapeshellarg($message).'');
4.修改sms.php,将改为 $content = $argv[1];
5.大功告成,这样cacti就能发简讯了
6.你可以在thold中定义 ex:CPU使用率,Interface流量,网路latency超过多少的值
就发告警
最後收到的简讯会是这样
http://ppt.cc/ifgF
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 59.115.51.64
※ 文章网址: http://webptt.com/cn.aspx?n=bbs/MIS/M.1408771870.A.07F.html
1F:推 shuinedu: 好文帮推 08/23 15:30
2F:推 occupy222: 推 08/26 03:15
3F:推 renice: 真不想三不五时收系统简讯 08/26 16:29
4F:推 JOHN001123: 简讯人生 (叹 08/27 13:49