-
Notifications
You must be signed in to change notification settings - Fork 25
/
media-type-5.0.xml
113 lines (104 loc) · 5.13 KB
/
media-type-5.0.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2021-08-17T14:02:09Z</date>
<media_types>
<media_type>
<name>notify.events (webhook)</name>
<type>WEBHOOK</type>
<parameters>
<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>
<parameter>
<name>subject</name>
<value>{ALERT.SUBJECT}</value>
</parameter>
<parameter>
<name>to</name>
<value>{ALERT.SENDTO}</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>
<message_templates>
<message_template>
<event_source>TRIGGERS</event_source>
<operation_mode>PROBLEM</operation_mode>
<subject>Problem: {EVENT.NAME}</subject>
<message>Problem started at {EVENT.TIME} on {EVENT.DATE}
Problem name: {EVENT.NAME}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Operational data: {EVENT.OPDATA}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}</message>
</message_template>
<message_template>
<event_source>TRIGGERS</event_source>
<operation_mode>RECOVERY</operation_mode>
<subject>Resolved in {EVENT.DURATION}: {EVENT.NAME}</subject>
<message>Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}
Problem name: {EVENT.NAME}
Problem duration: {EVENT.DURATION}
Host: {HOST.NAME}
Severity: {EVENT.SEVERITY}
Original problem ID: {EVENT.ID}
{TRIGGER.URL}</message>
</message_template>
<message_template>
<event_source>TRIGGERS</event_source>
<operation_mode>UPDATE</operation_mode>
<subject>Updated problem in {EVENT.AGE}: {EVENT.NAME}</subject>
<message>{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}
Current problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}.</message>
</message_template>
<message_template>
<event_source>DISCOVERY</event_source>
<operation_mode>PROBLEM</operation_mode>
<subject>Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}</subject>
<message>Discovery rule: {DISCOVERY.RULE.NAME}
Device IP: {DISCOVERY.DEVICE.IPADDRESS}
Device DNS: {DISCOVERY.DEVICE.DNS}
Device status: {DISCOVERY.DEVICE.STATUS}
Device uptime: {DISCOVERY.DEVICE.UPTIME}
Device service name: {DISCOVERY.SERVICE.NAME}
Device service port: {DISCOVERY.SERVICE.PORT}
Device service status: {DISCOVERY.SERVICE.STATUS}
Device service uptime: {DISCOVERY.SERVICE.UPTIME}</message>
</message_template>
<message_template>
<event_source>AUTOREGISTRATION</event_source>
<operation_mode>PROBLEM</operation_mode>
<subject>Autoregistration: {HOST.HOST}</subject>
<message>Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}</message>
</message_template>
</message_templates>
</media_type>
</media_types>
</zabbix_export>