Setting up the Slack Integration project
You can configure the Netcool/Impact Slack Integration project to work with Slack.
High-level description
In this Slack project, when an event occurs, the Slack event reader receives the event from ObjectServer and triggers the Slack policies to run, The policies create the Slack channel, invite users to the channel, post events to channel, and send the user response buttons to the channel.
Users can choose to respond to an event by clicking one of the response buttons, the event will be reloaded. Users can also click on the event to view its details. This launches the Event Viewer for the event.
The Slack project described in this section is an example. You can use the code in the policies to further develop your own Slack customization.
Configuring the integration project for Slack
Use the following steps to configure the integration project for Slack:
Configure the Slack workspace
Refer to your Slack documentation for details about how to create a Slack workspace, how to configure a Slack workspace if one already exists, customization, configuration and API usage.
Configure the RESTful API Data Source to send event data to Slack
This step is required.
-
On the Impact GUI, select the project Slack.
-
Open the Data Model tab and the Slack datasource.
-
Change the Authorization header to your own Slack Bot User OAuth token.
You can obtain the Slack Bot User OAuth Token from https://api.slack.com/apps/ by navigating to Slack App workspace -> OAuth & Permissions -> OAuth Tokens for Your Workspace -> Bot User OAuth Token.
-
Create an ObjectServer datasource or use an existing one.
Note: The defaultEvent Mapping
table has the restriction filter"Slack=1"
. The Slack event reader name is specified byslackeventreader
in the NCI_slackeventreader.props file. -
Install the Slack certificate for SSL communications between Impact and Slack.
-
Export the Slack certificate using the following sample command:
echo -n | openssl s_client -connect slack.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/slack.cert
-
Import the certificate to the Impact truststore using the following command:
{$IMPACT_HOME)/sdk/bin/keytool -importcert -alias Slack -file /tmp/slack.cert -keystore {$IMPACT_HOME)/wlp/usr/servers/NCI/resources/security/trust.jks -storepass {$password}
-
For information about Impact on OCP, see Enabling SSL communications from Netcool/Impact on Red Hat OpenShift.
-
Configure the Netcool/OMNIbus Event Reader Service for Slack events
This step is only required if you are using the Event Reader, ObjectServer or probe to forward events from Netcool/OMNIbus.
-
On the Impact GUI, select the project Slack.
-
Open the Service tab and the slackeventreader.
-
Change the Data Source Name to that of your ObjectServer datasource.
-
Select the Omnibus Event Reader fields to be returned from the ObjectServer.
Note: A default set of the fields are preselected. Do not remove the Slack field from the list of columns.
Update the Impact Slack policies
This step is required.
-
On the Impact GUI, select the project Slack.
-
Open the Policies tab.
You will see the following policies:
-
Slack_ProcessEvent.js
-
Slack_Functions.js
-
Slack_Utils.js
-
Slack_Config.js
-
-
Open the policy Slack_Config for editing.
-
Change the SlackTokenChannel variable to your Slack OAuth Token.
Where the Slack OAuth Token is the Slack App workspace token, and
You can obtain the Slack OAuth Token from https://api.slack.com/apps/ by navigating to Slack App workspace -> OAuth & Permissions -> OAuth Tokens for Your Workspace -> User OAuth Token
-
Change the
UserIDs
variable to the user IDs you want to invite to channels.Where
UserIDs
is the user ID to invite to the channel. It can be obtained by accessing the View all members of this channel icon on the top corner of a channel, and click on the member, and select Copy member ID. -
Change the
dashboardURL
variable to your dashboard hostname and port.Where
dashboardURL
is the DASH hostname and port.Note: ThenoiView
variable is the View parameter, having a value ofdefault
, which forms part of the URL.
Set up the ObjectServer database
This step is only required if you are using events in the ObjectServer.
-
Copy <impact_install_directory>/add-ons/slackintegration/db/slack_objectserver_fields_update.sql to your ObjectServer and run it.
Running this SQL file adds the following fields to the
alerts.status
table in the ObjectServer:-
Slack
SlackChannel
SlackChannelID
Where:
Slack
is the event restriction filter field, which is configured in theslackeventreader
.SlackChannel
is the name of the Slack channel, see Customize the setup for the default channel name.SlackChannelID
is the ID of the Slack channel, which is generated by Slack.Note: See Running SQL commands from files -
-
Add the Send to Slack action in the right-click menus on the event list.
For for details about adding the right-click menus in event lists, see Creating event management tools.
Note: Clicking the Send to Slack action sets theSlack
field in thealerts.status
table to the value of1
.
Set up the Netcool/OMNIbus Probe for Message Bus files
This step is only required if you are using the ObjectServer or the probe.
-
Install the Probe for Message Bus on the ObjectServer.
-
Copy the <impact_install_directory>/add-ons/slackintegration/probe/message_bus_slack.props file to the <omnibus_install_directory>/omnibus/probes/linux2x86 directory
-
Rename the message_bus_slack.props file to message_bus.props
-
Copy the <impact_install_directory>/add-ons/slackintegration/probe/message_bus_slack.rules file to the <omnibus_install_directory>/omnibus/probes/linux2x86 directory.
-
Copy the <impact_install_directory>/add-ons/slackintegration/probe/httpTransport_slack.properties to the <omnibus_install_directory>/omnibus/java/conf directory.
Where:
<impact_install_directory> is the directory where Impact is installed.
<omnibus_install_directory> is the directory where OMNIbus is installed.
-
Start the probe.
For details about how to run the probe after completing file setup, see Running probes
Customize the setup
After you have completed the setup steps, you can customize the default settings.
-
Customize the Channel Name.
The default channel name uses the following format:
ChannelName = "Impact_" + EventContainer.Node + EventContainer.Serial
You can modify this in the
getEventDetails
function in NCI_Slack_Utils.js during the creation of the channel. -
Customize the events sent to Slack
The default event sent to Slack is the affected event Serial on the Dashboard Event Viewer.
You can modify this in the
postEventToChannel
function in NCI_Slack_Utils.js.The color and the text of the event sent to Slack is handled in the
translateSeverity
function in NCI_Slack_Utils.js, and can be customized. More event data can also be added by modifying this function. -
Customize the channel event user buttons.
The possible default user response buttons are:
-
Acknowledge
-
Resolve
-
Escalate
-
Reload event
You can modify this in the
postEventToChannel
function in NCI_Slack_Utils.js. Or you can add more response buttons.Note: You will also have to change the Netcool/OMNIbus message_bus_slack.rules file accordingly. -