Skip to main content

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.

  1. Access the Slack App API Link: Navigate to the Slack app API link: https://api.slack.com/apps?new_app=1.

  2. 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.

      1.png
  3. 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.

      2.png
  4. Set Up Slash Commands

    • Navigate to "Socket Mode" from the left menu and enable socket mode.

      3.png
    • Proceed to "Slash Commands" from the left menu.

      4.png
    • Click on “Create New Command”.

    • Provide a command name and description only (e.g. /vw-cli).

      Note

      Slash commands are necessary for configuring the Slack app YAML file.

  5. 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.

      Scope.png
      user_scope.png
  6. 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

  1. Obtain and Modify Configuration File.

    • Download the sample configuration file from VW Appliance settings: Settings > Slack Integration > Download Configuration File.

    • Customize the configuration file to align with your Slack app and VW credentials.

      step1.png
  2. 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 VW application details, IP address, and access token. To generate an access token, utilize the VW application through UI. Navigate to Settings>API Token Management.

  3. Step 3: Upload and Save Configuration

    • Navigate to the VW Appliance UI.

    • Browse and upload the modified configuration file.

    • Save the uploaded configuration using the save button.

      step3.png
  4. Step 4: Store Configuration Files

    • The configuration files will be stored in the VW 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

/vw-cli should be replaced with your Slack app command name.

  • Command: /vw-cli help

    1. Command: /vp-cli get-info

      Description: Shows data source configuration details.

    2. Command: /vw-cli get-entity-types

      Description: Shows list of entity-types

      Usage: Get-entity-types --filter ‘Header=value’

    3. Command: /vw-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.

    4. Command: vw-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).

    5. Command: //vw-cli get-cases

      Description: Shows cases of the application by period

      Usage: get-cases --period <5d/1m/2hr/10min> --page <p> --limit <n>

    6. Command : /vw-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.

    7. Command: /vw-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).

    8. Command: /vw-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.

    9. Command: /vw-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. Options

    Option

    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').