cacti实现短信报警v1.1
制作:高进波
时间:2010-3-8
主题:Cacti-飞信客户端发送免费报警短信
cacti是一个非常好的流量监控与报警软件,还能对很多应用进行监控,如lighttp,nginx,mysql,memcached等
环境:
centos 5.4 x86_64
cacti 0.8.7e
1.安装最新版飞信
wget http://www.it-adv.net/fetion/downng/library_linux.tar.gz
wget http://www.it-adv.net/fetion/downng/fetion20090406003-linux.tar.gz
wget http://www.it-adv.net/fetion/downng/fetion20091117-linux.tar.gz
#在安装飞信之前需要在/usr/lib目录下加上libACE库文件,以便使飞信能够正常使用
[root@localhost src]# tar zxvf library_linux.tar.gz
[root@localhost src]# mv libACE* libcrypto.so.0.9.8 libssl.so.0.9.8 /usr/lib
#正式安装飞信
[root@localhost src]# tar zxvf fetion20090406003-linux.tar.gz
[root@localhost src]# mv install /usr/local/fetion
[root@localhost src]# chmod -R 755 /usr/local/fetion
[root@localhost src]# chown -R nagios:nagios /usr/local/fetion
#移动服务器更新,需要更新软件
[root@localhost src]# tar zxvf fetion20091117-linux.tar.gz
[root@localhost src]# cp fx/* /usr/local/fetion
[root@localhost src]# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/fetion #增加目录
[root@localhost src]# ldconfig
[root@localhost src]#/usr/local/fetion/fetion –mobile=151***** –pwd=*** –to=151***** –msg-utf8="test" –debug
[root@localhost src]#/usr/local/fetion/fetion ##帮助
[root@localhost src]#cp /usr/local/fetion/fetion /usr/bin/
2.修改thold函数
vi thold_functions.php
function thold_mail($to, $from, $subject, $message, $filename, $headers = ”) {
global $config;
include_once($config["base_path"] . "/plugins/settings/include/mailer.php");
//change for hugwww
exec("echo $subject >>/www/web/cacti/plugins/thold/alter.log");
exec("/www/web/cacti/plugins/thold/sendsms.sh");
//change end
3.编写发送短信的脚本
#!/bin/sh
#send sms by fetion
#Write by hugwww
if [ ! -e "/www/web/cacti/plugins/thold/alter.log" ];then #判断alter.log是否存在
echo "Usage:alter.log does not exist"
exit
fi
if [ -n "`cat /www/web/cacti/plugins/thold/alter.log`" ]; then #判断alter.log是否有报警信息
admin="13724506486,13724506486" #短信接收人,需在你飞信的好友列表中
/usr/local/fetion/fetion –mobile=13724506486 –pwd=password –to=$admin –file-utf8=/www/web/cacti/plugins/thold/alter.log
rm -f /www/web/cacti/plugins/thold/alter.log 1>/dev/null 2>&1
else
echo "Usage:no alter"
exit
fi
4.修改权限
chmod +x sendsms.sh
chown -R apache:apache *
完成!
附飞信安装文件
http://u.115.com/file/f4ca2ce55b
linux-sms飞信.rar
三月 12th, 2010 at 09:30
太好了~这样我也注册个飞信,同理,把别的系统事件发飞信给我。再就是看看能不能把用飞信控制电脑,呵呵!
四月 19th, 2010 at 10:53
不是可以直接用139邮箱啊,139邮箱,有邮件到达,可以直接短信通知的
四月 19th, 2010 at 17:07
用139邮箱也能发,现在好多朋友的手机都还不能接收邮件,只能收短信:)
六月 18th, 2010 at 14:16
飞信可以发送信息了,在Cacti中加好了那两条命令,但好像不起作用,请问,如何测试是否生效?
六月 19th, 2010 at 10:14
需要安装cacti的thold插件,才能使用飞信报警
七月 22nd, 2010 at 14:05
usr/local/fetion/fetion –mobile=151***** –pwd=*** –to=151***** –msg-utf8=”test” –debug
这句执行有错呀! parseSSIResult error:HTTP/1.1 401 Unauthorized
七月 22nd, 2010 at 15:50
根据你的错误提示来看,是授权失败,请输入正确的飞信密码:)
九月 18th, 2010 at 13:47
你好:问下,“3.编写发送短信的脚本 ”放到什么目录去,还有全部按照你的程序安装好,如何检测是否安装成功。谢谢。
九月 19th, 2010 at 09:14
第2个步骤里面可以看到脚本存放路径,/www/web/cacti/plugins/thold/sendsms.sh
测试飞信是否安装成功/usr/local/fetion/fetion
九月 20th, 2010 at 15:16
你好:根据你的安装要求一路下来,没有报错,请教:安装好了这么测试是否没问题。能否指点下。谢谢
九月 20th, 2010 at 15:22
./fetion –mobile=159007XXXXX –pwd=’passwd’ –to=150002XXXXX –msg-utf8=”I am fetion OK now” –debug
[ 15:21:04.348208] [User.cpp] [1152] nav.fetion.com.cn=221.130.45.201
[ 15:21:04.350289] [User.cpp] [1170] Before connect to nav.fetion.com.cn
[ 15:21:04.358520] [User.cpp] [1182] After connected to nav.fetion.com.cn
[ 15:21:05.466039] [SystemConfig.cpp] [65] sipc-proxy=221.176.31.48:8080
[ 15:21:05.466581] [SystemConfig.cpp] [76] parseSystemConfig 221.176.31.48:8080
[ 15:21:05.486726] [User.cpp] [1266] Before connect to nav.fetion.com.cn:443
[ 15:21:06.101448] [User.cpp] [1279] After connect to nav.fetion.com.cn:443
[ 15:21:06.301448] [User.cpp] [986] parseSSIResult error:HTTP/1.1 404 Not Found
Connection: close
Date: Mon, 20 Sep 2010 07:23:01 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 1531
The resource cannot be found.
body {font-family:”Verdana”;font-weight:normal;font-size: .7em;color:black;}
p {font-family:”Verdana”;font-weight:normal;color:black;margin-top: -5px}
b {font-family:”Verdana”;font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:”Verdana”;font-weight:normal;font-size:18pt;color:red }
H2 { font-family:”Verdana”;font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:”Lucida Console”;font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
Server Error in ‘/SSIPORTAL’ Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /ssiportal/SSIAppSignIn.aspx
这样是没问题还是飞信不成功啊。请老大指点。谢谢。
九月 20th, 2010 at 15:24
测试:
1.修改文件,添加一行
vi /www/web/cacti/plugins/thold/alter.log
报警测试,这条信息将通过飞信发送到你的手机。
2.修改发送脚本里面联系人,飞信用户名和密码
3.执行发送脚本
/www/web/cacti/plugins/thold/sendsms.sh
成功的话就会收到飞信了。
九月 20th, 2010 at 15:27
你需要安装新版飞信机器人,参考以下地址:
http://www.gaojinbo.com/ubuntu-8-0-4-%E4%B8%8B%E5%AE%89%E8%A3%85fetion%E6%9C%BA%E5%99%A8%E4%BA%BAv1-0.html
九月 21st, 2010 at 13:16
[root@cacti-new fetion]# /var/www/html/cacti/plugins/thold/sendsms.sh
: No such file or directory
[root@cacti-new fetion]#
不知道是否正常。谢谢。请多指教。
九月 21st, 2010 at 13:41
[root@cacti-new ~]# cd /var/www/html/cacti/plugins/thold/
[root@cacti-new thold]# ll
total 324
-rw-r–r– 1 root root 26 Sep 21 13:15 alter.log
-rw-rw-rw- 1 apache apache 3382 Jul 17 23:04 cli_thresholds.php
drwxr-xr-x 2 apache apache 4096 Sep 19 19:44 extras
drwxr-xr-x 2 apache apache 4096 Sep 19 19:44 images
drwxr-xr-x 2 apache apache 4096 Sep 19 19:44 includes
-rw-rw-rw- 1 apache apache 41 Jul 17 23:04 index.php
-rw-rw-rw- 1 apache apache 26925 Jul 17 23:04 LICENSE
-rw-rw-rw- 1 apache apache 17721 Jul 17 23:04 listthold.php
-rw-rw-rw- 1 apache apache 9391 Jul 17 23:04 README
-rwxr-xr-x 1 apache apache 523 Sep 20 11:23 sendsms.sh
-rw-rw-rw- 1 apache apache 28187 Jul 17 23:04 setup.php
-rw-rw-rw- 1 apache apache 19901 Jul 17 23:04 thold_add.php
-rw-rw-rw- 1 apache apache 72389 Sep 20 11:14 thold_functions.php
-rw-rw-rw- 1 apache apache 34180 Jul 17 23:04 thold_graph.php
-rw-rw-rw- 1 apache apache 30277 Jul 17 23:04 thold.php
-rw-rw-rw- 1 apache apache 5280 Jul 17 23:04 thold.sql
-rw-rw-rw- 1 apache apache 36040 Jul 17 23:04 thold_templates.php
sendsms.sh文件不能启动,启动就出现:NO such file or directory高手希望指点,有点快崩溃了。谢谢
四月 28th, 2011 at 07:16
太牛啦
八月 25th, 2011 at 00:15
Blogs you should be reading……
[...]Here is a great blog you might find Interesting that we encourage you[...]……
九月 13th, 2011 at 23:42
samui holiday villa…
[...]cacti实现短信报警v1.1 | 高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构[...]…
九月 17th, 2011 at 15:23
sportline pedometer…
[...]cacti实现短信报警v1.1 | 高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构[...]…
九月 20th, 2011 at 14:16
dumbbells reviews…
[...]cacti实现短信报警v1.1 | 高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构[...]…
九月 23rd, 2011 at 11:46
Psychic Healing…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
九月 23rd, 2011 at 15:33
free professional kids swimming lessons…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
十月 18th, 2011 at 02:43
Professional free tattoo removal in Philadelphia PA…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
十月 19th, 2011 at 23:54
Free horseback riding in NYC…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
十月 29th, 2011 at 08:05
no credit check apartments in Chicago IL…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
十月 31st, 2011 at 17:44
keyword2…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
十一月 5th, 2011 at 22:53
笑话大全…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
十一月 7th, 2011 at 08:21
Web directory Annuaire de referencement des sites web…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
十二月 4th, 2011 at 03:45
ugg boots clearance| ugg clearance| ugg boots uk| uk ugg outlet| UGG Classic Tall Boots|UGG Bailey Button Boots|UGG Kensington Boots|UGG Seline Boots…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…
十二月 29th, 2011 at 07:48
Tattoo Art Design Galleries…
[...]高进波博客 – 零起点一步配置你的linux服务器,linux博客,linux教程,web架构 » Blog Archive » cacti实现短信报警v1.1[...]…