I try to filter services by the hostname - but I do not get it…
curl -k -s -u api:api -X GET -H 'Accept: application/json' 'https://localhost:5665/v1/objects/services' -d '{ "attrs": ["host_name"] }'
I have services of host Ch1 - they show up if if query ALL services without a filter.
...
{
"attrs": {
"host_name": "Ch1"
},
"joins": {},
"meta": {},
"name": "Ch1!load",
"type": "Service"
},
{
"attrs": {
"host_name": "Ch1"
},
"joins": {},
"meta": {},
"name": "Ch1!ssh",
"type": "Service"
}
...
But I do not get them if I try to query them.
curl -k -s -u api:api -H 'Accept: application/json' 'https://localhost:5665/v1/objects/services' -d '{ "filter": "service.host_name==Ch1"}'
Also tried by URL-parameters.
curl -k -s -u api:api -H 'Accept: application/json' 'https://localhost:5665/v1/objects/services?filter=service.host_name==Ch1'| jq
Result is in both cases HTTP-404/No objects found.
Any idea what I am doing wrong? Thanks!
Icinga 2.12.3 on Debian 11