企業(yè)微信創(chuàng)建和配置
注冊(cè)企業(yè)微信
https://work.weixin.qq.com/wework_admin/register_wx添加一個(gè)部門 記住部門id 2(后面要用)
- 記住添加的用戶賬號(hào) LiuXiaoBo

image-20210215214057681.png

image-20210215214112811.png
- 創(chuàng)建一個(gè)自定義的應(yīng)用

image-20210215214352229.png
填寫好應(yīng)用名稱,選擇剛創(chuàng)建的子部門

image-20210215214407570.png
-
創(chuàng)建自定義應(yīng)用完成后創(chuàng)建完成記住AgentID和Secret
AgentId:1000002
Secret:7oW4EelK4rWOWogM2NJVWS7mhvZRrljIbKuLdu-adAc

image-20210215214657682.png
-
記住企業(yè)ID ww7443be79a3027bb8
image-20210215215129639.png -
調(diào)試微信創(chuàng)建的應(yīng)用
微信企業(yè)號(hào)接口調(diào)試工具:
https://open.work.weixin.qq.com/wwopen/devtool/interface/combine

image-20210215215555102.png
zabbix server 服務(wù)器和zabbix server web 配置
#step1 安裝request組件 安裝 安裝pip 會(huì)有些小插曲 可自行百度
yum -y install epel-release
pip install --upgrade pip
pip install requests
#step2 下載別人編寫好的腳本并修改相應(yīng)的參數(shù)
git clone https://github.com/X-Mars/Zabbix-Alert-WeChat.git
cd Zabbix-Alert-WeChat/
cp wechat.py /usr/lib/zabbix/alertscripts/
cd /usr/lib/zabbix/alertscripts/
vim wechat.py
40 "touser": "LiuXiaoBo", # 企業(yè)號(hào)中的用戶帳號(hào),在zabbix用戶Media中配置,如果配置不正常,將按部門發(fā)送。
42 "toparty": 2, # 企業(yè)號(hào)中的部門id,群發(fā)時(shí)使用。
44 "agentid": 1000002, # 企業(yè)號(hào)中的應(yīng)用id。
67 Corpid = "ww7443be79a3027bb8" # CorpID是企業(yè)號(hào)的標(biāo)識(shí)
68 Secret = "7oW4EelK4rWOWogM2NJVWS7mhvZRrljIbKuLdu-adAc" # Secret是管理組憑證密鑰
70 Agentid = "1000002" # 應(yīng)用ID
71 Partyid = "2"
#step3 執(zhí)行腳本驗(yàn)證信息是否發(fā)送成功
[root@localhost alertscripts]# ./wechat.py “LiuXiaoBo” test 888
{u'invaliduser': u'', u'errcode': 0, u'errmsg': u'ok. Warning: wrong json format. '}

image-20210218111827835.png
頁(yè)面配置
創(chuàng)建媒體類型

image-20210219202440100.png
wechat.py 是/usr/lib/zabbix/alertscripts目錄中之前準(zhǔn)備的python腳本

image-20210219203136348.png
添加信息模板信息

image-20210219203219208.png
在用戶設(shè)置中添加報(bào)警媒介

image-20210219203452910.png

image-20210219203646295.png

image-20210219203900878.png
關(guān)閉客戶端nginx客戶端測(cè)試 檢測(cè)微信發(fā)送報(bào)警信息是否成功

image-20210219210346003.png
