重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
一、安装所需要的软件
创新互联专注为客户提供全方位的互联网综合服务,包含不限于网站设计制作、成都做网站、新华网络推广、重庆小程序开发、新华网络营销、新华企业策划、新华品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供新华建站搭建服务,24小时服务热线:028-86922220,官方网址:www.cdcxhl.com
总下载地址:http://bbs.it-adv.net/viewthread.php?tid=1081&extra=page%3D1
wget http://www.it-adv.net/fetion/linuxso_20101113.rar
//下面的这个连接是下载飞信的可执行文件fetion,要注册回复后才能看到
http://bbs.it-adv.net/p_w_upload.php?aid=43&k=954fb0d183808bfb706d8c4a35308874&t=1335168710
//下面的这个连接是下载rar的解压缩软件文件的软件
wget http://www.rarlab.com/rar/rarlinux-3.9.2.tar.gz
二、解压下载的软件
1,安装rar的解压缩软件
tar zxvf rarlinux-3.9.2.tar.gz
cd rar
make && make install
make时如果报以下
rar: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
解决方法:
[root@localhost download]# yum install libstdc++.so.6
2、创建fetion目录
mkdir /usr/local/fetion
rar x linuxso_20101113.rar
cp ./lib* /usr/local/fetion
把下载的fetion执行程序拷贝过去到fetion目录中,并修改fetion目录属主和属组为nagios,增加执行权限
3、增加飞信所需的动态链接库
vi /etc/ld.so.conf
/usr/local/fetion
4、这一步最关键,否则系统识别不到
ldconfig --更新/usr/local/fetion中的库文件,能够被系统识别
5、手动执行fetion,看是否报错:
/usr/local/fetion/fetion
************************ IMPORTANT STATEMENT ************************
** **
** PLEASE DON'T USE THIS SOFTWARE TO SEND JUNK SHORT MESSAGES. **
** OTHERWISE PLEASE BEAR YOUR OWN CONSEQUENCES. **
** **
** Version:[20101205002-linux] **
*********************************************************************
This program is the console version of China Fetion!
It's free for personal user.
This project website: http://www.it-adv.net/
AUTHOR:KelvinH MSN/EMAIL:shichangguo@msn.com
Usage:
--mobile=[mobile]
--sid=[sid]
--pwd=[pwd]
--config=[config file] *format:index mobile password
--index=[index no in config file,refer to sample.conf]
--debug *debug mode on
--hide *login fetion in hidden state
--to=[mobile/sid]
--command-path=[command file path]
--robotmode
--daemon(linux only)
--proxy-ip(http proxy ip)
--proxy-port(http proxy port)
--msg-gb=[gb2312/gbk message]
--msg-utf8=[utf8 message]
--msg-type=[0/1/2 sms longsms smartmsg]
--file-gb=[gb2312/gbk file]
--file-utf8=[utf8 file]
--query-cmcc-no
--auto-retry
--exit-on-verifycode
--t3key=[http://www.tui3.com/page/smssend/]
6】测试
root># /usr/local/fetion/fetion --mobile=1371xx --pwd=xx --to=1371xx --msg-utf8="阿萨"
SIP-C/4.0 280 Send SMS OK
T: sip:203294876@fetion.com.cn;p=3044
I: 2
Q: 1 M
L: 116
D: Wed, 12 Dec 2012 03:41:17 GMT
XI: 8EB4A6172FA8AD75614FB3CC323AD8F0
--其中pwd为该手机的飞信密码,并不是139密码;如果出现send sms ok的话,就说明已经发生成功了,一般第一次发生的时候,会在fetion目录生成该手机的jpg
7】修改commands.cfg
define command {
command_name notify-service-by-fetion
command_line /usr/local/fetion/fetion --mobile=1371xx --pwd=xx --msg-utf8="***Nagios***\nNotification Type: $NOTIFICATIONTYPE$\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n$SERVICEOUTPUT$ " --to=1371xx
}
define command {
command_name notify-host-by-fetion
command_line /usr/local/fetion/fetion --mobile=1371xx --pwd=xx --msg-utf8="***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\nDate/Time: $LONGDATETIME$\n " --to=1371xx
}
--其中to后面可以是contacts.cfg里面的联系人
信息格式可以随便修改,也可以这样写
define command{
command_name notify-host-by-fetion
command_line /usr/local/fetion/fetion --mobile=1371x --pwd=xx --msg-utf8="***Nagios***\nNotification Type: $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$" --to=1371xx
}
# 'notify-service-by-fetion' command definition
define command{
command_name notify-service-by-fetion
command_line /usr/local/fetion/fetion --mobile=1371 --pwd=xx --msg-utf8="***Nagios***\nNotification Type: $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" --to=xx
}
8】修改contacts.cfg,增加pager
define contact {
contact_name nagiosadmin
alias nagios administrator
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-fetion,notify-service-by-email
host_notification_commands notify-host-by-fetion,notify-service-by-email
# email 1371@139.com
pager 1371xx
9】重启nagios服务