2 minutes
Zabbix to Slack notification failed: invalid_arguments
tl;dr Slack doesn’t like the “slack_as_user’ parameter with newly generated bot tokens. Updated Zabbix-builtin alert script within.
If you’re anything like me you’ve just reinstalled Zabbix, or have recreated your alerting Slack App, or anything that might have re-rolled your Slack App’s bot token. New bot tokens don’t support the slack_as_user parameter, and so you’re getting the invalid_arguments error.
Firstly grab a copy of the bot token (from Alerts -> Media Types -> Slack -> bot_token if you don’t still have the Slack App tab open). You’ll need to re-set it after importing. It’ll be in the format xoxb-*.
Grab the following gist as media_slack.yaml, then in Zabbix -> Alerts -> Media Types -> Import, select ‘Update existing’ so that we can update the Slack media type.
Please of course feel free to verify - the changes I’ve made to the existing script are the removal of the ‘slack_as_user’ parameter and references, and I’ve edited the version to 7.0 as the one linked is from Zabbix 7.2 and it refused to import as I’m on 7.0, update this value to your Zabbix version if below 7.0.
https://gist.github.com/cohan/a192f2895a4490df9028ad0569a8a5b4
After importing, go to Administration -> Media types -> Slack and update the bot token field with the one you copied earlier.
Your alerts should be good to go! :)
217 Words
2024-11-27 10:37