CentOS下nagios报警飞信部署四步走

本文详细介绍了在CentOS环境下部署nagios报警至飞信的步骤,包括飞信安装、配置nagios命令以及调整通知模板等关键环节。

CentOS下nagios报警飞信部署四步走

今天 帮群里一兄弟配了下nagios上的飞信,这个东西 我个人感觉还是很实用的,不过好久没配了,今天配置了一遍,顺便 就把过程记录下来了,供大家学习!!!

一、安装飞信

cd /root/tools
wget http://ebook.elain.org/tools/fetion20101205.tar.gz

安装步骤略,软件包中有
添加要接收报警短信的手机号为飞信好友

/usr/local/fetion/fetion --mobile=137xxxxxxxx --pwd=1111111 --to=138xxxxxxxx --msg-type=1 --msg-utf8="The Fetion test is ok"

注:第一次要输入验证码,生成验证码后,另开一终端把图片下载下来,打开查看,注意区分大小写!!!

二、vi commands.cfg  添加

define command{
command_name notify-host-by-fetion
command_line /usr/local/fetion/fetion --mobile=137xxxxxxxx --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=137xxxxxxxx --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{
…………
service_notification_commands   notify-service-by-fetion
host_notification_commands      notify-host-by-fetion
…………
}

四、 vi contacts.cfg

define contact {
contact_name                   elain
alias                          sa
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,service-notify-by-fetion
host_notification_commands     notify-host-by-email,host-notify-by-fetion
email                          elain2012@hotmail.com
pager                          138xxxxxxxx
}
/etc/init.d/nagios  checkconfig    #检查配置文件 正确性

/etc/nit.d/nagios reload                 #重新加载配置文件

停服务做测试!!!

转载于:https://www.cnblogs.com/L-H-R-X-hehe/p/3970881.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值