Nagios微信报警
2014-02-17 21:28
239 查看
下面是具体的操作步骤一.注册微信公众平台。注册地址 https://mp.weixin.qq.com/二.下载nodejs程序,在程序config/config.coffee中填写刚注册的公众号和密码。 启用程序(nodejs的启动很简单建议大家用forever作成一个系统服务,上网找找资料由于篇幅问题在这里略过)。程序下载地址:https://github.com/ym1623/node_wx本程序有两个功能:1.是模拟登陆 2.是获取好友列表
三.写一个调用微信接口的SHELL,我写了几行SHELL在这里奉上。weixin.rar四.Nagios的配置1.在 objects/commands.cfg中增加如下信息
注意:command_line后面的是在一行中2.以objects/contacts.cfg中示例信息如下:
define contact{
contact_name nagiosadmin ; Short name of user
alias Nagios Admin ; Full name of userservice_notification_period 24×7host_notification_period 24×7service_notification_options w,u,c,r,f,shost_notification_options d,u,r,f,sservice_notification_commands notify-host-by-email,notify-host-by-sms ,notify-service-by-weixinhost_notification_commands notify-host-by-email,notify-host-by-sms ,notify-service-by-weixin
pager 134123456 ;pager numberemail abc@abc.com ;Email message
address1 2447905640 ;微信好友ID号
}
注明:微信ID号可以通过 http://nodejs IP/wx/friend获取 格式如下:{
id: 11212856820,
nick_name: "微信昵称",
remark_name: "",
group_id: 0
}
保存重启nagios 测试一下 大功告成
http://www.icanwen.com/?p=746
三.写一个调用微信接口的SHELL,我写了几行SHELL在这里奉上。weixin.rar四.Nagios的配置1.在 objects/commands.cfg中增加如下信息
define command{ command_name notify-host-by-weixin command_line /usr/bin/printf "%b" "*****ERS monitor Robot*****\n\n Notification Type: $NOTIFICATIONTYPE$\n Host: $HOSTNAME$\nState: $HOSTSTATE$\n Address: $HOSTADDRESS$\n Info: $HOSTOUTPUT$\n\n Date/Time: $LONGDATETIME$\n" >/usr/local/nagios/var/weixin.out | /usr/local/bin/weixin.sh -f $CONTACTADDRESS1$ } # 'notify-service-by-weixin' command definition define command{ command_name notify-service-by-weixin command_line /usr/bin/printf "%b" "***** ERS monitor Robot*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" > /usr/local/nagios/var/weixin.out | /usr/local/bin/weixin.sh -f $CONTACTADDRESS1$ }
注意:command_line后面的是在一行中2.以objects/contacts.cfg中示例信息如下:
define contact{
contact_name nagiosadmin ; Short name of user
alias Nagios Admin ; Full name of userservice_notification_period 24×7host_notification_period 24×7service_notification_options w,u,c,r,f,shost_notification_options d,u,r,f,sservice_notification_commands notify-host-by-email,notify-host-by-sms ,notify-service-by-weixinhost_notification_commands notify-host-by-email,notify-host-by-sms ,notify-service-by-weixin
pager 134123456 ;pager numberemail abc@abc.com ;Email message
address1 2447905640 ;微信好友ID号
}
define contact{ contact_name nagiosadmin ; Short name of user alias Nagios Admin ; Full name of user service_notification_period 24×7 host_notification_period 24×7 service_notification_options w,u,c,r,f,s host_notification_options d,u,r,f,s service_notification_commands notify-host-by-email,notify-host-by-sms ,notify-service-by-weixin host_notification_commands notify-host-by-email,notify-host-by-sms ,notify-service-by-weixin pager 134123456 ;pager number email abc@abc.com ;Email message address1 2447905640 ;微信好友ID号 }
注明:微信ID号可以通过 http://nodejs IP/wx/friend获取 格式如下:{
id: 11212856820,
nick_name: "微信昵称",
remark_name: "",
group_id: 0
}
保存重启nagios 测试一下 大功告成
http://www.icanwen.com/?p=746
相关文章推荐
- 整合nagios+cacti+微信、飞信实现网络监控系统报警
- 整合nagios+cacti+微信、飞信实现网络监控报警
- Python利用Nagios增加微信报警通知的功能
- Nagios微信报警
- nagios微信报警(版本V2)
- Python利用Nagios增加微信报警通知的功能
- nagios用python实现微信报警
- 实战Nagios网络监控(3)——Nagios 微信报警
- python利用企业微信api来进行发送自定义报警的类实现
- 解决nagios报警不发邮件通知一例[技术]
- DELL服务器结合nagios硬件监控、报警
- NagiosQL添加监控主机及Nagios上启用报警机制 推荐
- escalation 限制Nagios报警次数
- shell脚本之微信报警功能的实现
- nagios配置短信报警(139邮箱的短信通知)
- 微信公众号实现zaabix报警2017脚本(升级企业微信后)
- nagios搭建和邮件短信报警设置
- nagios报警延迟的解决--flapping state
- Nagios短信报警功能通过飞信实现
- zabbix------关于微信报警的尝试