github.com/argoproj/argo-cd/v3@v3.2.1/docs/operator-manual/notifications/services/opsgenie.md (about)

     1  # Opsgenie
     2  
     3  To be able to send notifications with argocd-notifications you have to create an [API Integration](https://docs.opsgenie.com/docs/integrations-overview) inside your [Opsgenie Team](https://docs.opsgenie.com/docs/teams).
     4  
     5  1. Login to Opsgenie at https://app.opsgenie.com or https://app.eu.opsgenie.com (if you have an account in the European Union).
     6  2. Make sure you already have a team; if not, follow this guide: https://docs.opsgenie.com/docs/teams.
     7  3. Click "Teams" in the Menu on the left.
     8  4. Select the team that you want to notify.
     9  5. In the team's configuration menu, select "Integrations".
    10  6. Click "Add Integration" in the top right corner.
    11  7. Select "API" integration.
    12  8. Give your integration a name, copy the "API key", and save it somewhere for later.
    13  9. Click "Edit" in the integration settings.
    14  10. Make sure the checkbox for "Create and Update Access" is selected; disable the other checkboxes to remove unnecessary permissions.
    15  11. Click "Save" at the bottom.
    16  12. Click "Turn on integration" in the top right corner.
    17  13. Check your browser for the correct server apiURL. If it is "app.opsgenie.com", then use the US/international API URL `api.opsgenie.com`; otherwise, use `api.eu.opsgenie.com` (European API).
    18  14. You are finished with configuring Opsgenie. Now you need to configure argocd-notifications. Use the apiUrl, the team name, and the apiKey to configure the Opsgenie integration in the `argocd-notifications-secret` secret.
    19  15. You can find the example `argocd-notifications-cm` configuration below.
    20  
    21  | **Option**    | **Required** | **Type** | **Description**                                                                                          | **Example**                      |
    22  | ------------- | ------------ | -------- | -------------------------------------------------------------------------------------------------------- | -------------------------------- |
    23  | `description` | True         | `string` | Description field of the alert that is generally used to provide detailed information about the alert.   | `Hello from Argo CD!`            |
    24  | `priority`    | False        | `string` | Priority level of the alert. Possible values are P1, P2, P3, P4, and P5. Default value is P3.            | `P1`                             |
    25  | `alias`       | False        | `string` | Client-defined identifier of the alert, that is also the key element of Alert De-Duplication.            | `Life is too short for no alias` |
    26  | `note`        | False        | `string` | Additional note that will be added while creating the alert.                                            | `Error from Argo CD!`           |
    27  | `actions`     | False        | `[]string` | Custom actions that will be available for the alert.                                                    | `["Resolve", "Escalate"]`       |
    28  | `tags`        | False        | `[]string` | Tags of the alert.                                                                                        | `["critical", "deployment"]`    |
    29  | `visibleTo`   | False        | `[]alert.Responder` | Teams and users that the alert will become visible to without sending any notification. The `type` field is mandatory for each item, where possible values are `team` and `user`. In addition to the `type` field, either `id` or `name` should be provided for teams, and either `id` or `username` should be given for users. Please note that alerts will be visible to the teams specified within the `responders` field by default, so there is no need to re-specify them in the `visibleTo` field. | `[{Type: "team", Id: "team_id"}, {Type: "user", Id: "user_id"}]` |
    30  | `details`     | False        | `map[string]string` | Map of key-value pairs to use as custom properties of the alert.                                         | `{"environment": "production", "service": "web"}` |
    31  | `entity`      | False        | `string` | Entity field of the alert that is generally used to specify which domain the alert is related to.       | `web-server`                     |
    32  | `user`        | False        | `string` | Display name of the request owner.                                                                        | `admin_user`                     |
    33  
    34  ```yaml
    35  apiVersion: v1
    36  kind: ConfigMap
    37  metadata:
    38    name: argocd-notifications-cm
    39  data:
    40    service.opsgenie: |
    41      apiUrl: <api-url>
    42      apiKeys:
    43        <your-team>: <integration-api-key>
    44    template.opsgenie: |
    45      message: |
    46        [Argo CD] Application {{.app.metadata.name}} has a problem.
    47      opsgenie:
    48        description: |
    49          Application: {{.app.metadata.name}}
    50          Health Status: {{.app.status.health.status}}
    51          Operation State Phase: {{.app.status.operationState.phase}}
    52          Sync Status: {{.app.status.sync.status}}
    53        priority: P1
    54        alias: {{.app.metadata.name}}
    55        note: Error from Argo CD!
    56        actions:
    57          - Restart
    58          - AnExampleAction
    59        tags:
    60          - OverwriteQuietHours
    61          - Critical
    62        visibleTo:
    63          - Id: "{{.app.metadata.responderId}}"
    64            Type: "team"
    65          - Name: "rocket_team"
    66            Type: "team"
    67          - Id: "{{.app.metadata.responderUserId}}"
    68            Type: "user"
    69          - Username: "trinity@opsgenie.com"
    70            Type: "user"
    71        details:
    72          environment: production
    73          service: web
    74        entity: Argo CD Application
    75        user: John Doe
    76    trigger.on-a-problem: |
    77      - description: Application has a problem.
    78        send:
    79        - opsgenie
    80        when: app.status.health.status == 'Degraded' or app.status.operationState.phase in ['Error', 'Failed'] or app.status.sync.status == 'Unknown'
    81  ```
    82  
    83  16. Add annotation in the application YAML file to enable notifications for a specific Argo CD app.
    84  ```yaml
    85  apiVersion: argoproj.io/v1alpha1
    86  kind: Application
    87  metadata:
    88    annotations:
    89      notifications.argoproj.io/subscribe.on-a-problem.opsgenie: <your-team>
    90  ```