Alertmanager
Checks Prometheus AlertManager for any firing alerts.
The following example transforms the list of alerts so that each alert becomes a single check result. Without the transform the health check will fail if any alerts are firing.
alert-manager-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
  name: alertmanager-check
spec:
  schedule: "*/5 * * * *"
  alertmanager:
    - url: alertmanager.monitoring.svc
      alerts:
        - .*
      ignore:
        - KubeScheduler.*
        - Watchdog
      transform:
        expr: |
          results.alerts.map(r, {
            'name': r.name + r.fingerprint,
            'namespace': 'namespace' in r.labels ? r.labels.namespace : '',
            'labels': r.labels,
            'icon': 'alert',
            'message': r.message,
            'description': r.message,
          }).toJSON()
| Field | Description | Scheme | Required | 
|---|---|---|---|
alerts | A list of alert prefix names to include | []string | |
ignore | A list of alert prefix names to exclude | []string | |
filters | A map of label to value prefixes to find alerts on | map[string]string | |
name | Name of the check, must be unique within the canary | string | Yes | 
description | Description for the check | string | |
icon | Icon for overwriting default icon on the dashboard | string | |
labels | Labels for check | map[string]string | |
test | Evaluate whether a check is healthy | Expression | |
display | Expression to change the formatting of the display | Expression | |
transform | Transform data from a check into multiple individual checks | Expression | |
metrics | Metrics to export from | []Metrics |