# Alerts not being sent to Alertmanager

**URL:** <https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050>\
**Category:** Grafana Loki\
**Tags:** alerting\
**Created:** [September 8, 2021, 6:08pm UTC](https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050 "2021-09-08T18:08:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![omyno](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@omyno](https://community.grafana.com/u/omyno)\
**Post date:** [September 8, 2021, 6:08pm UTC](https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050/1 "2021-09-08T18:08:07Z")

</div>

I have set up a ruler in Loki 2.3.0 and can see the rule being applied, but the alarm does not seem to be sent to Alertmanager. I can see “Get - deadline exceeded” in the log. What should the log look like if the alert is successfully sent to Alertmanager?

```auto
ts=2021-09-08T17:45:37.563238254Z caller=metrics.go:92 org_id=fake traceID=0cbff1adf7072e33 latency=fast query="{namespace=\"snip"} |= \"220397739\"
er range_type=range length=1h0m1s step=1s duration=48.616908ms status=200 limit=1000 returned_lines=8 throughput=3.9MB total_bytes=190kB
level=debug

ts=2021-09-08T17:45:37.563417673Z caller=logging.go:66 traceID=0cbff1adf7072e33 msg="GET /loki/api/v1/query_range?direction=BACKWARD&limit=1000&query=%7Bnamespacesnip&start=1631119537000000000&end=1631123138000000000&step=1 (200) 49.154623ms"
level=debug

ts=2021-09-08T17:45:39.424481812Z caller=mock.go:149 msg="Get - deadline exceeded" key=collectors/ring

```

---

<div class="post-metadata">

**Author:** ![anon74857911](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@anon74857911](https://community.grafana.com/u/anon74857911)\
**Post date:** [September 8, 2021, 8:55pm UTC](https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050/2 "2021-09-08T20:55:16Z")

</div>

Hi @omyno

Can you please provide your Loki config?  
This looks to be an issue communicating with the ring; I don’t think this has anything to do with sending to Alertmanager yet.

---

<div class="post-metadata">

**Author:** ![omyno](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@omyno](https://community.grafana.com/u/omyno)\
**Post date:** [September 8, 2021, 10:01pm UTC](https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050/3 "2021-09-08T22:01:48Z")

</div>

Hi @anon74857911 and thank you very much for your reply.

This is my configuration (installed via official Helm chart in Kubernetes). Is it necessary to use a different kvstore storage backend than inmemory?

```auto
extraArgs:
  log.level: debug
config:
  ruler:
    storage:
      type: local
      local:
        directory: /data/.ruler/loki/rules
    rule_path: /data/.ruler/loki/rules-tmp
    alertmanager_url: http://rancher-monitoring-alertmanager.cattle-monitoring-system.svc:9093
    ring:
      kvstore:
        store: inmemory
    enable_api: true
    enable_alertmanager_v2: true
persistence:
  enabled: true
  accessModes:
  - ReadWriteOnce
  size: 10Gi
  existingClaim: pvc-loki
  mountPath: "/data"
resources: {}
securityContext:
  fsGroup: 10001
  runAsGroup: 10001
  runAsNonRoot: true
  runAsUser: 10001
readOnlyRootFilesystem: false

```

Here’s the alert rule:  
`/data/.ruler/loki/rules/fake/rules.yml`:

```auto
groups:
  - name: snip
    rules: 
      - alert: HighLogRate
        annotations: 
          message: "App is throwing too many errors per minute"
        expr: 'sum(rate({namespace="snip"}[1m])) > 1'
        for: 1m
        labels: 
          severity: warning
          namespace: snip

```

---

<div class="post-metadata">

**Author:** ![anon74857911](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@anon74857911](https://community.grafana.com/u/anon74857911)\
**Post date:** [September 8, 2021, 10:25pm UTC](https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050/4 "2021-09-08T22:25:22Z")

</div>

Hhmm, I’m not certain about that.

I wonder why/how it’s timing out. Maybe it’s a red herring?

First things first: let’s try changing the alert expression to something you are 100% certain will succeed (like `1+1`). See if that results in a call to the AM and what log messages are produced.

---

<div class="post-metadata">

**Author:** ![omyno](https://avatars.discourse-cdn.com/v4/letter/o/7ab992/32.png) [@omyno](https://community.grafana.com/u/omyno)\
**Post date:** [September 9, 2021, 12:16pm UTC](https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050/5 "2021-09-09T12:16:25Z")

</div>

So the first rule evaluation result was discarded which seems to be expected, but then I actually got the Alertmanager alarm for 1+1. This is a big step forward, thank you very much, @anon74857911!

I send pod logs from another Kubernetes cluster to Fluentd which look fine in Grafana itself.

I will further research why this expression does not work in a ruler. It works as expected in Grafana.

---

<div class="post-metadata">

**Author:** ![anon74857911](https://avatars.discourse-cdn.com/v4/letter/a/8edcca/32.png) [@anon74857911](https://community.grafana.com/u/anon74857911)\
**Post date:** [September 9, 2021, 1:39pm UTC](https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050/6 "2021-09-09T13:39:34Z")

</div>

Glad that helped!

Just make sure that the ruler has the same `storage_config` so that it can query your logs.  
The ruler itself is basically a querier with rule evaluation bolted on.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [September 9, 2022, 1:40pm UTC](https://community.grafana.com/t/alerts-not-being-sent-to-alertmanager/53050/7 "2022-09-09T13:40:16Z")

</div>

Closed on September 9, 2022, 1:40pm UTC

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
