Hi,
Recently upgraded to 5.2.0 on one of my installations.
As we would like to have the notifications in Slack, I tried it for the first time (never done and configured that before).
Went with the "built in" instead of 3rd party solutions.
First of all, I soon figured that the documentation is somewhat behind - Slack has changed and to set up the Slack app, it does not correspond to what is said in Zabbix manual. Tried to intuitively do and think/hope did it correct.
But then immediately hit the wall on Zabbix side too as the actions fail with this error:
As I do not have any reasonable experience with webhooks in zabbix or elsewhere and this error does not really help much I decided to try another one that is easily available to me, Discord.
Magic - that worked out of the box, so its not that bad with me. After some more troubleshooting I decided to compare the JS code for Slack and Discord webhooks. The code is wrapped in try/catch statements that in Slack's JS ends like this:
Ha. Corresponding part of Discord's script calls Zabbix.Log. OK, changed L to capital one and now in action log I get the real error that throws this catch actually:
Here though, comparing two scripts didn't really help as Discord's script uses CurlHttpRequest. Yes, I tried replacing HttpRequest with CurlHttpRequest, then there were some more problems with uppercase and lowercase letters but eventually it started complaining about badly formed JSON or something and thats where I gave up.
So to sum up, it seems the documentation on Slack webhook is well outdated and the script for it also seems to have its problems. Might consider submitting a bug report but as I really do not have much experience with webhooks / JS, I still am not sure if I am doing everything right. Does anyone have the bundled Slack thing work out of the box on 5.2.0?
(I know 5.2.1 is out now but the Slack thing is not mentioned in the release notes)
Regards,
Ervins
Recently upgraded to 5.2.0 on one of my installations.
As we would like to have the notifications in Slack, I tried it for the first time (never done and configured that before).
Went with the "built in" instead of 3rd party solutions.
First of all, I soon figured that the documentation is somewhat behind - Slack has changed and to set up the Slack app, it does not correspond to what is said in Zabbix manual. Tried to intuitively do and think/hope did it correct.
But then immediately hit the wall on Zabbix side too as the actions fail with this error:
Code:
[COLOR=#c0392b]TypeError: undefined not callable (property 'log' of [object Object]) at [anon] (duktape.c:65639) internal at [anon] (function:382) preventsyield[/COLOR]
Magic - that worked out of the box, so its not that bad with me. After some more troubleshooting I decided to compare the JS code for Slack and Discord webhooks. The code is wrapped in try/catch statements that in Slack's JS ends like this:
Code:
catch (error) {
Zabbix.log(4, '[ Slack Webhook ] Slack notification failed : ' + error);
throw 'Slack notification failed : ' + error;
}
Code:
[COLOR=#c0392b]Slack notification failed : ReferenceError: identifier 'HttpRequest' undefined[/COLOR]
So to sum up, it seems the documentation on Slack webhook is well outdated and the script for it also seems to have its problems. Might consider submitting a bug report but as I really do not have much experience with webhooks / JS, I still am not sure if I am doing everything right. Does anyone have the bundled Slack thing work out of the box on 5.2.0?
(I know 5.2.1 is out now but the Slack thing is not mentioned in the release notes)
Regards,
Ervins
Comment