新增脚本并将脚本放在alertscripts目录下
我的yum安装的,目录在/usr/lib/zabbix/alertscripts
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
import sys
def send(text):
url='https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=368dd000-5376-420b-811b-c9081d2e2b42'
headers={
'Content-Type': 'text/plain',
}
data={
"msgtype": "text",
"text": {
"content": text,
}
}
requests.post(url=url,headers=headers,json=data)
if __name__ == '__main__':
text = sys.argv[1]
send(text)
在linux下直接vim生成不要在windows下编辑好再复制过去,不然会报错
新增媒介类型
用户添加报警媒介