squeakywheel/prometheus-alertmanager

By squeakywheel

Updated over 4 years ago

Image

357

Prometheus Alertmanager | Ubuntu

About Prometheus Alertmanager

The Alertmanager handles alerts sent by client applications such as the Prometheus server. It takes care of deduplicating, grouping, and routing them to the correct receiver integration such as email, PagerDuty, or OpsGenie. It also takes care of silencing and inhibition of alerts. Read more on the Prometheus Alertmanager website.

Tags

  • 0.21.0-focal, 0.21.0, 0.21-focal, 0.21, focal, beta - /!\ this is a beta release

Architectures supported

  • amd64, arm64, ppc64el, s390x

Usage

Docker CLI
$ docker run -d --name alertmanager -p 30093:9093 -e TZ=UTC squeakywheel/prometheus-alertmanager:edge

Access your Prometheus Alertmanager instance at localhost:30093.

Parameters

ParameterDescription
-e TZ=UTCTimezone.
-p 30093:9093Expose Prometheus Alertmanager server on localhost:30093.
-v /path/to/persisted/data:/alertmanagerPersist data instead of initializing a new database for each newly launched container. Important note: the directory you will be using to persist the data needs to belong to nogroup:nobody. You can run chown nogroup:nobody <path_to_persist_data> before launching your container.
-v /path/to/alertmanager.yml:/etc/prometheus/alertmanager.ymlPass a custom config file (download this example file).

Testing/Debugging

In case you need to debug what it is happening with the container you can run docker logs <name_of_the_container>. To get access to an interactive shell run:

$ docker exec -it <name_of_the_container> /bin/bash
Deploy with Kubernetes

You can use your favorite Kubernetes distribution; if you don't have one, consider installing MicroK8s.

With microk8s running, enable the dns and storage add-ons:

$ microk8s enable dns storage

Create a configmap for the configuration file (check the Prometheus documentation):

$ microk8s kubectl create configmap alertmanager-config --from-file=alertmanager=config/alertmanager.yml

Use the sample deployment yaml provided here.

Apply the `prometheus-alertmanager-deployment.yml` (click to expand)
# prometheus-alertmanager-deployment.yml
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: alertmanager-volume-claim
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: microk8s-hostpath
  resources:
    requests:
      storage: 500M
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: alertmanager-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: alertmanager
  template:
    metadata:
      labels:
        app: alertmanager
    spec:
      containers:
      - name: alertmanager
        image: squeakywheel/prometheus-alertmanager:edge
        volumeMounts:
        - name: alertmanager-config-volume
          mountPath: /etc/alertmanager/alertmanager.yml
          subPath: alertmanager.yml
        - name: alertmanager-data
          mountPath: /alertmanager
        ports:
        - containerPort: 9093
          name: alertmanager
          protocol: TCP
      volumes:
        - name: alertmanager-config-volume
          configMap:
            name: alertmanager-config
            items:
            - key: alertmanager
              path: alertmanager.yml
        - name: alertmanager-data
          persistentVolumeClaim:
            claimName: alertmanager-volume-claim
---
apiVersion: v1
kind: Service
metadata:
  name: alertmanager-service
spec:
  type: NodePort
  selector:
    app: alertmanager
  ports:
  - protocol: TCP
    port: 9093
    targetPort: 9093
    nodePort: 30093
    name: alertmanager
$ microk8s kubectl apply -f prometheus-alertmanager-deployment.yml

You will now be able to connect to the Prometheus on http://localhost:30093.

Bugs and Features request

If you find a bug in our image or want to request a specific feature file a bug here:

https://bugs.launchpad.net/ubuntu-docker-images/+filebug

In the title of the bug add prometheus-alertmanager: <reason>.

Make sure to include:

  • The digest of the image you are using, you can find it using this command replacing <tag> with the one you used to run the image:
$ docker images --no-trunc --quiet squeakywheel/prometheus-alertmanager:<tag>
  • Reproduction steps for the deployment
  • If it is a feature request, please provide as much detail as possible

Docker Pull Command

docker pull squeakywheel/prometheus-alertmanager