-
Notifications
You must be signed in to change notification settings - Fork 3
/
zbx_export_mediatypes.yaml
127 lines (118 loc) · 4.3 KB
/
zbx_export_mediatypes.yaml
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
zabbix_export:
version: '5.2'
date: '2021-03-13T13:36:22Z'
media_types:
-
name: Freepbx
type: WEBHOOK
parameters:
-
name: Message
value: '{ALERT.MESSAGE}'
-
name: Subject
value: '{ALERT.SUBJECT}'
-
name: To
value: '{ALERT.SENDTO}'
-
name: Token
value: 15334a0b7ff1d77eea072535e5dea3df
-
name: Url
value: 'https://PPBX_HOST/freepbx/apicall/index.php'
script: |
var freepbx = {
token: null,
to: null,
message: null,
url: null,
sendMessage: function() {
var params = {
tocall: freepbx.to,
message: freepbx.message,
language: 'en'
},
data,
response,
request = new CurlHttpRequest(),
url = freepbx.url;
request.AddHeader('Content-Type', 'application/json;charset=utf-8');
request.AddHeader('token: '+freepbx.token );
data = JSON.stringify(params);
Zabbix.Log(4, data);
response = request.Post(url, data);
try {
response = JSON.parse(response);
Zabbix.Log(4, response);
}
catch (error) {
response = null;
}
}
}
try {
var params = JSON.parse(value);
freepbx.token = params.Token;
freepbx.to = params.To;
freepbx.message = params.Subject + '. ' + params.Message;
freepbx.url = params.Url;
freepbx.sendMessage();
return 'OK';
} catch (error) {
throw 'Sending failed: ' + error + '.';
}
timeout: 10s
description: |
https://github.com/Stell0/apicall-freepbx
1. Register api-calls on freepbx module
2. Copy and paste the obtained token into the "Token" field above
3. Place Url freepbx
Install googletts and apicall modules on FreePBX >= 14. Google tts require a valid google API key. Used only if message parameter is setted
message_templates:
-
event_source: TRIGGERS
operation_mode: PROBLEM
subject: 'Problem : {HOST.NAME} {TRIGGER.STATUS}'
message: |
Problem started at {EVENT.TIME} of {EVENT.DATE}
Problem name: {EVENT.NAME}
Status : {STATUS}
Severity: {EVENT.SEVERITY}
-
event_source: TRIGGERS
operation_mode: RECOVERY
subject: 'Resolved in {EVENT.DURATION}: {EVENT.NAME}'
message: |
The problem has been resolved in {EVENT.DURATION} at {EVENT.RECOVERY.TIME} of {EVENT.RECOVERY.DATE}
Host: {HOST.NAME}
-
event_source: TRIGGERS
operation_mode: UPDATE
subject: 'Problem update: {EVENT.NAME}'
message: |
{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.
{EVENT.UPDATE.MESSAGE}
The current problem status is: {EVENT.STATUS}, aknoledged : {EVENT.ACK.STATUS}.
-
event_source: DISCOVERY
operation_mode: PROBLEM
subject: 'Discovery: {DISCOVERY.DEVICE.STATUS} {DISCOVERY.DEVICE.IPADDRESS}'
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}
-
event_source: AUTOREGISTRATION
operation_mode: PROBLEM
subject: 'Autoregistration: {HOST.HOST}'
message: |
Host name: {HOST.HOST}
Host IP: {HOST.IP}
Agent port: {HOST.PORT}