API- get Downtime end


I want to get a message 30 minutes before a downtime ends.
Is it possible to get the downtime end with an API call?

Hi @derSven

you can query v1/objects/downtimes for this.

curl -k -s -u user:password 'https://<servername>:5665/v1/objects/downtimes' -X POST -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -d '{"attrs" : ["end_time"]}'

Kind regards


i’ve got the same question. After queries the API with the curl, i always become this return message:

{“error”:404.0,“status”:“No objects found.”}

If I query my hosts with the filter “host.downtime_depth != 0”, I’ll retrieve the hosts as expected.

The /downtimes object is still not well documentated as I see. :frowning:

Any Ideas?

Hey @Toby

does your API user have the correct permissions?
permissions = [ "objects/query/Downtime" ]

Kind regards

1 Like

Hey @ritzgu
I added the permission, but that does not solve the Problem.
The response is still “no objects found” but in the web ui are active downtimes

Kind regards


What version of icinga2 are you using? (I’m on r2.12.3-1)

The following works just fine for me:

ApiUser config:

object ApiUser "test" {
  password = "***************"
  permissions = [ "objects/query/Downtime" ]


curl -k -s -u test:*************** 'https://localhost:5665/v1/objects/downtimes?pretty=1' -X POST -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -d '{"attrs" : ["end_


    "results": [
            "attrs": {
                "end_time": 1622363375.0
            "joins": {},
            "meta": {},
            "name": "hostname!servicename!<GUID>",
            "type": "Downtime"

Hey @ritzgu
I am on r2.8.2.

Hey @ritzgu,

I tried it again and got the expected response. :smiley:

1 Like

Nice! Keep in mind that r2.8.2 is already three years old! :slight_smile:

1 Like