Director API filters like in Icinga2 API

Hi all,

using the Icinga API I can query hosts/services using filters in the body such as:

“filter”: “match("myservice*",service.display_name)&&match("myserver*",host.name)”

Looking at the docs for the Director API, it doesn’t look like filters are implemented. I would like to get a list of hosts matching a pattern (i.e. myserver* → myserver1, myserver2, …). I’m using PHP curl on a Windows webserver.

Are there plans to implement filters or is there another way for me to get the host names out of the Director?

Regards
Susanne

you can use the url parameter q to filter on the hosts

curl -H 'Accept: application/json' \
 -u 'username:password' \
     'https://icinga.example.com/icingaweb2/director/hosts?q=mail'

and services

curl -H 'Accept: application/json' \
 -u 'username:password' \
     'https://icinga.example.com/icingaweb2/director/services?q=mail'
1 Like