74 lines
4.9 KiB
JSON
74 lines
4.9 KiB
JSON
{
|
|
"zabbix_export": {
|
|
"version": "7.0",
|
|
"media_types": [
|
|
{
|
|
"name": "Zabify",
|
|
"type": "WEBHOOK",
|
|
"parameters": [
|
|
{
|
|
"name": "event_id",
|
|
"value": "{EVENT.ID}"
|
|
},
|
|
{
|
|
"name": "fully_qualified_name",
|
|
"value": "localhost"
|
|
},
|
|
{
|
|
"name": "host_id",
|
|
"value": "{HOST.ID}"
|
|
},
|
|
{
|
|
"name": "message",
|
|
"value": "{ALERT.MESSAGE}"
|
|
},
|
|
{
|
|
"name": "port",
|
|
"value": "4338"
|
|
},
|
|
{
|
|
"name": "protocol",
|
|
"value": "http"
|
|
},
|
|
{
|
|
"name": "proxy"
|
|
},
|
|
{
|
|
"name": "send_to",
|
|
"value": "{ALERT.SENDTO}"
|
|
},
|
|
{
|
|
"name": "severity",
|
|
"value": "{EVENT.NSEVERITY}"
|
|
},
|
|
{
|
|
"name": "title",
|
|
"value": "{ALERT.SUBJECT}"
|
|
}
|
|
],
|
|
"script": "try {\n Zabbix.log(4, '[ Zabify ] Starting to send push notification');\n\n var params = JSON.parse(value);\n var payload = {\n \"token\": params.send_to.split(\"===\")[1],\n \"rsaKey\": params.send_to.split(\"===\")[0],\n \"notification\": {\n \"data\": {\n \"host_id\": params.host_id,\n \"event_id\": params.event_id,\n \"severity\": parseInt(params.severity)\n },\n \"message\": { \n \"title\": params.title,\n \"message\": params.message,\n }\n }\n };\n\n Zabbix.log(4, '[ Zabify ] Sending request');\n var request = new HttpRequest();\n request.addHeader('Content-Type: application/json');\n request.setProxy(params.proxy);\n\n var data = JSON.stringify(payload);\n var endpoint = params.protocol + \"://\" + params.fully_qualified_name + \":\" + params.port + \"/send\";\n var response = request.post(endpoint, data);\n if (response === null) {\n throw 'Unknown error. Check debug log for more information.';\n }\n Zabbix.log(4, '[ Zabify ] Received response with status code ' + request.getStatus() + '\\n' + response);\n\n if (request.getStatus() != 200) {\n var parsedResponse;\n try {\n parsedResponse = JSON.parse(response);\n }\n catch (error) {\n Zabbix.log(4, '[ Zabify ] Failed to parse response');\n throw 'Unknown error. Check debug log for more information.';\n }\n\n throw parsedResponse;\n }\n\n Zabbix.log(4, '[ Zabify ] Finished to send push notification without errors');\n return 'OK';\n}\ncatch (error) {\n Zabbix.log(4, '[ Zabify ] Failed to send push notification: ' + error);\n throw 'Zabbix app notification failed: ' + error;\n}",
|
|
"description": "Please refer to the Zabify Server integration documentation on https://www.zabify.de/plugins for more information.",
|
|
"message_templates": [
|
|
{
|
|
"event_source": "TRIGGERS",
|
|
"operation_mode": "PROBLEM",
|
|
"subject": "Problem: {EVENT.NAME}",
|
|
"message": "Problem started at {EVENT.TIME} on {EVENT.DATE}\nHost: {HOST.NAME}\nSeverity: {EVENT.SEVERITY}\nOperational data: {EVENT.OPDATA}\nOriginal problem ID: {EVENT.ID}\n{TRIGGER.URL}"
|
|
},
|
|
{
|
|
"event_source": "TRIGGERS",
|
|
"operation_mode": "RECOVERY",
|
|
"subject": "Resolved: {EVENT.NAME}",
|
|
"message": "Problem has been resolved at {EVENT.RECOVERY.TIME} on {EVENT.RECOVERY.DATE}\nProblem duration: {EVENT.DURATION}\nHost: {HOST.NAME}\nSeverity: {EVENT.SEVERITY}\nOriginal problem ID: {EVENT.ID}\n{TRIGGER.URL}"
|
|
},
|
|
{
|
|
"event_source": "TRIGGERS",
|
|
"operation_mode": "UPDATE",
|
|
"subject": "Updated problem in {EVENT.AGE}: {EVENT.NAME}",
|
|
"message": "{USER.FULLNAME} {EVENT.UPDATE.ACTION} problem at {EVENT.UPDATE.DATE} {EVENT.UPDATE.TIME}.\n{EVENT.UPDATE.MESSAGE}\n\nCurrent problem status is {EVENT.STATUS}, age is {EVENT.AGE}, acknowledged: {EVENT.ACK.STATUS}."
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
} |