Chinaunix首页 | 论坛 | 博客
  • 博客访问: 116162
  • 博文数量: 23
  • 博客积分: 1583
  • 博客等级: 上尉
  • 技术积分: 250
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-06 00:49
文章分类

全部博文(23)

文章存档

2011年(2)

2010年(21)

分类: LINUX

2010-03-18 17:58:48

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#收信息的手机,多个手机号码用逗号隔开
                                      }
现在配置全部完成,可以测试下是否能正常工作了!
阅读(1220) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~