Sign inSign up

mricho/alertmanager-resource

By mricho

Updated almost 8 years ago

concourse resource for managing prometheus/alertmanager

Image
0

9.3K

mricho/alertmanager-resource repository overview

Alertmanager Resource Build Status

A Concourse resource to interact with Prometheus Alertmanager, allowing you to silence certain alerts and to expire silences.

Source Configuration

FieldRequiredTypeDescription
urlYStringAlertmanager URL. If alertmanager is protected by an username and password, specify them at the URL (ie http://user:[email protected]).

Note: Self signed SSL certificates are not yet supported, in this case, use the http schema.

Behavior

check: Does nothing.
in: Fetch a silence.

Places the following file in the destination directory:

  • silence: Contains the id of the silence created by an out step.
out: Silence an alert or expire a silence.

Performs one of the following actions:

Parameters
FieldRequiredTypeDescription
operationYStringOperation to perform: silence or expire
Silence parameters
FieldRequiredTypeDescription
matchersYStringThe matcher groups to silence [1]
creatorNStringThe email of the silence creator
commentsNStringA comment to help describe the silence (defaults to the CI pipeline URL)
expiresNStringDuration of the silence (defaults to 1h)

[1] The following examples will attempt to show the matcher behaviour in action:

MatcherBehaviour
service=cfwill add a silence that matches alerts with the service=cf label value pair set
alertname=CFCellUnhealthy service=cfwill add a silence for the CFCellUnhealthy alert and matches the service=cf label value pair set
alertname=~CF.*the =~ syntax (similar to prometheus) is used to represent a regex match (regex matching can be used in combination with a direct match)
Expire parameters
FieldRequiredTypeDescription
silenceYStringThe path of the silence to expire (a directory containing the silence file)

Example Configuration

Resource Type
resource_types:
  - name: alertmanager-resource
    type: docker-image
    source:
      repository: frodenas/alertmanager-resource
Resource
resources:
  - name: alertmanager
    type: alertmanager-resource
    source:
      url: <ALERTMANAGER URL>
Plan

The below example manages multiple silences at the same plan. The silence parameter for expire operations is the name of the step who created the silence. Normally this is just the same as the name of the resource, but if you have custom names for put (for example if you need to silence multiple alerts), you would put that name instead. For example:

jobs:
  - name: backups
    plan:
      - put: silence-cf-alerts
        resource: alertmanager
        params:
          operation: silence
          matchers: "service=cf"
          expires: 30m

      - put: silence-mysql-alerts
        resource: alertmanager
        params:
          operation: silence
          matchers: "service=mysql severity=warning"
          expires: 30m

      ... do my stuff ...

      - put: expire-cf-silence
        resource: alertmanager
        params:
          operation: expire
          silence: silence-cf-alerts

      - put: expire-mysql-silence
        resource: alertmanager
        params:
          operation: expire
          silence: silence-mysql-alerts

Contributing

Refer to the contributing guidelines.

License

Apache License 2.0, see LICENSE.

Tag summary

Content type

Image

Digest

Size

29.9 MB

Last updated

almost 8 years ago

docker pull mricho/alertmanager-resource