Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upHTTP API for getting alerts #1570
Comments
brian-brazil
added
the
feature-request
label
Apr 21, 2016
This comment has been minimized.
This comment has been minimized.
|
There is no HTTP API, however you can access the |
This comment has been minimized.
This comment has been minimized.
|
Looks like only firing alerts are available there and annotations are missing. |
This comment has been minimized.
This comment has been minimized.
|
There was a PR for that a while back. We should reconsider having an API I raised before that we generally want to have an API that allows to build On Thu, Apr 21, 2016, 9:32 PM Roman Belyakovsky notifications@github.com
|
This comment has been minimized.
This comment has been minimized.
|
I'm thinking of a telegram bot to get more details on alerts when internet connection is limited and web UI is difficult to access. By the way it's not mobile friendly for some reason, pretty unusual for a bootstrap based one. |
This comment has been minimized.
This comment has been minimized.
|
For that sort of thing, a link to a dashboard generally works best. |
This comment has been minimized.
This comment has been minimized.
|
That's much more to load than just an annotation string. So looking forward for an API. =) |
This comment has been minimized.
This comment has been minimized.
|
Personally I want this to embed Alert status in Grafana. If Prometheus provide API, it's very helpful. |
fabxc
added
kind/enhancement
and removed
feature request
labels
Apr 28, 2016
This comment has been minimized.
This comment has been minimized.
|
ALERTS is fine but doesn't seem to show inactive alerts. An API would be great. Looked quickly at the code, looks like simply converting to json the result of h.ruleManager.AlertingRules() would be a good start. |
This comment has been minimized.
This comment has been minimized.
|
Such an API would get accepted as part of our effort to make all UI features represented in our HTTP API. Contributions are gladly accepted. |
This comment has been minimized.
This comment has been minimized.
copernico
commented
Mar 8, 2017
|
+1 |
This comment has been minimized.
This comment has been minimized.
mg03
commented
Apr 1, 2017
|
@fabxc : i have some code written to expose endpoint /api/v1/alerts which puts out a json like so
Is there any other info that I can expose via the api? |
This was referenced Apr 4, 2017
This comment has been minimized.
This comment has been minimized.
moolitayer
commented
May 17, 2017
•
|
I don't understand, there already seems to be an API endpoint exposed from alert manager.
Where does that fit in this discussion? |
This comment has been minimized.
This comment has been minimized.
jsuchenia
commented
May 22, 2017
|
@moolitayer In a project name |
This comment has been minimized.
This comment has been minimized.
moolitayer
commented
May 29, 2017
|
So there is an API for alerts in alert manager but not in Prometheus? |
This comment has been minimized.
This comment has been minimized.
|
@moolitayer Correct. |
This comment has been minimized.
This comment has been minimized.
moolitayer
commented
Jun 1, 2017
|
Thanks @juliusv. I'm interested in collecting alerts from Prometheus and integrating them in an external system. Here is another related question; For effective collection I would like like to collect only new alerts using pull every X seconds. (possible solutions: using a time field OR using labels for collected alerts OR a streaming api similar to the kubernetes events endpoint) |
This comment has been minimized.
This comment has been minimized.
jsuchenia
commented
Jun 1, 2017
|
@moolitayer It doesn't make sense. From prometheus point of view it's collecting data every X time and evaluates rules every Y time. If you are scrapping alerts every Z seconds and it's more than Y then you expect that prometheus will keep historical alerts till your next check. Additionally how to handle restarts and your problems (like you lost updates about some resolve) So it's quite good that at one shot you can get a list of active alarms - you have a clear picture of a status |
This comment has been minimized.
This comment has been minimized.
moolitayer
commented
Jun 4, 2017
|
@jsuchenia It seems alert manager already has that data and I'm wondering if there is a mechanism there to get what I need? If an alert has fired and was immediately resolved for example I would still like to know about it so only resolved alerts are not enough for my use case. |
This comment has been minimized.
This comment has been minimized.
jsuchenia
commented
Jun 4, 2017
|
@moolitayer According to Alert Manager configuration you can specify a webhook that will be triggered whenever an alert state was changed. Is this something that works for you? |
This comment has been minimized.
This comment has been minimized.
moolitayer
commented
Jun 13, 2017
Thanks @jsuchenia. I have to initiate all the connections due to security concerns. Is that possible somehow? (kubernetes watch api is a good example of what I need) |
brian-brazil
added
component/ui
priority/P3
labels
Jul 14, 2017
This comment has been minimized.
This comment has been minimized.
|
@brancz Did you implement this already? |
This comment has been minimized.
This comment has been minimized.
|
@brian-brazil I implemented the alertmanagers endpoint, not alerts. That's still tbd. However as suggested before I would recommend to implement a system as described above as a webhook that is called by the Alertmanager instead of scraping Prometheus alerts. Nonetheless there are usecases for the alerts API. |
This comment has been minimized.
This comment has been minimized.
moolitayer
commented
Aug 27, 2017
|
In case this is of useful to someone, to collect alerts we web hooked alerts into another component (running on the same k8s pod as alert manager) and we are collecting from that component: |
This comment has been minimized.
This comment has been minimized.
midnightconman
commented
Dec 25, 2017
|
I have a use case where I would like to see triggered and non-triggered alerts, the current alertmanager alerts API currently only exposes triggered alerts. Would you guys welcome a PR to add functionality to be able to glean all alerts? I don't need an API, just the information exposed... I would be happy with adding a label to the |
This comment has been minimized.
This comment has been minimized.
|
It's not possible to list non-firing alerts, as we don't know their labels. |
This comment has been minimized.
This comment has been minimized.
midnightconman
commented
Dec 26, 2017
|
That's a good point... I really don't need an alerts api, but a rules api. I don't mind if it is read-only, just something better than html. In Prometheus 2.0 using |
This comment has been minimized.
This comment has been minimized.
|
Maybe a good extension for |
This comment has been minimized.
This comment has been minimized.
midnightconman
commented
Jan 5, 2018
This comment has been minimized.
This comment has been minimized.
omadawn
commented
Feb 9, 2018
This comment has been minimized.
This comment has been minimized.
burnettk
commented
Jun 28, 2018
|
In case anyone comes in here looking for an firing alert dashboard in grafana, here's one: https://grafana.com/dashboards/4181 |
This comment has been minimized.
This comment has been minimized.
amaury-d
commented
Jul 20, 2018
|
Hello, For anyone else looking at the answer, you can call |
This comment has been minimized.
This comment has been minimized.
|
See #4318 |
This comment has been minimized.
This comment has been minimized.
ealexhaywood
commented
Aug 8, 2018
|
@amaury-d yes, but that only returns firing alerts. People here want inactive and pending alerts as well |
This comment has been minimized.
This comment has been minimized.
|
@ealexhaywood #4318 exposes pending alerts via @juliusv as the initial issue is about getting alerts in general, should we close here with #4318 being merged? |
This comment has been minimized.
This comment has been minimized.
|
@mxinden Yes, thank you! Closing. |
juliusv
closed this
Aug 13, 2018
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 22, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |

hryamzik commentedApr 21, 2016
I didn't find anything about API for the /alerts in docs. I can see that /alerts returns html:
But is it possible to get them with json?