Centos下nagios报警飞信部署

短信猫经常死机,为了安全还是在部署一飞信辅助报警
一:安装飞信
解压 fetion目录 到 /usr/local/下
执行
ln -s /usr/local/fetion/lib/lib* /usr/lib/
注:此处链接会提示有存在的,不必理会。
测试  :
/usr/local/fetion/fetion –sid=飞信号码 –pwd=飞信密码 –to=接受人的手机号码 –msg-type=1 –msg-utf8=”The Fetion test is ok”
第一次运行,会需要验证码,验证码图片在 /usr/local/fetion/ 生成,下载到本地,查看后输入即可(注意大小写),会缓存。
二:vi commands.cfg
添加:
define command{
    command_name notify-host-by-fetion
    command_line /usr/local/fetion/fetion –mobile=13xxxxxxxxx –pwd=1111111 –to=138xxxxxxxx –msg-type=1 –msg-utf8=”** $NOTIFICATIONTYPE$ Host Alert:$HOSTNAME$ is $HOSTSTATE$ **”
}
define command{
    command_name notify-service-by-fetion
    command_line /usr/local/fetion/fetion –mobile=13xxxxxxxxx –pwd=1111111 –to=138xxxxxxxx –msg-type=1 –msg-utf8=”**$NOTIFICATIONTYPE$\n\nService:$SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:$SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$ **”
}
三、vi templates.cfg
define contact{
        name                            generic-contact     ; The name of this contact template
        service_notification_period     24×7           ; service notifications can be sent anytime
        host_notification_period        24×7            ; host notifications can be sent anytime
        service_notification_options    w,u,c,r,f,s    ; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,u,r,f,s         ; send notifications for all host states, flapping events, and scheduled downtime events
        service_notification_commands   notify-service-by-sms,notify-service-by-email   ; send service notifications via email
        host_notification_commands      notify-host-by-sms,notify-host-by-email ; send host notifications via email
        register                        0                       ; DONT REGISTER THIS DEFINITION – ITS NOT A REAL CONTACT, JUST A TEM
PLATE!
        }
四、 vi contacts.cfg
define contact{
        contact_name                    sysadmin
        service_notification_period     24×7
        host_notification_period        24×7
        service_notification_options    w,c,u,r
        host_notification_options       d,u,r
        service_notification_commands   notify-service-by-sms,notify-service-by-email ; send service notifications via email
        host_notification_commands      notify-host-by-sms,notify-host-by-email       ; send host notifications via email
        email                           lijun@jkr99.com
        pager                           number
        }
/etc/init.d/nagios  checkconfig    #检查配置文件 正确性
/etc/nit.d/nagios reload

此条目发表在Nagios分类目录。将固定链接加入收藏夹。