发送zabbix图文告警到微信
- python3
pip3 install pyzabbix wechatpy pycrypto
vim setting.conf
cp zabbix-wechat.conf path/nginx/conf/
nginx -t
nginx -s reload
Administration => Media types => Create media type
-
Type = Script
- wechat-alarm.py
-
Script parameters
- {ALERT.SENDTO}
- {ALERT.MESSAGE}
Administration => Users => Media
添加一个新的报警媒介
Configuration => Actions => Event source = Triggers => Create action
-
Operations
- Default message
{ "trigger_statue": "{TRIGGER.STATUS}", "trigger_severity": "{TRIGGER.SEVERITY}", "event_id": "{EVENT.ID}", "trigger_hostgroup_name": "{TRIGGER.HOSTGROUP.NAME}", "host_name": "{HOST.NAME}", "host_ip": "{HOST.IP}", "item_name": "{ITEM.NAME}", "item_value": "{ITEM.VALUE}", "event_date": "{EVENT.DATE}", "event_time": "{EVENT.TIME}", "trigger_description": "{TRIGGER.DESCRIPTION}", "item_id": "{ITEM.ID}", "trigger_name": "{TRIGGER.NAME}", "trigger_id": "{TRIGGER.ID}", "event_age": "", "event_recovery_date": "", "event_recovery_time": "" }
-
Recovery operations
- Default message
{ "trigger_statue": "{TRIGGER.STATUS}", "trigger_severity": "{TRIGGER.SEVERITY}", "event_id": "{EVENT.ID}", "trigger_hostgroup_name": "{TRIGGER.HOSTGROUP.NAME}", "host_name": "{HOST.NAME}", "host_ip": "{HOST.IP}", "item_name": "{ITEM.NAME}", "item_value": "{ITEM.VALUE}", "event_date": "{EVENT.DATE}", "event_time": "{EVENT.TIME}", "trigger_description": "{TRIGGER.DESCRIPTION}", "item_id": "{ITEM.ID}", "trigger_name": "{TRIGGER.NAME}", "trigger_id": "{TRIGGER.ID}", "event_age": "{EVENT.AGE}", "event_recovery_date": "{EVENT.RECOVERY.DATE}", "event_recovery_time": "{EVENT.RECOVERY.TIME}" }