How to Push Zabbix Alerts to WeChat Using Service Account Templates
This guide explains how to configure a WeChat service account, enable template messages, deploy Python and shell scripts, and integrate them with Zabbix so that monitoring alerts are sent directly to WeChat users as template messages.
This article demonstrates a practical method to send Zabbix alerts through a WeChat service account using the platform’s template message feature.
1. Register and certify a WeChat service account
Follow the official WeChat guide to register a service account and complete the certification (requires company documents and a 300 CNY annual fee).
2. Enable template message function and select an alert template
In the WeChat public platform, add the “Template Message” feature.
Choose the “IT/Network Game – System Fault Alert Notification” template (or another appropriate alert template).
3. Download and deploy the alert script
# git clone https://github.com/vincihu/misc/
sudo mv misc/wxAlert /usr/lib/zabbix/alertscripts/
sudo mv /usr/lib/zabbix/alertscripts/{wxAlert/,}AlertWeixin.sh
sudo mkdir /usr/lib/zabbix/alertscripts/logs
sudo chmod u+x AlertWeixin.sh
sudo chown zabbix:zabbix /usr/lib/zabbix/alertscripts/{logs/,AlertWeixin.sh}
sudo pip install -U configparser requests simplejsonEdit wxAlert/wxAlert.conf and fill in the WeChat service account credentials:
[default]
appid = APPID
secret = SECRET
template_id = TEMPLATE_ID4. Obtain subscriber OpenIDs
# python wxGetUserInfo.py 2>/dev/null
nickname: JasonQu
openid: AAAA
headimgurl: http://wx.qlogo.cn/mmopen/XXXX/0
nickname: 胡文西
openid: BBBB
headimgurl: http://wx.qlogo.cn/mmopen/YYYY/05. Configure Zabbix
Add a new media type:
Name: X. AlertWeixin
Type: Script
Script name: AlertWeixin.shAssign the media type to a user profile, using the subscriber’s OpenID as the “Send to” address.
6. Test the integration
Trigger a test alert in Zabbix; the message will be delivered to the WeChat user. Example screenshot:
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Efficient Ops
This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
