Icinga2 API: AND OR concatenations

This forum was archived to /woltlab and is now in read-only mode.
  • Hey all, I'm currently writing my own API Wrapper for Icinga2 and have a problem.


    I want to query the API to know when a service has a critical state, and is either Acknowledged or in a Downtime.

    I tried doing it like this: service.state == ServiceCRITICAL && (service.downtime_depth != 0.0 || service.acknowledgement != 0.0) but that doesn't work.

    Can someone show me an example of how it is done correctly ?

    Linux is dead, long live Linux


    Remember to NEVER EVER use git repositories in a productive environment if you CAN NOT control them

  • Hello Kevin,


    this works for me


    Code
    1. curl -k -s -u icingaweb2:supersecret -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -X POST 'https://localhost:5665/v1/objects/services' -d '{ "filter": "service.state==2.0 && ( service.acknowledgement>0.0 || service.downtime_depth > 0.0)" }' | python -m json.tool