bb-Ricardo / icinga-slack-bot

use slack to manage alarms in Icinga2
MIT License
5 stars 2 forks source link

Behind Corporate proxy #46

Open Razmuzh opened 4 years ago

Razmuzh commented 4 years ago

Had problems connecting to Slack API. Did the following changes:

Icinga-bot.ini: Added entry for proxy under [slack] proxy_url = <PROXY SERVER>:<PORT>

i2_slack_modules/common.py: Added parser under 'read common section' config_dict["slack.proxy_url"] = config_handler.get(this_section, "proxy_url", fallback="")

Icinga-bot.py: Added proxy to connection methods: client = slack.WebClient(token=config["slack.bot_token"], ssl=slack_ssl_context, proxy=config["slack.proxy_url"], run_async=True) and rtm_client = slack.RTMClient( token=config["slack.bot_token"], ssl=slack_ssl_context, run_async=True, loop=loop, proxy="http://" + config["slack.proxy_url"] )

The last will probably fail splendidly if no proxy is defined :) But since the rim_client demanded 'http://' ...

Probably better ways to do this, but it works.

Thanks for making this bot! R.

bb-Ricardo commented 4 years ago

Great idea, will try to add it.