从Nagios4到电报的通知

无法从我的nagios获取警报。 服务器在Debian上。 从github.com/vysheng/tg安装电报

Nagios4的configuration文件。

commands.cfg:

#'notify-service-by-tg' command definition define command{ command_name notify-service-by-tg command_line /home/nagios/tg/bin/telegram-cli -WR -U root -D -e 'msg $_CONTACTTG$ $NOTIFICATIONTYPE$ Host : $HOSTNAME$ - Service : $SERVIC$ } #'notify-host-by-tg' command definition define command{ command_name notify-host-by-tg command_line /home/nagios/tg/bin/telegram-cli -WR -U root -D -e 'msg $_CONTACTTG$ "$NOTIFICATIONTYPE$ Host : $HOSTNAME$ is $HOSTSTATE$ @ $ } 

contacts.cfg:

 define contact{ contact_name nagiosadmin; use generic-contact; alias Nagios Admin; service_notification_period 24x7; host_notification_period 24x7; service_notification_options w,u,c,r,f,s; email nagios@localhost; _tg Anton_T; service_notification_commands notify-service-by-tg; host_notification_commands notify-host-by-tg; } define contactgroup{ contactgroup_name admins alias Nagios Administrators members nagiosadmin } 

从nginx有这个错误:

 2015/12/31 20:56:47 [info] 512#0: *299 client closed connection while waiting for request, client: 1*8.*.*.*, server: 0.0.0.0:800 

帮助,PLZ!

解决了!

您需要激活电报代码作为用户nagios。

su – nagios

/ home / nagios / tg / bin / telegram-cli -k /home/nagios/tg/tg-server.pub

并input代码发送给你的短信