What can I do with the Slack module?¶
Using the Slack module you can receive notifications from openITCOCKPIT directly in a channel in your Slack Workspace.
What can I configure?¶
The settings for the Slack module can be found under "System configuration → APIs → Slack".
|Name field||Required field||Description|
|Webhook URL||Defines the address of the Slack server to which the module should send the notifications **|
|OAuth Access Token||The token needed for your workspace can be obtained from Slack. This is only needed if two-way integration is activated|
|Enable Two-Way Integration||Two-way integration allows Slack to send acknowledgements for hosts and services to openITCOCKPIT. This option requires that the openITCOCKPIT server can be reached via the Internet|
|Request URL||This is generated by openITCOCKPIT and specifies the webhook URL for Slack. A custom API key must be created using openITCOCKPIT first.|
|Use Proxy Server||Indicates whether to use the configured proxy|
openITCOCKPIT communicates with Slack via the Slack WebAPI and sends messages to a specific channel as an app.
Go to https://api.slack.com/apps?new_app=1 to create the app.
Choose the name of your own actual app and your own Slack workspace.
Select "Incoming Webhooks" in the left menu, enable the option in the top right and add the webhook to your workspace by clicking on the button below.
Choose a channel where the openITCOCKPIT messages should be posted.
Copy the webhook URL you just created and paste it into
openITCOCKPIT -> Administration -> Slack.
To activate acknowledgments for hosts and services in Slack, you must enable "Two-Way Integration".
For this to be successful, openITCOCKPIT must be externally accessible.
Go to "OAuth & Permissions" in the menu on the Slack API website, and at the bottom of the page give read rights to users ("users:read") and then save your changes.
The webhook may need to be reinstalled. If this is the case, follow the instructions at the top of the Slack API website to complete reinstallation.
Should reinstallation be necessary, the new webhook URL in openITCOCKPIT must also be updated.
Once this has been done, copy the newly generated OAuth access token and paste it into openITCOCKPIT.
For "Two-Way-Integration" to be enabled, your Slack settings should appear as follows.
Optionally, the outgoing connection can be established via your configured proxy.
Save your settings and in the next step copy the "Request URL".
Enable "Interactive Messages" and paste in the "Request URL" you copied earlier.
Enable Slack notifications¶
Add the commands automatically created during the module installation to your contact or replace the old ones.
Now save and export.
The following commands must be used for notifications.
Host Notification Command - openITCOCKPIT Version 4.0
/usr/share/openitcockpit/app/cake4/bin/cake SlackModule.SlackNotification --type Host --notificationtype $NOTIFICATIONTYPE$ --hostname "$HOSTNAME$" --hostaddress "$HOSTADDRESS$" --hoststate "$HOSTSTATEID$" --output "$HOSTOUTPUT$"
Service Notification Command - openITCOCKPIT Version 4.0
/usr/share/openitcockpit/app/cake4/bin/cake SlackModule.SlackNotification --type Service --notificationtype $NOTIFICATIONTYPE$ --hostname "$HOSTNAME$" --hostaddress "$HOSTADDRESS$" --hoststate "$HOSTSTATEID$" --servicedesc "$SERVICEDESC$" --servicestate "$SERVICESTATEID$" --output "$SERVICEOUTPUT$"