Zabbix中的python自定义警报订阅不工作
我想通过Python脚本设置发送Webhooks,但是我对此有一个问题。我正在尝试根据本手册 httpps:httpps://wwwww。 zabbix.com/documentation/current/en/manual/config/notifications/media/script 。脚本正在执行,但没有发送我想要的值。这是我的脚本:
#!/usr/bin/python
import sys
import requests
hostname = sys.argv[1]
eventname = sys.argv[2]
severity = sys.argv[3]
payload = '{{"text": "{0},{1},{2}"}}'.format(hostname,eventname,severity)
headers = {'Content-type': 'application/json'}
endpoint = "https://example.com/asdf"
requests.post(endpoint, headers=headers, data=payload, verify=False)
在Zabbix设置中,我添加了这些包表器:
{HOST.NAME}
{EVENT.NAME}
{EVENT.SEVERITY}
已从Zabbix发送的通知不仅包含值参数名称。通知看起来像这样:
{HOST.NAME},{EVENT.NAME},{EVENT.SEVERITY}
有人可以帮助我,问题在哪里?先感谢您。
I would like to set sending webhooks by python script, but I have one problem with this. I am trying according this manual https://www.zabbix.com/documentation/current/en/manual/config/notifications/media/script . The script is executing but it doesn't send values which I want. This is my script:
#!/usr/bin/python
import sys
import requests
hostname = sys.argv[1]
eventname = sys.argv[2]
severity = sys.argv[3]
payload = '{{"text": "{0},{1},{2}"}}'.format(hostname,eventname,severity)
headers = {'Content-type': 'application/json'}
endpoint = "https://example.com/asdf"
requests.post(endpoint, headers=headers, data=payload, verify=False)
In zabbix settings I have added these parmeters:
{HOST.NAME}
{EVENT.NAME}
{EVENT.SEVERITY}
Notificiation which has been sent from zabbix doesn't contain values only parameter names. Notificiation looks like this:
{HOST.NAME},{EVENT.NAME},{EVENT.SEVERITY}
Could someone help me, where is the problem? Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论