mirror of
https://github.com/FAUSheppy/monitoring-tools
synced 2025-12-06 03:21:35 +01:00
add: zabbix signal notify script
This commit is contained in:
25
zabbix-signal-webhook-script.js
Normal file
25
zabbix-signal-webhook-script.js
Normal file
@@ -0,0 +1,25 @@
|
||||
try {
|
||||
|
||||
var params = JSON.parse(value);
|
||||
Zabbix.log(4, '[ Signal Webhook ] Executed with params: ' + params.URL + ', ' + params.Message);
|
||||
|
||||
if (!params.URL) {
|
||||
throw 'Cannot get url';
|
||||
}
|
||||
|
||||
fields = {
|
||||
message : params.Message,
|
||||
number : params.number
|
||||
}
|
||||
|
||||
var req = new HttpRequest();
|
||||
req.addHeader('Content-Type: application/json');
|
||||
|
||||
var resp = req.post(params.URL, JSON.stringify(fields))
|
||||
return 'OK';
|
||||
|
||||
}
|
||||
catch (error) {
|
||||
Zabbix.log(3, '[ Signal Webhook ] ERROR: ' + error);
|
||||
throw 'Sending Signal Message failed: ' + error;
|
||||
}
|
||||
Reference in New Issue
Block a user