What can I do with the Slack module?
With the Slack module you can get the openITCOCKPIT notifications in your Slack workspace.
What can I configure?
Under "Configuration / Slack" you can find the settings for the Slack module.
Field name | Required Field | Description |
---|---|---|
Webhook URL | Defines the address of the Slack server to which the module sends the notifications Example: https://hooks.slack.com/services/... | |
OAuth Access Token | ( | The token you can get from Slack for your Workspace Only required if the two-way integration is enabled |
Enable Two-Way Integration | Via the Two-Way Integration Slack is able, to acknowledge host and service problems. For this option it is required, that your openITCOCKPIT Server is accessible from the Internet. | |
Request URL | Gives you the Webhook URL for Slack from your openITCOCKPIT instance. You need to create an openITCOCKPIT user defined API key first. | |
Use Proxy Server | Determine if the configured proxy should be used |
Installation
openITCOCKPIT communicates with Slack using the Slack WebAPI und sends as App messages to a specific channel.
To create the App go to the website https://api.slack.com/apps?new_app=1
Set your own App name und choose your Slack Workspace.
Choose "Incoming Webhooks" in the left menue. Activate the option in the top right corner of the formular and add the webhook to your workspace using the button at the end of the page.
Choose a channel where the news from openITCOCKPIT should be posted.
Copy the newly created Webhook URL and paste it into openITCOCKPIT -> Administration -> Slack.
Two-Way-Integration
To be able to perform acknowledgments for hosts and services in Slack, enable "Two-Way Integration".
openITCOCKPIT has to be reachable externally in this case.
To do this, go to the Slack API's website on the left side of the menu and click on "OAuth & Permissions", add the right "users: read" at the bottom of the page and save the changes.
If necessary, the Webhook must be reinstalled. Follow the instructions at the top of the Slack API website.
If this is the case, the new Webhook URL in openITCOCKPIT must also be updated.
Then copy the generated OAuth Access Token and paste it into openITCOCKPIT.
To enable "Two Way Integration", the Slack settings should look like this.
Optionally, the outgoing connection can be established via the configured proxy.
Save your settings and copy the "Request URL" in the next step.
Activate "Interactive Messages" and paste the previously copied "Request URL".
Activate Slack Notifications
Add to your contact the commands automatically created during module installation, or replace the old ones.
Then save and export.
Commands
The following commands must be used for the notification.
However, these should already have been created during the module installation.
Host:
/usr/share/openitcockpit/app/Console/cake SlackModule.slack_notification --type Host --notificationtype $NOTIFICATIONTYPE$ --hostname "$HOSTNAME$" --hostaddress "$HOSTADDRESS$" --hoststate "$HOSTSTATEID$" --output "$HOSTOUTPUT$"
/usr/share/openitcockpit/app/cake4/bin/cake SlackModule.SlackNotification --type Host --notificationtype $NOTIFICATIONTYPE$ --hostname "$HOSTNAME$" --hostaddress "$HOSTADDRESS$" --hoststate "$HOSTSTATEID$" --output "$HOSTOUTPUT$"
Service:
/usr/share/openitcockpit/app/Console/cake SlackModule.slack_notification --type Service --notificationtype $NOTIFICATIONTYPE$ --hostname "$HOSTNAME$" --hostaddress "$HOSTADDRESS$" --hoststate "$HOSTSTATEID$" --servicedesc "$SERVICEDESC$" --servicestate "$SERVICESTATEID$" --output "$SERVICEOUTPUT$"
/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$"