cacti短信预警功能

简介:

11、Cacti 短信预警的几种模式

139邮箱

飞信机器人

推立方和短信猫

 

11.1 139邮箱实现短信预警

如下图设置,设置完成保存退出(未测试!)

210131181.jpg

11.2 飞信机器人实现短信预警

下载飞信机器人程序

wget http://www.it-adv.net/fetion/downng/fetion20091117-linux.tar.gz

tar zxvf fetion20091117-linux.tar.gz

mv fx /usr/local/feition/

cp /usr/local/fetion/fx/*.so* /usr/lib/

安装飞信更新

Wget http://bbs.it-adv.net/attachment.php?aid=9&k=769be60f28c9f06ca97bcca5d8c49360&t=1346055120

(需要注册账号)

Cp fetion /usr/local/fetion/fx/fetion

Chmod 777 /usr/local/fetion/fx/*

运行测试

LD_LIBRARY_PATH=/usr/local/fetion/fx//usr/local/fetion/fx/fetion --mobile=*** --pwd=*** --to=*** --msg-type=1 --msg-utf8=’hello, It is cacti test!’

输出以下信息,OK!

SIP-C/4.0 280 Send SMS OK

T: sip:712808499@fetion.com.cn;p=3547

I: 2

Q: 1 M

L: 114

D: Mon, 27 Aug 2012 08:16:43 GMT

XI: 9C6372B22E5BA3664CF6FC8C1FA4C825

修改thold_fucation .php

Cd /var/www/localhost/htdocs/cacti/plugins/thold/

vi thold_fucation.php

function thold_mail($to, $from, $subject, $message, $filename, $headers = '') {

global $config;

include_once($config['base_path'] . '/plugins/settings/include/mailer.php');

//change for cacti

exec("echo $subject >>/var/www/localhost/htdocs/cacti/plugins/thold/alter.log");

exec("/var/www/localhost/htdocs/cacti/plugins/thold/sendsms.sh");

//change end

include_once($config['base_path'] . '/plugins/thold/setup.php');

$subject = iconv("UTF-8", "GB2312//IGNORE", $subject);

$subject = trim($subject);

$message = iconv("UTF-8", "GB2312//IGNORE", $message);

$message = str_replace('<SUBJECT>', $subject, $message);

添加sendsms.sh

#!/bin/sh

#send sms by fetion

#Write by hugwww

if [ ! -e "/var/www/localhost/htdocs/cacti/plugins/thold/alter.log" ];then

echo "Usage:alter.log does not exist"

exit

fi

 

 

if [ -n "`cat /var/www/localhost/htdocs/cacti/plugins/thold/alter.log`" ]; then

LD_LIBRARY_PATH=/usr/local/fetion/fx//usr/local/fetion/fx/fetion --mobile=137******** --pwd=************ --to=137******** --msg-type=1 --file-gb=/var/www/localhost/htdocs/cacti/plugins/thold/alter.log

rm -f /var/www/localhost/htdocs/cacti/plugins/thold/alter.log

else

echo "Usage:no alter"

exit

fi

测试

添加一个alter.log, 并随便输入点字符

./sendsms.sh 测试,报权限不够

chmod +x sendsms.sh

chown apache:apache sendsms.sh

./sendsms.sh测试,收到信息!短信机器人安装配置完成!剩下的是cacti警告配置文件修改!

 

11.3推立方和短信猫

要花钱的,仅参考,不考虑!

11.4 飞信安装遇到的错误

11.4.1 找不到libgssapi_krb5.so.2

fetion: error while loading shared libraries: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory

解决方法:

EmergeGSSAPP

emerge 前后可以运行ldd fetion查看运行安装的模块。

11.4.2 验证码问题

可以通过filezilla工具或者安装samba工具将验证图片拷贝出来查看验证码数字,验证码图片在安装目录下。

 










本文转自 chengchow 51CTO博客,原文链接:http://blog.51cto.com/chengchow/1213367,如需转载请自行联系原作者
目录
相关文章
|
监控 小程序 开发工具
Zabbix配置微信报警和邮件报警
Zabbix配置微信报警和邮件报警
Zabbix配置微信报警和邮件报警
|
监控 Python 前端开发
|
监控 测试技术 开发工具