linf 发表于 2013-5-31 08:39:56

cacti短信预警功能

11、Cacti 短信预警的几种模式139邮箱飞信机器人推立方和短信猫 11.1 139邮箱实现短信预警如下图设置,设置完成保存退出(未测试!)11.2 飞信机器人实现短信预警下载飞信机器人程序wget http://www.it-adv.net/fetion/downng/fetion20091117-linux.tar.gztar zxvf fetion20091117-linux.tar.gzmv 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/fetionChmod 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 OKT: sip:712808499@fetion.com.cn;p=3547I: 2Q: 1 ML: 114D: Mon, 27 Aug 2012 08:16:43 GMTXI: 9C6372B22E5BA3664CF6FC8C1FA4C825修改thold_fucation .phpCd /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 cactiexec("echo $subject >>/var/www/localhost/htdocs/cacti/plugins/thold/alter.log");exec("/var/www/localhost/htdocs/cacti/plugins/thold/sendsms.sh");//change endinclude_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 hugwwwif [ ! -e "/var/www/localhost/htdocs/cacti/plugins/thold/alter.log" ];thenecho "Usage:alter.log does not exist"exitfi

if [ -n "`cat /var/www/localhost/htdocs/cacti/plugins/thold/alter.log`" ]; thenLD_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.logrm -f /var/www/localhost/htdocs/cacti/plugins/thold/alter.logelseecho "Usage:no alter"exitfi

测试添加一个alter.log, 并随便输入点字符./sendsms.sh 测试,报权限不够chmod +x sendsms.shchown apache:apache sendsms.sh再./sendsms.sh测试,收到信息!短信机器人安装配置完成!剩下的是cacti警告配置文件修改!
11.3推立方和短信猫要花钱的,仅参考,不考虑!11.4 飞信安装遇到的错误11.4.1 找不到libgssapi_krb5.so.2fetion: 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工具将验证图片拷贝出来查看验证码数字,验证码图片在安装目录下。

yp1234 发表于 2013-5-31 09:31:33

真是 收益 匪浅

fateame 发表于 2013-5-31 09:38:29

穿别人的鞋,走自己的路,让他们找去吧。

爱她吗 发表于 2013-5-31 10:56:01

路过,支持一下啦

fumingxia 发表于 2013-5-31 11:08:41

如果回帖是一种美德,那我早就成为圣人了!

fjqzyc 发表于 2013-5-31 11:58:18

学习了,不错,讲的太有道理了

sol229 发表于 2013-5-31 13:44:37

天塌下来你顶着,我垫着!
页: [1]
查看完整版本: cacti短信预警功能