Hello Icinga Community
I am totally stuck at the moment with the director import source for REST APIs.
Sadly there is no documentation about this import source and due I don’t know php, I don’t totally get the source code.
The API I am querying, provides some a JSON like this one (it’s a bit redacted):
{
"took": 224,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1418,
"relation": "eq"
},
"max_score": 1.0,
"hits": [
{
"_index": "some_index_name",
"_type": "_doc",
"_id": "some_id",
"_score": 1.0,
"_source": {
"hostname": "my-unique-host",
"ipv6_address": null,
"ip_address": "1.2.3.4",
"location": null
......
}
},
{
"_index": "some_index_name",
"_type": "_doc",
"_id": "some_id",
"_score": 1.0,
"_source": {
"hostname": "my-unique-host",
"ipv6_address": null,
"ip_address": "123.123.123.123",
"location": null
......
}
}
]
}
}
Now I’ trying to get the the data like this into Icinga:
The query seems to work, because checking for changes works and import run also works:
But on the tab Preview no data are displayed:
I also tried to test other values in “Key column name”, like “_source.hostname” or just “_source”. Doesn’t work and also seems wrong to me. And for “Extract property” I also tried “hits.hits._source” but than I got an error:
Does anyone have any idea what I am doing wrong here?
My Versions:
- Director version (System - About): 1.10.2
- Icinga Web 2 version and modules (System - About): 1.10.2
- Icinga 2 version (
icinga2 --version
): r2.14.0-1 - Operating System and version: Ubuntu 22.04.2 LTS
- Webserver, PHP versions: PHP 8.1