nagioa 与飞信的结合
1.软件安装
在本文章最后,下载附件,因为上传限制,故分开上传。
1)上传到/var/tmp下,并放到/usr/local/下
- cp -r fetion/ /usr/local/
2)修改权限
- # cd fetion/
- # chmod +x *
3)拷贝到/usr/
- # cp lib*so* /usr/lib
2.测试飞信
第一次需要输入验证码,验证码在/usr/local/fetion里的手机号,以后就好了
- [root@localhost fetion]# /usr/local/fetion/fetion --mobile=15188888888 --pwd=8888 --to=15188888888 --msg-utf8="hello world"
- SIP-C/4.0 280 Send SMS OK
- T: sip:559404132@fetion.com.cn;p=30377
- I: 2
- Q: 1 M
- L: 114
- D: Fri, 29 Jun 2012 03:08:27 GMT
- XI: 66D63A3C0CE3A5C3B859916A1C0E616F
3.与nagios 结合
- # vi /usr/local/nagios/etc/objects/contacts.cfg
修改为下面的
- define contact{
- contact_name xxxx
- alias sys admin
- 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-email,notify-service-by-fei
- host_notification_commands notify-host-by-email,notify-host-by-fei
- email 567xxx@qq.com,687xxx@gmail.com
- pager 1515678****,1595678****
- }
多个邮件和手机号使用英文逗号隔开即可。
- # vi /usr/local/nagios/etc/objects/commands.cfg
添加
- define command {
- command_name notify-host-by-fei
- command_line /usr/local/fetion/fetion --mobile=1511234**** --pwd=8888 --to=$CONTACTPAGER$ --msg-utf8="Host $HOSTSTATE$ alert for $HOSTNAME$! on '$LONGDATETIME$'" $CONTACTPAGER$
- }
- # 'notify-service-by-fei' command definition
- define command {
- command_name notify-service-by-fei
- command_line /usr/local/fetion/fetion --mobile=1511234**** --pwd=8888 --to=$CONTACTPAGER$ --msg-utf8="$HOSTADDRESS$ $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ on $LONGDATETIME$" $CONTACTPAGER$
- }
最下面有附件
参考:
http://yytian.blog.51cto.com/535845/565102
http://dl528888.blog.51cto.com/2382721/770684
转载于:https://blog.51cto.com/weiruoyu/904572