这里我们介绍nagios利用飞信提供短信报警功能
【飞信安装测试】 - linux平台
http://bbs.it-adv.net/viewthread.php?tid=916&extra=&page=1
1. libACE库的支持
拷贝相应的so文件到/usr/lib下面
2. fetion的安装配置
解压fetion文件到安装路径,例如/usr/local/fetion
3. 测试飞信是否正常 - 前提是你的手机测试过飞信
/usr/local/fetion/fetion --mobile=137*** --pwd=*** --to=137*** --msg-utf8="test"
【nagios配置】
配置命令
# notify-service-by-email define command{ command_name notify-service-by-email command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddre ss: $HOSTADDRESS$\nState: $SERVICESTATE$\n\ nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVI CESTATE$ **" $CONTACTEMAIL$ } # notify-host-by-sms define command{ command_name notify-host-by-sms command_line /usr/local/fetion/fetion --mobile=xxx --pwd=xxx --to=xxx,xxx,xxx --msg-gb=" $NOTIFICATIONTYPE$ H ost Alert: $HOSTNAME$($HOSTADDRESS$) is $HOSTSTATE$ " --exit-on-verifycode=1 --msg-type=1 }
配置联系人
# create contact define contact{ contact_name test_user #use generic-contact service_notification_options c,w,r,u host_notification_options d,u,r service_notification_commands notify-service-by-sms,notify-service-by-email host_notification_commands notify-host-by-sms,notify-host-by-email host_notification_period 24-7 service_notification_period 24-7 email xx } define contactgroup{ contactgroup_name xxx_user alias Nagios xxx members test_user }
配置host,service
define host{ use linux-server host_name xx-web03 address xx.xx.xx.xx max_check_attempts 2 normal_check_interval 5 notification_interval 5 contact_groups xxx_user check_command check-host-alive notification_options d,u,r }
【问题】
问题一
/usr/local/fetion/fetion: error while loading shared librarIEs: libstdc++.so.6: cannot open shared object file: No such file or Directory
解决方法:
yum -y install libstdc++.so.6
问题二
/usr/local/fetion/fetion: error while loading shared libraries: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory
解决办法
yum install krb5-libs
问题三
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
解决办法:
yum -y install libz.so.1 --setopt=protected_multilib=false
【参考引用】
http://tamenglang.blog.51cto.com/431396/183917