Get service/host history with API

I’m new here, maybe you can help me with my question.

I use the API quite a lot to query information about the hosts or services, also to create/remove downtime, acknowledgement, etc. Very powerfull tool and the documentation is also quite good to understand the filters.

I wonder if there is a way to get the history of a given host or service, either using curl or icingacli. I’m talking about the history you can see in Icingaweb2 when you click on the history tab for a given host/service.
I have not found anything about this so right now my only option would be to dig directly into the database which I would like to avoid if possible.

Thanks for your help!


the REST API is a status and config API and allows to query the runtime state of the core. There’s no history backend for this kind of API.

The data you’re seeing with Icinga Web 2 is stored in a database, namely DB IDO. Relational databases have proven to work reliably with storing and retrieving historical event data. As such, if you want to retrieve that data, the Icinga Web 2 API (format=json) is a good candidate. Keep in mind that automated queries and long running SQL statements may harm operations, so using that with care and a caching daemon in the middle is a good advise.



Thank you for the quick answer.
When you say IcingaWeb2 API, do you mean something like :

 curl -H 'Accept: application/json' -i 'https://localhost/icingaweb2/monitoring/service/history?host=somehost&service=someservice' 

Or is there something else that I’m missing ?


Ah, I forgot, this only works for the main history view. This can be filtered as well, and needs the JSON format.


1 Like

Perfect !

When using curl, it actually returns json format even if you don’t specify it, I also did not have to specify “modifyFilter=” to hide the filter.

This worked for me to get history of service “myservice” applied to host “myhost” in a json format.

curl -s -u admin:admin -H 'Accept: application/json' 'https://localhost/icingaweb2/monitoring/list/eventhistory?timestamp%3E=-10%20hours&host_name=myhost&service_description=myservice'

Thank you.

1 Like

hi, do you know where is the document about icingaweb2 api? i want to set acknowledge_notify through the icingaweb2 api, but i could not find the documentation in anywhere.

I am wondering about where the Icinga Web API documentation is as well. I’ve found docu for Icinga’s core and Director API, but not Icinga Web.