zabbix+telegarm报警
Zabbix+telegarm报警
一.安装配置 2
二.获取tg-server.pub用户私钥 2
三.msg测试 3
四.Web zabbix 设置 5
一.安装配置
yum -y install lua-devel openssl-devel libconfig-devel readline-devel libevent-devel git uuid-devellibuuid libuuid-devel
cd /usr/local/src
git clone --recursive https://github.com/vysheng/tg.git
cd tg
./configure --disable-json
make
mkdir /usr/local/tg
cp tg-server.pub /usr/local/tg
cp bin/telegram-cli /usr/local/tg
二.获取tg-server.pub用户私钥
https://my.telegram.org/auth?to=apps 访问该网站 输入你需要当做报警的telegram账号
http://s1.运维网.com/images/20180216/1518788160130190.png
http://s1.运维网.com/images/20180216/1518788173839624.png填写这两个参数即可点击确定
获取keys:
http://s1.运维网.com/images/20180216/1518788178507360.png
三.Linux配置及msg测试
在linux服务器上测试
查看组或用户的信息
/usr/local/tg/telegram-cli -k /usr/local/tg/tg-server.pub
第一次登陆需要收验证码
http://s1.运维网.com/images/20180216/1518788190903812.png
http://s1.运维网.com/images/20180216/1518788195606058.png
发送组消息
http://s1.运维网.com/images/20180216/1518788199957293.png
http://s1.运维网.com/images/20180216/1518788202262923.png
注意:如果是群消息那就先在群里发一个消息再到linux 上发消息
开启端口8890
cd /usr/local/tg
./telegram-cli -k tg-server.pub -WDCRE -P 8890 -d &>/dev/null &
http://s1.运维网.com/images/20180216/1518788211399576.png
http://s1.运维网.com/images/20180216/1518788214999843.png
测试
echo -e "msg Core_zabbix_monitor 123__##__444444" | nc localhost 8890
配置服务器:
cat /usr/local/zabbix/etc/zabbix_server.conf
AlertScriptsPath=/usr/local/zabbix/alertscripts
Zabbix_server 编写脚本
cd /usr/local/zabbix/bin/alertscripts
cat tg.sh
#!/bin/sh
export to=$1;
export subject=$2;
export body=$3;
echo -e "msg $to ${subject}\n${body}" | nc localhost 8890
chmod +x tg.sh
四.Web zabbix 设置
http://s1.运维网.com/images/20180216/1518788226225014.png
http://s1.运维网.com/images/20180216/1518788233477462.png
http://s1.运维网.com/images/20180216/1518788249435926.png
http://s1.运维网.com/images/20180216/1518788257910574.png
http://blog.运维网.com/static/js/ueditor1.4.3/themes/default/images/spacer.gif
页:
[1]