Cacti 簡訊報警
我按照下面這個文檔做了一下簡訊報警:
http://blog.chinaunix.net/u/249/showart_1162952.html
可是我根本找不到:
thold–functions.php里的thold_mail($global_alert_address, 」, $subject, $msg, $file_array);
我現在用thold是0.3.9的版本
大哥大姐們幫幫忙!謝謝!
《解決方案》
thold_mail($alert_emails, '', $subject, $msg, $file_array); 這句根本就找不到的不用找了 肯定不對的 ,我現在把
exec("echo $subject >> /usr/share/cacti/plugins/thold/alert.log");
exec("sh /usr/share/cacti/plugins/thold/sendsms.sh");
這2句 加在 include_once($config["base_path"] . "/plugins/settings/include/mailer.php")下面能實現簡訊報警
《解決方案》
不知道你的插件裝了沒有
《解決方案》
回復 #1 lingfengxp 的帖子
推薦你用nagios實現
nagios的實現方式參考如下
# vi commands.cfg 在配置命令添加簡訊報警
#service notify by sms
define command {
command_name service-notify-by-sms
command_line /usr/local/bin/sms_send.sh "'$HOSTADDRESS$' $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$"
}
#host-notify-by-sms
define command {
command_name host-notify-by-sms
command_line /usr/local/bin/sms_send.sh "Host $HOSTSTATE$ alert for $HOSTNAME$! on '$DATETIME$'"
}
編寫SMS_SEND腳本
# cat /usr/local/bin/sms_send.sh
#!/bin/bash
msg="$1"
for phone_num in 15811111111 13411111*** 1351075***** 131448*****
do
wget -O /dev/null "http://203.86.*.*0:8009/test/smstest.aspx?phone=$phone_num&content=$msg"
done
#
# vi contacts.cfg
define contact{
contact_name nagios
# use generic-contact ; Inherit default values from generic-contact template (defined above)
service_notification_period 24x7
# alisa system administrator
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands service-notify-by-sms,notify-service-by-email
host_notification_commands notify-host-by-email,host-notify-by-sms
# email
[email protected] # pager 13999999999
email
[email protected] ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
通過日誌即可看見報警簡訊郵件發出
《解決方案》
謝謝上面的兩位,CACTI已經用了一段時間了,上頭指定的。
我的thold已經安裝了,是0.3.9
我在網上也看到很多人在問相關的問題。
《解決方案》
回復 #1 lingfengxp 的帖子
我也是這情況。。。
《解決方案》
原帖由 lingfengxp 於 2008-11-18 18:23 發表 http://linux.chinaunix.net/bbs/images/common/back.gif
我按照下面這個文檔做了一下簡訊報警:
http://blog.chinaunix.net/u/249/showart_1162952.html
可是我根本找不到:
thold–functions.php里的thold_mail($global_alert_address, 」, $subject, $msg, $fi ...
http://new.qzone.qq.com/56802890/blog/1226897360
這篇文章也許能幫到你,呵呵,我們公司的用的就是這個!!!
《解決方案》
thold–functions.php 是一個php文件,
下面兩句的意思是把$subject讀出來並寫到/usr/share/cacti/plugins/thold/alert.log里。
thold_mail($alert_emails, '', $subject, $msg, $file_array);
exec("echo $subject >> /usr/share/cacti/plugins/thold/alert.log");
exec("/usr/share/cacti/plugins/thold/sendsms.sh");
現在是不能把$subject讀出來並寫到/usr/share/cacti/plugins/thold/alert.log里。
如果能寫了,再執行下一步就應該可以了。
是不是語法有錯誤?
《解決方案》
加我 QQ 363671802 我和你情況一樣 和你討論下
《解決方案》
thold 這個不好用,經常會亂報,還是nagios實時監控功能好