Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Notify if an alert is triggered regardless of previous state #6685

Closed
ghost opened this issue Nov 23, 2016 · 9 comments
Closed

Comments

@ghost
Copy link

ghost commented Nov 23, 2016

What Grafana version are you using?

Grafana v4.0.0-beta2

What datasource are you using?

InfluxDB

What OS are you running grafana on?

Ubuntu 14.04

It appears that (after performing tests and looking at code) notifications are only fired when an alert's state changes.

I'm not sure if this is on the roadmap/radar but it would be good to be able to send the notification as long as it evaluates to alerting, regardless of the previous state. The concern here is that the alert notification goes unnoticed, and in the worst case, the time to discovery becomes very long. With repeat alerts, the hope is that the chance of missing it drops for each repeated alarm.

if ctx.Rule.State != oldState {
handler.log.Info("New state change", "alertId", ctx.Rule.Id, "newState", ctx.Rule.State, "oldState", oldState)
cmd := &m.SetAlertStateCommand{
AlertId: ctx.Rule.Id,
OrgId: ctx.Rule.OrgId,
State: ctx.Rule.State,
Error: exeuctionError,
EvalData: annotationData,
}
if err := bus.Dispatch(cmd); err != nil {
handler.log.Error("Failed to save state", "error", err)
}
// save annotation
item := annotations.Item{
OrgId: ctx.Rule.OrgId,
DashboardId: ctx.Rule.DashboardId,
PanelId: ctx.Rule.PanelId,
Type: annotations.AlertType,
AlertId: ctx.Rule.Id,
Title: ctx.Rule.Name,
Text: ctx.GetStateModel().Text,
NewState: string(ctx.Rule.State),
PrevState: string(oldState),
Epoch: time.Now().Unix(),
Data: annotationData,
}
annotationRepo := annotations.GetRepository()
if err := annotationRepo.Save(&item); err != nil {
handler.log.Error("Failed to save annotation for new alert state", "error", err)
}
handler.notifier.Notify(ctx)
}

I'm not sure if this is on the roadmap/radar but it would be great to be able to send the notification as long as the alert evaluates to true, regardless of the previous state. For reference, this is a configurable option of Kapacitor:

https://github.com/influxdata/kapacitor/blob/master/etc/kapacitor/kapacitor.conf#L274

@bergquist bergquist added this to the 4.1.0 milestone Nov 24, 2016
@bergquist
Copy link
Contributor

Seems like a reasonable thing to configure.

@pdf
Copy link

pdf commented Jan 14, 2017

You would certainly need some form of minimum notification interval before enabling this.

@ghost
Copy link

ghost commented Jan 14, 2017

I have another slightly different use case for this. I have multiple series in a graph: https://snapshot.raintank.io/dashboard/snapshot/V6cQW9mzHHfnDJHKgNKbyyCfzp4nZSBy

When the first reaches the alert level, everything goes smooth, but when the second reaches the alert level, it doesn't flip the alert state, and thus doesn't trigger anything. It'd be useful though :)

An idea how to go about this: a per-alert "notification id", which can use variables to distinguish between the desired alerts. In my graph above, I'd set the notification id to {{host}}.

@yannispanousis
Copy link

Prrety much same as #7330. +1

@mandeepsandhu
Copy link

Is there a status update on this feature? Any upcoming release we can expect it in?

@bergquist
Copy link
Contributor

Closing this since its very simular to #6685

By configuring frequency/min-delay to 0 should all the notifier to execute on every evaluation.

@chaipugao
Copy link

@lgierth I hava the same problem with you.
can you detail how to config a per-alert "notification id" what you mentioned above?
thank you

@danielney
Copy link

I have a metric that I want to evaluate every 24 hours and if it crosses a threshold generate the alert regardless of whether the alert was generated in the previous evaluation. I am confused about what it means to set frequency to 0. Is the feature to repeat an alert implemented or not? What version?

@kubaseai
Copy link

Workaround: generate zero/one periodic signal and multiply original query with this query. You'll get dummy clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants