I can't find the REST API documentation for Alertmanager. Am I missing something? Is this somewhere documenten?
A minimum document is available at https://prometheus.io/docs/alerting/clients/.
I think it's enough to make client to send alerts.
Thanks for this, but I was actually looking for how to manage "silences".
I want to programmatically silence alerts during the application deployment. For now, I'm figuring this out by looking at the XHR payloads of the GUI.
The current API is not documented as it is subject to change, which
hopefully happens within Q4.
We don't provide any stability guarantees around the current API but will
for the next one.
That said, if you want to add documentation, PRs are more than welcome in
prometheus/docs if decorated with a disclaimer on the instability.
On Wed, Sep 21, 2016 at 5:55 PM Karel Maesen [email protected]
wrote:
Thanks for this, but I was actually looking for how to manage "silences".
I want to programmatically silence alerts during the application
deployment. For now, I'm figuring this out by looking at the XHR payloads
of the GUI.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/prometheus/alertmanager/issues/511#issuecomment-248656567,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEuA8s_3HIo_0QoOhxm9BJcopfkj-rb5ks5qsVNcgaJpZM4KC9Y9
.
Hi
Any update about documentation of AlertManager REST API?
+1
@it-praktyk @wangycc This is still on our road-map but we are too occupied with the current stabilization work and UI rewrite at the moment. In addition it is still subject to change.
I think most of the API can be understood by reading the source code. Feel free to ping us if you have any questions here.
Of course as always we are very happy for PRs. I am sorry for this disappointing reply.
Do you have any standard for describing of REST APIs?
If not is it the OpenAPI Specification/Swagger RESTful API Documentation Specification OK?
@it-praktyk a swagger documentation sounds like a good idea. There were plans to use the GRPC gateway and auto generate a swagger documentation, but this is still to be determined.
Please wait for @fabxc approval.
+1
+1
@mxinden
Please wait for @fabxc approval.
Lack of @fabxc it's a proof (not only one, based on my experience in work with Prometheus) that documentation is not important for the core development team.
I'm not interested to do that work now. I stopped work with Prometheus some times ago.
I really need it. Otherwise, I can not silence everything what I need during deploy by ansible
This isn't currently very high priority, unfortunately. My recommendation is to read the code https://github.com/prometheus/alertmanager/blob/master/api/api.go#L131-L134 (it has been fairly stable), or to use the cli amtool assist you. amtool has its own documentation built in.
+1
Hopefully it has impact on priority :-)
You have to POST to the api to create a silence, which I believe is not technically RESTful. It also means you have to embed a form in the alert email rather than just providing a link to create a silence. Anyway, here is an example curl command to create a silence:
curl -H "Content-Type: application/json" -X POST -d '{"comment": "test1","createdBy": "test1","endsAt": "2019-02-20T18:00:59.46418637Z","matchers": [{"isRegex": false,"name": "severity","value": "critical"},{"isRegex": false,"name": "job","value": "prometheus"},{"isRegex": false,"name": "instance","value": "localhost:9090"},{"isRegex": false,"name": "alertname","value": "InstanceDown"}]}' http://alerts.example.org:9093/api/v1/silences
The command from @kylebevans returns a status and silenceId (sid). It can also be found in the silenced alert URL. This can then be used to delete a silence (note v1/silence vs. v1/silences):
curl -X DELETE http://alerts.example.org:9093/api/v1/silence/<silenceId>
+1
Discussion on introducing an OpenAPI generated Alertmanager API v2 with generated documentation: https://groups.google.com/forum/#!topic/prometheus-developers/2CCuFTMbmAg
Respective PR: https://github.com/prometheus/alertmanager/pull/1352
Feedback is very welcome.
We are creating own system, in which we will user alertmanager Rest API. Is it possible we can silence all alert of a component using an Alertmanager Rest Api?
@ajayagrawal7 Please do not hijack this thread. In addition this is a usage question. Please open it up on the prometheus-users mailing list.
We use an internal overview tool (amongst other tools) to view data from Prometheus, Icinga2 alerts and other sources. I'd like to be able to pull back data from Alertmanager. Is the plan to keep the current semi-documented API, and develop a new one under /v2? Or will the current one have breaking changes in an update?
@iDemonix I guess that http://alerta.io/ could help you in this case.
@iDemonix yes, the new API v2 will live alongside the old API v1 for now. But we are planning on deprecating v1 in future versions.
I expect https://github.com/prometheus/alertmanager/pull/1352 soon to merge. Have you tried generating a client via the OpenAPI specification? We don't give any stability guarantees on the new API, but given the scope and the autogeneration possibility, adjusting to change in your internal tool should be fairly simple.
Closing as the API v2 is now merged and released.
So where is the documentation?
So where is the documentation?
The README links to a HTML version of the specification.
Many thanks.
curl -X DELETE http://alerts.example.org:9093/api/v1/silence/
is there a way to get the silence ID alone after posting a silence.
@addy3494 API v2 returns the silence ID of the newly created silence: https://github.com/prometheus/alertmanager/blob/master/api/v2/openapi.yaml#L83.
Please use the prometheus-users mailing list for questions of this kind in the future. https://prometheus.io/community/
Is there any API available to add/modify/delete the routes/receivers in the alertmanager.yaml? If not, any suggestions on how to automate it?
@maskayman make a script/program that rewrites alertmanager.yaml and reloads alertmanager?
Alertmanager REST API
Go to https://editor.swagger.io/
File Import File - (https://github.com/prometheus/alertmanager/blob/master/api/v2/openapi.yaml)
Use raw link for import of openapi.yaml https://raw.githubusercontent.com/prometheus/alertmanager/master/api/v2/openapi.yaml
You will get all the documentation you need and also you can create client codes from the same page.
For managing rules you may want to look at prometheus REST api - https://prometheus.io/docs/prometheus/latest/querying/api/#rules
Hope this helps.
this: https://github.com/prometheus/alertmanager/blob/master/api/v2/openapi.yaml
Most helpful comment
Thanks for this, but I was actually looking for how to manage "silences".
I want to programmatically silence alerts during the application deployment. For now, I'm figuring this out by looking at the XHR payloads of the GUI.