github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/notifications/services/alertmanager.md (about)

     1  # Alertmanager
     2  
     3  ## Parameters
     4  
     5  The notification service is used to push events to [Alertmanager](https://github.com/prometheus/alertmanager), and the following settings need to be specified:
     6  
     7  * `targets` - the alertmanager service address, array type
     8  * `scheme` - optional, default is "http", e.g. http or https
     9  * `apiPath` - optional, default is "/api/v2/alerts"
    10  * `insecureSkipVerify` - optional, default is "false", when scheme is https whether to skip the verification of ca
    11  * `basicAuth` - optional, server auth
    12  * `bearerToken` - optional, server auth
    13  * `timeout` - optional, the timeout in seconds used when sending alerts, default is "3 seconds"
    14  
    15  `basicAuth` or `bearerToken` is used for authentication, you can choose one. If the two are set at the same time, `basicAuth` takes precedence over `bearerToken`.
    16  
    17  ## Example
    18  
    19  ### Prometheus Alertmanager config
    20  
    21  ```yaml
    22  global:
    23    resolve_timeout: 5m
    24  
    25  route:
    26    group_by: ['alertname']
    27    group_wait: 10s
    28    group_interval: 10s
    29    repeat_interval: 1h
    30    receiver: 'default'
    31  receivers:
    32  - name: 'default'
    33    webhook_configs:
    34    - send_resolved: false
    35      url: 'http://10.5.39.39:10080/api/alerts/webhook'
    36  ```
    37  
    38  You should turn off "send_resolved" or you will receive unnecessary recovery notifications after "resolve_timeout".
    39  
    40  ### Send one alertmanager without auth
    41  
    42  ```yaml
    43  apiVersion: v1
    44  kind: ConfigMap
    45  metadata:
    46    name: <config-map-name>
    47  data:
    48    service.alertmanager: |
    49      targets:
    50      - 10.5.39.39:9093
    51  ```
    52  
    53  ### Send alertmanager cluster with custom api path
    54  
    55  If your alertmanager has changed the default api, you can customize "apiPath".
    56  
    57  ```yaml
    58  apiVersion: v1
    59  kind: ConfigMap
    60  metadata:
    61    name: <config-map-name>
    62  data:
    63    service.alertmanager: |
    64      targets:
    65      - 10.5.39.39:443
    66      scheme: https
    67      apiPath: /api/events
    68      insecureSkipVerify: true
    69  ```
    70  
    71  ### Send high availability alertmanager with auth
    72  
    73  Store auth token in `argocd-notifications-secret` Secret and use configure in `argocd-notifications-cm` ConfigMap.
    74  
    75  ```yaml
    76  apiVersion: v1
    77  kind: Secret
    78  metadata:
    79    name: <secret-name>
    80  stringData:
    81    alertmanager-username: <username>
    82    alertmanager-password: <password>
    83    alertmanager-bearer-token: <token>
    84  ```
    85  
    86  - with basicAuth
    87  
    88  ```yaml
    89  apiVersion: v1
    90  kind: ConfigMap
    91  metadata:
    92    name: <config-map-name>
    93  data:
    94    service.alertmanager: |
    95      targets:
    96      - 10.5.39.39:19093
    97      - 10.5.39.39:29093
    98      - 10.5.39.39:39093
    99      scheme: https
   100      apiPath: /api/v2/alerts
   101      insecureSkipVerify: true
   102      basicAuth:
   103        username: $alertmanager-username
   104        password: $alertmanager-password   
   105  ```
   106  
   107  - with bearerToken
   108  
   109  ```yaml
   110  apiVersion: v1
   111  kind: ConfigMap
   112  metadata:
   113    name: <config-map-name>
   114  data:
   115    service.alertmanager: |
   116      targets:
   117      - 10.5.39.39:19093
   118      - 10.5.39.39:29093
   119      - 10.5.39.39:39093
   120      scheme: https
   121      apiPath: /api/v2/alerts
   122      insecureSkipVerify: true
   123      bearerToken: $alertmanager-bearer-token
   124  ```
   125  
   126  ## Templates
   127  
   128  * `labels` - at least one label pair required, implement different notification strategies according to alertmanager routing
   129  * `annotations` - optional, specifies a set of information labels, which can be used to store longer additional information, but only for display
   130  * `generatorURL` - optional, default is '{{.app.spec.source.repoURL}}', backlink used to identify the entity that caused this alert in the client
   131  
   132  the `label` or `annotations` or `generatorURL` values can be templated.
   133  
   134  ```yaml
   135  context: |
   136    argocdUrl: https://example.com/argocd
   137  
   138  template.app-deployed: |
   139    message: Application {{.app.metadata.name}} has been healthy.
   140    alertmanager:
   141      labels:
   142        fault_priority: "P5"
   143        event_bucket: "deploy"
   144        event_status: "succeed"
   145        recipient: "{{.recipient}}"
   146      annotations:
   147        application: '<a href="{{.context.argocdUrl}}/applications/{{.app.metadata.name}}">{{.app.metadata.name}}</a>'
   148        author: "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Author}}"
   149        message: "{{(call .repo.GetCommitMetadata .app.status.sync.revision).Message}}"
   150  ```
   151  
   152  You can do targeted push on [Alertmanager](https://github.com/prometheus/alertmanager) according to labels.
   153  
   154  ```yaml
   155  template.app-deployed: |
   156    message: Application {{.app.metadata.name}} has been healthy.
   157    alertmanager:
   158      labels:
   159        alertname: app-deployed
   160        fault_priority: "P5"
   161        event_bucket: "deploy"
   162  ```
   163  
   164  There is a special label `alertname`. If you don’t set its value, it will be equal to the template name by default.