Zabbix 3.4.6实现微信告警
一、注册企业微信准备发送消息python脚本[*] 注册企业微信,获取CorpID
http://s1.运维网.com/images/20180128/1517121936600861.png
[*] 在企业微信中创建一个应用,获取AgentID和Secret
http://s1.运维网.com/images/20180128/1517122178644569.png
[*] 安装simplejson
[*] wget https://pypi.python.org/packages/f0/07/26b519e6ebb03c2a74989f7571e6ae6b82e9d7d81b8de6fcdbfc643c7b58/simplejson-3.8.2.tar.gz
[*] tar zxvf simplejson-3.8.2.tar.gz ; cd simplejson-3.8.2
[*] python setup.py build
[*] python setup.py install
[*]
[*] 准备微信发送消息python脚本
[*] git clone https://github.com/X-Mars/Zabbix-Alert-WeChat.git
[*] cp Zabbix-Alert-WeChat/wechat.py /usr/lib/zabbix/alertscripts/
[*] cd /usr/lib/zabbix/alertscripts/
[*] chmod +x wechat.py;chown zabbix:zabbix wechat.py
[*] 修改Python 脚本
http://s1.运维网.com/images/20180128/1517122706489089.png
[*] 测试脚本发送信息,这里脚本传入三个参数, 第一个2是部门ID, 第二个 Test 是标题, 第三个是消息内容
http://s1.运维网.com/images/20180128/1517122832892532.png
二、配置zabbix
[*] 配置zabbix server的配置文件zabbix_server.conf,配置AlertScriptsPath=“wechat.py脚本所在路径”
http://s1.运维网.com/images/20180128/1517123068913186.png
[*] 配置zabbix Media Typehttp://s1.运维网.com/images/20180128/1517123306407304.png
[*] 创建一个用户并配置Media
http://s1.运维网.com/images/20180128/1517123468662301.png
http://s1.运维网.com/images/20180128/1517123595175857.png
[*] 如何查看企业微信的部门
http://s1.运维网.com/images/20180128/1517123658591348.png
下面就是配置action了,在action中配置operation type 为"Send message" , send to user 配置为 "具有wechat media 的用户"
页:
[1]