Hey,
the way to do this is to wrap your script behind something that can
receive a webhook and act on it. This way, the process lifecycle is
decoupled. You can probably repurpose some web server's CGI handler
for this if you need to … or depending on your case it may be easier
to implement the logic straight in a custom service.
/MR
On Wed, Jun 15, 2016 at 3:33 PM, Konstantin Ivanov <kaiv...@gmail.com> wrote:
> Is there a way based on an alert from AlertManager to execute a script. This
> is pretty helpful for let's say restart a process etc.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to prometheus-developers+unsub...@googlegroups.com.
No, Alertmanager can send the web hooks, they are one of the available notifiers. You would not need to poll, only handle these hooks when they are called.
/MR
So Alertmanager cannot be leveraged for this? It needs to be a separate service that pulls from Prometheus and executes the script ?
On Wednesday, June 15, 2016 at 10:36:47 AM UTC-5, Matthias Rampke wrote:
Hey,
the way to do this is to wrap your script behind something that can
receive a webhook and act on it. This way, the process lifecycle is
decoupled. You can probably repurpose some web server's CGI handler
for this if you need to … or depending on your case it may be easier
to implement the logic straight in a custom service.
/MR
On Wed, Jun 15, 2016 at 3:33 PM, Konstantin Ivanov <kaiv...@gmail.com> wrote:
> Is there a way based on an alert from AlertManager to execute a script. This
> is pretty helpful for let's say restart a process etc.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to prometheus-devel...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
Matthias Rampke
Engineer
SoundCloud Ltd. | Rheinsberger Str. 76/77, 10115 Berlin, Germany | +49
173 6395215
Managing Director: Alexander Ljung | Incorporated in England & Wales
with Company No. 6343600 | Local Branch Office | AG Charlottenburg |
HRB 110657B
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
This is along the lines of what I am thinking of doing as well. Basically have the first alert only call the webhook, then the web hook will either fix the issue or create an alert which does get escalated to whatever the paging mechanism is. I'm also figuring on each service running in its own Go process and exporting "/metrics" for prometheus to then pull in. Meta-metrics, in a sense. ;)
Cheers,
Bill
Just a random thought: you could also setup routing for the same alerts twice. Once to your auto-fixing webhook and once to something that actually pages.
You make the wait interval for the latter reasonably long and it won't fire if the webhook fixed the issue by which the alerts got resolved.
Could be a semantically simpler alternative to creating extra alerts.