Closed gcarey3 closed 8 months ago
Macros appear broken for me also or I am doing something wrong. It fails to resolve when testing with the macro setup, yet if I input the "https://ntfy.sh/MyZabbixAlerts123" URL manually in "URL" instead of "{NTFY.URL}" when testing it comes back green.
00:00:00.000 [Debug] [ ntfy Webhook ] Executed with params: {"Message":"{ALERT.MESSAGE}","Password":"{NTFY.PASS}","Subject":"{ALERT.SUBJECT}","Token":"{NTFY.TOKEN}","URL":"{NTFY.URL}","Username":"{NTFY.USER}"} 00:00:00.000 [Warning] [ ntfy webhook ] notification failed: Error: cannot get URL: Couldn't resolve host name.
It works for me, when I define the 4 NTFY parameters in the media type like {$NTFY.URL} and not as {NTFY.URL}. Macros without Dollar sign are internal Zabbix macros https://www.zabbix.com/documentation/current/en/manual/config/macros like {ALERT.MESSAGE} and {ALERT.SUBJECT}
I have to admit, i have been lazy and just using the macro URL in the mediatype. Ill accept patches ;)
Thanks to Rafael, there is now a new version. Please test
Thanks very much to you both for this handy integration and the fix! I report this is working for me.
The only way I got this working was to embed the URL and credentials in the alert media type. Setting the global macros did not work. I believe this is by design as my other media types have URLs and other credential information directly embedded, not read from global macros.
Also, to add flexibility I changed the URL field value to
https://ntfy.myserver.com/{ALERT.SENDTO}
so that I could set the "Send to" field in the user alert to whatever topic I want for that alert. That way I can post to different topics based on severity or problem type, etc. easily.