环境:
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