nagios使用飞信实现短信报警
(谭杨-tanyangxf@163.com)
转载请说明出处:http://blog.chinaunix.net/u3/112315/showart.php?id=2198469
1.下载软件包
library32.tar.gz,fetion20091117-linux.tar.gz
2. 解压软件包
# tar zxvf libraryrh4x32.tar.gz
把支持库复制到/usr/lib/目录下
#cp lib*so* /usr/lib/
并作软链接如下:
#ln -s /usr/lib/libcrypto.so.0.9.7a /usr/lib/libcrypto.so.4
#ln -s /usr/lib/libssl.so.0.9.7a /usr/lib/libssl.so.4
设定lib库配置文件
#vi /etc/ld.so.conf
#增加一条/usr/lib/#
保存退出后,执行
#ldconfig
#cd install
#cp fetion /sbin/
3.测试发信
#fetion —mobile=135xxxxxxxx —pwd=tanyang210 —to=134xxxxxxxx --msg-utf8="test"
5. nagios端配置
编辑commands.cfg文件在里面添加
#notify-service-by-sms
define command{
command_name notify-service-by-sms
command_line fetion --mobile=135xxxxxxxx --pwd=xxxxx--to=$CONTACTPAGER$ --msg-utf8="$HOSTADDRESS$' $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$"
}
#notify-host-by-sms
define command{
command_name notify-host-by-sms
command_line fetion --mobile=135xxxxxxxx --pwd=xxxxx --to=$CONTACTPAGER$ --msg-utf8="Host $HOSTSTATE$ alert for $HOSTNAME$! on '$DATETIME$'"
}
6.定义联系人配置文件 contacts.cfg 在里面添加
define contact {
contact_name ty
alias system admin
contactgroup_name tygroup
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-by-email,notify-service-by-sms
host_notification_commands host-notify-by-email,notify-host-by-sms
email tanyangxf@163.com
pager 135xxxxxxxx#收信息的手机,多个手机号码用逗号隔开
}
现在配置全部完成,可以测试下是否能正常工作了!
阅读(1271) | 评论(0) | 转发(0) |