-
Notifications
You must be signed in to change notification settings - Fork 25
/
media-type-4.4.xml
55 lines (55 loc) · 1.87 KB
/
media-type-4.4.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.4</version>
<date>2020-01-23T20:00:48Z</date>
<media_types>
<media_type>
<name>notify.events (webhook)</name>
<type>WEBHOOK</type>
<parameters>
<parameter>
<name>to</name>
<value>{ALERT.SENDTO}</value>
</parameter>
<parameter>
<name>subject</name>
<value>{ALERT.SUBJECT}</value>
</parameter>
<parameter>
<name>message</name>
<value>{ALERT.MESSAGE}</value>
</parameter>
<parameter>
<name>severity</name>
<value>{TRIGGER.NSEVERITY}</value>
</parameter>
<parameter>
<name>status</name>
<value>{TRIGGER.STATUS}</value>
</parameter>
</parameters>
<script>var req = new CurlHttpRequest();
req.AddHeader('Content-Type: application/x-www-form-urlencoded');
Zabbix.Log(4, 'webhook request value=' + value);
params = JSON.parse(value);
resp = req.Post('https://notify.events/api/v1/channel/source/' + params.to + '/execute',
'subject=' + encodeURIComponent(params.subject) +
'&message=' + encodeURIComponent(params.message) +
'&severity=' + encodeURIComponent(params.severity) +
'&status=' + encodeURIComponent(params.status)
);
Zabbix.Log(4, 'response code: ' + req.Status());
if (req.Status() != 200) {
throw 'Response code: ' + req.Status();
}
return resp;</script>
<show_event_menu>NO</show_event_menu>
</media_type>
</media_types>
</zabbix_export>