作者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/m.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