Slack Service Configuration for command Interface
Creating a Slack Application
This guide outlines the step-by-step process to create a Slack app, including obtaining the necessary tokens and configuring the app YAML file.
Access the Slack App API Link: Navigate to the Slack app API link: https://api.slack.com/apps?new_app=1.
Create a New App:
Click on "Create New App" to initiate the creation of a new app from scratch.
Provide a name for the app (e.g., "VP Test App").
Choose the desired workspace where the app will be installed.
Generate App Configuration Tokens
Locate the "Generate Token and Scope" option.
Click on it to generate the tokens.
Obtain the following tokens:
App Token (e.g. xapp-1-00000000000-0000000000000-0000000000000-0000000000000).
Signing Secret (e.g., 00000000000000000000000000000000).
Note
Both the secret key and the app token are essential for configuring the Slack app YAML file.
Set Up Slash Commands
Navigate to "Socket Mode" from the left menu and enable socket mode.
Proceed to "Slash Commands" from the left menu.
Click on “Create New Command”.
Provide a command name and description only (e.g. /io-cli).
Note
Slash commands are necessary for configuring the Slack app YAML file.
Add Scope
Navigate to OAuth & Permissions, and go to Scopes.
Click Add an OAuth Scope to add bot token scope and user token scope variable - files: read and files: write.
Install the App
Access "Installed App Settings".
Install the app in your workspace.
Obtain the bot user OAuth token. Example: Bot User OAuth Token: xoxb-0000000000-0000000000000-0000000000000-0000000000000
Note
Bot tokens are required for configuring the Slack app YAML file.
Obtain the User OAuth token. Example: xoxp-0000000000-000000000000-0000000000000-00000000000000000000000000000000
Service Configuration
Obtain and Modify Configuration File.
Download the sample configuration file from IO Appliance settings: Settings > Slack Integration > Download Configuration File.
Customize the configuration file to align with your Slack app and IO credentials.
Adjust Configuration Parameters
Replace placeholders in the configuration file with actual values:
cmdName: Slash command for your app.
appToken: App Token obtained from Slack.
botToken: Bot OAuth Token retrieved from Slack.
signingSecret: Utilize the generated secret key for your app.
set enableSocketMode: true ,as your app creates a secret key.
userAuthToken: User OAuth Token retrieved from Slack.
slackFileSizeCleanupLimit: This attribute is optional, and if not specified, it will default to 1000 MB. When the limit is reached, we will automatically clean up the files.
DataSource: For data sources, please supply your IO application details, IP address, and access token. To generate an access token, utilize the IO application through UI. Navigate to Settings>API Token Management.
Step 3: Upload and Save Configuration
Navigate to the IO Appliance UI.
Browse and upload the modified configuration file.
Save the uploaded configuration using the save button.
Step 4: Store Configuration Files
The configuration files will be stored in the IO appliance directory: /data/configuration/integration-slack-app-config.yml.
The Slack App integration service will automatically recognize and utilize the uploaded configuration file.The service will utilize the Slack app token and data source information specified in the configuration file for seamless integration.
List of all supported commands
Help Command: This will return all supported commands.
Note
/io-cli should be replaced with your Slack app command name.
Command: /io-cli help
Command: /vp-cli get-info
Description: Shows data source configuration details.
Command: /io-cli get-entity-types
Description: Shows list of entity-types
Usage: Get-entity-types --filter ‘Header=value’
Command: /io-cli get-entities
Description: Shows entities by given entity type
Usage: Get- entities <entity type> --page <p> --limit <n> --props <'p1,p2,…pn’> --filter ‘header=value’
<entity type>: This should be the entity type (e.g. ESXHost).
props <'p1, p2, ... pn'>: This refers to the properties of the entity type that will be displayed in the results. For example, it could show information such as the number of VMs it has.
Command: io-cli get-metric-names
Description: Shows metrics by given entity type
Usage: Get-metric-names <entity type> --filter ‘Header=value’
<entity type>: This should be the entity type (e.g. ESXHost).
Command: //io-cli get-cases
Description: Shows cases of the application by period
Usage: get-cases --period <5d/1m/2hr/10min> --page <p> --limit <n>
Command : /io-cli-cmd get-cases-by-ids
Description : Shows alarm cases by IDs.
Usage: get-cases-by-ids caseId1,caseId2,..n
CaseId: Argument should be the case id.
Command: /io-cli-cmd show-trend
Description: Shows metric trend for the specified entity.
Usage: show-trend <entity id> <metric name> --period <5d/1m/2hr/10min>
<entity id>: This should be the entity id (e.g: 32c71dce0376470c8b742c1e99e6e47c)
<metric name>: This should be Metric name (e.g Server_cpu_usage).
Command: /io-cli get-related-entities
Description: Shows related entities of the application by entity type.
Usage: Get-related-entities <entity type> --name <name> --relatedEntityType <relatedEntity> --filter ‘Header=value’
<entity type> : This refers to the type of entity for which results are desired. For instance, it could be "ESXHost."
<name> : This represents the specific entity name within the given entity type (e.g., ESXHost).
<relatedEntityType>: This refers another entity type for which related values are sought. For example, in the case of ESXHost, we might seek related values such as VirtualMachine.
Command: /io-cli get-entities-topn
Description: Shows the top n entities by metrics.
Usage: Get-entities-topn <entity typ> <metric name> --top <n> --peiod< 5d/1m/2hr/10min> --filter ‘Header=value’
--top <n>: The limit parameter accepts a numerical value (--top 10).
<entity type>: This should be the entity type (e.g ESXHost).
<metric name>: This should be Metric name (e.g Server_cpu_usage).
Common Option
Table 21. OptionsOption
Description
--type
Specify the entity type to retrieve entities.
--page
The page parameter accepts a numerical value (--page 0), indicating the starting page for the entity pagination list.
--limit
The limit parameter accepts a numerical value (--limit 10), determining the total number of records to include in the entity pagination list.
--period
This period can be <5d/1m/2hr/10min>. This duration can be expressed in formats such as days/months/hours, or minutes.
--filter
Utilize this option to refine results by specifying a filter header name and a corresponding value (--filter 'Header=value').