Prometheus: Alertmanager – send alerts to a “/dev/null”
Tags: prometheus, monitoring, alertmanager
Published: 2019-03-28 19:05:36

---
title: Prometheus: Alertmanager – send alerts to a “/dev/null”
published: true
tags: Prometheus,monitoring,Alertmanager
canonical_url: https://rtfm.co.ua/en/prometheus-alertmanager-send-alerts-to-a-dev-null/
---

![](https://rtfm.co.ua/wp-content/uploads/2017/09/prometheus-logo.png)In addition to the [Prometheus: Alertmanager’s alerts receivers and routing based on severity level and tags post](https://rtfm.co.ua/en/prometheus-alertmanager-send-alerts-to-a-dev-null/) post.

Have an Alertmanager config with routes.

The task is – send all alerts from a Dev-environment into a “/dev/null”.

To do this – create an empty receiver:

```
...
receivers:
  - name: 'blackhole'
  - name: 'default'
    slack_configs:
      - send_resolved: true
        title_link: 'http://dev.monitor.example.world/prometheus/alerts'
        title: '{{ if eq .Status "firing" }}:confused:{{ else }}:dancing_panda:{{ end }} [{{ .Status | toUpper }}] {{ .CommonAnnotations.summary }}'
        text: "{{ range .Alerts }}*Priority*: `{{ .Labels.severity | toUpper }}`\nMonitoring host: {{ .Labels.monitor }}\n{{ .Annotations.description }}\n{{ end }}"
...
```

And in routes add new rules – check the env tag used in our monitoring with the `match_re` and send all matches to the `receiver: blackhole`:

```
...
  receiver: 'default'
  routes:
    # capture All INFO
    - match:
        severity: info
      receiver: default
      routes:
      # forward Dev INFO to the 'blackhole'
      - match_re:
          env: .*(-dev).*
        receiver: blackhole
    # capture All WARN to the 'warning' with P3
    - match:
        severity: warning
      receiver: warning
      routes:
      # forward Dev WARNING to the 'blackhole'
      - match_re:
          env: .*(-dev).*
        receiver: blackhole
      # forward Stage WARN to the 'default'
      - match_re:
          env: .*(-stage).*
        receiver: default
    # capture All CRIT to the 'critical' with P1
    - match:
        severity: critical
      receiver: critical
      routes:
      # forward Dev CRIT to the 'blackhole'
      - match_re:
          env: .*(-dev).*
        receiver: blackhole
      # forward Stage CRIT to the 'default'
      - match_re:
          env: .*(-stage).*
        receiver: default
...
```

Done.
  

### Similar posts


- <small>03/06/2019</small> [Prometheus: blackbox-exporter probe\_http\_status\_code == 0 and its debug](https://dev.to/setevoy/prometheus-blackbox-exporter-probehttpstatuscode--0-and-its-debug-41mc)<small> (0)</small>  
- <small>03/10/2019</small> [Prometheus: RTFM blog monitoring set up with Ansible – Grafana, Loki, and promtail](https://dev.to/setevoy/prometheus-rtfm-blog-monitoring-set-up-with-ansible--grafana-loki-and-promtail-58i)<small> (0)</small>  
- <small>08/15/2018</small> [Prometheus: проверка отсутствия метрик – avg\_over\_time()](https://rtfm.co.ua/prometheus-proverka-otsutstviya-metrik-avg_over_time/)<small> (0)</small>  
- <small>10/30/2018</small> [Prometheus: Alertmanager’s alerts receivers and routing based on severity level and tags](https://rtfm.co.ua/en/prometheus-alertmanagers-alerts-receivers-and-routing-based-on-severity-level-and-tags/)<small> (0)</small>