> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chronosphere.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a VictorOps notifier

To create a VictorOps notifier, set up VictorOps and then create the notifier in
Chronosphere Observability Platform.

## Set up VictorOps

Before creating a VictorOps notifier in Observability Platform, enable the Prometheus
integration in VictorOps and create a service API key. See the
[REST endpoint integration guide](https://help.victorops.com/knowledge-base/rest-endpoint-integration-guide/)
in the VictorOps documentation for more information.

To configure a VictorOps notifier:

1. In VictorOps, click the **Integrations** tab.
2. Search for **Prometheus**, and then click **Enable Integration**.
3. Copy the **Service API Key** value.
4. Open the pre-configured REST integration, and copy the **URL to notify** value.
5. In the navigation menu select **Settings <span aria-label="and then">></span>
   Routing Keys**
   and review your routing keys. If you have any routing keys defined, copy the
   appropriate value for the team you want to route this notifier to.

Next, [create a VictorOps notifier](#create-a-victorops-notifier-in-observability-platform)
in Observability Platform.

## Create a VictorOps notifier in Observability Platform

After [setting up VictorOps](#set-up-victorops), you can create a VictorOps notifier in
Observability Platform.

Select from the following methods to create a VictorOps notifier. You can use
[variables](/investigate/alerts/notifications/notifiers#use-variables-in-notifiers) in your
notifiers.

<Tabs>
  <Tab title="Web" id="create-victorops-notifier">
    To create a VictorOps notifier:

    1. In the navigation menu select
       **<Icon icon="bell" /> Alerting <span aria-label="and then">></span> Notifiers**.

    2. Click **Create notifier**.

    3. Enter a descriptive name for the notifier.

    4. Select **VictorOps** as the type of notifier you want to create.

    5. In the **API Key** field, enter the value of your VictorOps API key.

    6. In the **API URL** field, enter the **URL to notify** value you copied from
       VictorOps, which is called as a `POST` request. For example:

       ```text theme={null}
       https://alert.victorops.com/integrations/generic/20131114/alert/
       ```

    7. In the **Routing Key** field, enter the routing key you copied from VictorOps.

    8. Optional: Select **Notify when resolved** to send a resolved alert notification.

    9. Click **Save**.
  </Tab>

  <Tab title="Chronoctl" id="victorops-chronoctl">
    To create one or more notifiers using [Chronoctl](/tooling/chronoctl), create a YAML file
    that defines them and apply the configuration to your instance.

    <Note>
      You can use the `notifiers scaffold` command to generate an example notifier, and
      then copy the resource definition for your notifier type:

      ```shell theme={null} theme={null}
      chronoctl notifiers scaffold
      ```
    </Note>

    1. Define the resource definition for your VictorOps notifier:

       ```yaml /NAME/ /SLUG/ /API_KEY/ theme={null}
       api_version: v1/config
       kind: Notifier
       spec:
         name: NAME
         slug: SLUG
         skip_resolved: true
         victor_ops:
           - api_key: 'API_KEY'
             api_url: https://alert.victorops.com/integrations/generic/20131114/alert/
             routing_key: 'test'
       ```

       Replace the following:

       * *`NAME`*: A descriptive name, such as `test-victorops`.
       * *`SLUG`*: A unique identifier, such as `team-victorops`.
       * *`API_KEY`*: Your VictorOps API key.

    2. Enter the **URL to notify** value you copied from VictorOps as the value in the
       `api_url` field.

    3. Enter the routing key you copied from VictorOps as the value in the `routing_key`
       field.

    4. Apply the changes:

       ```shell /FILE_NAME/ theme={null}
       chronoctl apply -f FILE_NAME.yaml
       ```

       Replace *`FILE_NAME`* with the name of your notifier YAML file.
  </Tab>

  <Tab title="Terraform" id="victorops-terraform">
    To create a VictorOps notifier:

    1. Create a VictorOps notifier with Terraform by using the
       `chronosphere_victorops_alert_notifier` type followed by a name in a resource
       declaration:

       ```terraform theme={null}
       resource "chronosphere_victorops_alert_notifier" "test_victorops" {
         name          = "test-victorops"

         # Optional slug of the victorops notifier.
         slug = "vo-test-notifier"

         ## Notifier-specific required configuration
         # Detailed definitions can be found at: https://prometheus.io/docs/alerting/latest/configuration/#victorops_config
         api_key       = "0b590c67-20d6-40ba-afb4-84f0808dd969"
         api_url       = "https://alert.victorops.com/integrations/generic/20131114/alert/"
         routing_key   = "test"

         ## Notifier-specific optional configurations
         message_type = "CRITICAL" # (Default) OR: WARNING, INFO
         entity_display_name = "summary of the problem"
         state_message = "long explanation of the problem"
         monitoring_tool = "Chronosphere"

         # Can have multiple custom fields.
         custom_fields = {
           "first_field" = "interesting value"
         }

         ## (Optional) Base configuration common to all notifiers
         send_resolved = true # The default value

         ## (Optional) HTTP configuration common to HTTP notifiers
         basic_auth_username = "username"
         basic_auth_password = "strong+p@ssword"
         # Can use bearer_token instead of basic auth
         tls_insecure_skip_verify = false
       }
       ```

    2. Enter your VictorOps API key as the value in the `api_key` field.

    3. Enter the **URL to notify** value you copied from VictorOps as the value in the
       `api_url` field.

    4. Enter the routing key you copied from VictorOps as the value in the `routing_key`
       field.

    5. Run `terraform apply` to create the notifier resource.

       ```shell theme={null}
       terraform apply
       ```
  </Tab>

  <Tab title="API" id="victorops-API">
    To complete this action with the Chronosphere API, use the `victor_ops` object in the
    [`CreateNotifier`](/tooling/api-info/definition/operations/CreateNotifier) endpoint.

    Because the Chronosphere API requires authentication, include an API token with your
    `curl` request, as shown in the following example. For more details, see
    [Create an API token](/tooling/api-info#create-an-api-token).

    ```shell /"TOKEN"/ /INSTANCE/ /METHOD/ /ENDPOINT_PATH/ theme={null} theme={null}
    export CHRONOSPHERE_API_TOKEN="TOKEN"
    export CHRONOSPHERE_DOMAIN="INSTANCE.chronosphere.io"

    curl -H "API-Token: ${CHRONOSPHERE_API_TOKEN}" \
         -X METHOD "https://${CHRONOSPHERE_DOMAIN}/ENDPOINT_PATH"
    ```

    Replace the following:

    * *`TOKEN`*: Your API token.
    * *`INSTANCE`*: The subdomain name for your organization's Observability Platform instance.
    * *`METHOD`*: The HTTP method to use with the request, such as `GET` or `POST`.
    * *`ENDPOINT_PATH`*: The specific endpoint you want to access.
  </Tab>
</Tabs>
