# Alerts w/ Holt-Winters

**URL:** <https://community.grafana.com/t/alerts-w-holt-winters/1853>\
**Category:** Grafana\
**Created:** [July 17, 2017, 10:05pm UTC](https://community.grafana.com/t/alerts-w-holt-winters/1853 "2017-07-17T22:05:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartkusa](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/bartkusa/32/1027_2.png) [@bartkusa](https://community.grafana.com/u/bartkusa)\
**Post date:** [July 17, 2017, 10:05pm UTC](https://community.grafana.com/t/alerts-w-holt-winters/1853/1 "2017-07-17T22:05:26Z")

</div>

I’m trying to set up an alert on sinusoidish data using [holtWintersAberration](http://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.holtWintersAberration). I’m getting a lot of false-positives, and I wonder if it’s because

1. holtWinters stuff doesn’t work unless you have a lot of data-points, and
2. Grafana alerts make it hard to select a big-enough timespan.

Suppose I have these queries

```
A: summarize( foo.bar.baz, '1h', 'sum', false )
B: holtWintersAberration(#A, 2)

```

I’ve tried a lot of things that don’t work, including:

- Setting summarize’s alignToInterval to true, so the newest data-point isn’t temporally incomplete.
- Setting “override relative time” on the graph to 4 weeks, to pull more data.
- Querying for “max” of “query(B, 3h, now)”, to look at the 3 most recent data-points, and only alarming if they’re all aberrant.

I _think_ what I want is to query for “last” of “query(B, 3w, now)”, but when I try setting it to 3 weeks, I get an error.

Am I doing this entirely wrong? Has anyone had success setting up a Holt-Winters-based alert?

---

<div class="post-metadata">

**Author:** ![torkel](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/torkel/32/20_2.png) [@torkel](https://community.grafana.com/u/torkel)\
**Post date:** [July 18, 2017, 7:14pm UTC](https://community.grafana.com/t/alerts-w-holt-winters/1853/2 "2017-07-18T19:14:32Z")

</div>

> [@bartkusa](#):
>
> I think what I want is to query for “last” of “query(B, 3w, now)”, but when I try setting it to 3 weeks, I get an error.

What error?

Try query(B, 3w, now-1h)

So you do not include the incomplete last hour

---

<div class="post-metadata">

**Author:** ![bartkusa](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/bartkusa/32/1027_2.png) [@bartkusa](https://community.grafana.com/u/bartkusa)\
**Post date:** [July 18, 2017, 7:43pm UTC](https://community.grafana.com/t/alerts-w-holt-winters/1853/3 "2017-07-18T19:43:35Z")

</div>

Thanks for the suggestion, Torkel!

After I set the query to “query(B, 3 **h** , now-1h)”, I can save it without error.

After I set the query to “query(B, 3 **w** , now-1h)”, I get this error when I click save:

```
{"message":"Invalid alert data. Cannot save dashboard"}
```

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [July 18, 2017, 11:09pm UTC](https://community.grafana.com/t/alerts-w-holt-winters/1853/4 "2017-07-18T23:09:51Z")

</div>

If you look in the Grafana server log the error is:

```auto
Invalid alert data. Cannot save dashboard ... error="time: unknown unit w in duration -3w ..."

```

Seems that there is only support for hours/minutes/seconds in alert conditions. So instead of `3w` you’ll have to convert it to hours: `504h`

---

<div class="post-metadata">

**Author:** ![bartkusa](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/bartkusa/32/1027_2.png) [@bartkusa](https://community.grafana.com/u/bartkusa)\
**Post date:** [July 18, 2017, 11:39pm UTC](https://community.grafana.com/t/alerts-w-holt-winters/1853/5 "2017-07-18T23:39:36Z")

</div>

That’s amazing. I’ll try that.

---

<div class="post-metadata">

**Author:** ![bartkusa](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/bartkusa/32/1027_2.png) [@bartkusa](https://community.grafana.com/u/bartkusa)\
**Post date:** [July 25, 2017, 1:17am UTC](https://community.grafana.com/t/alerts-w-holt-winters/1853/6 "2017-07-25T01:17:51Z")

</div>

I set my alarm to look at the past 504 hours, and it worked.

However, my alarm is constantly flapping with false alarms, on the :05 of each hour.

 ![](https://us1.discourse-cdn.com/grafana/original/2X/9/9bb7045b4b403381779bee94ac1b5ae42129bd9c.png)

It alarms intermittently, whether or not I configure the alarm to check before `"now"` or `"now - 1h"`.

It alarms intermittently, no matter how I set `summarize`’s `alignToInterval` param.

I wonder if it’s even _possible_ to set up a reliable Holt-Winters-based alarm, given the controls available to me.

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [July 25, 2017, 8:32am UTC](https://community.grafana.com/t/alerts-w-holt-winters/1853/7 "2017-07-25T08:32:04Z")

</div>

Do have you any idea why it is flapping? Would it help to timeshift the query by an hour using the Graphite timeshift function?
