Hi,
I am trying to manually run a check on agents and read the output.
I was able to execute the command on the agent but how can I see the return value and output?
[root@icinga2 ~]# curl -k -s -S -i -u root:icinga -H 'Accept: application/json' -X POST 'https://localhost:5665/v1/actions/execute-command?pretty=1' -d '{"host":"test02","ttl":15,"endpoint":"test02","command_type":"CheckCommand","command":"icinga"}'
HTTP/1.1 202 Accepted
Server: Icinga/r2.13.7-1
Content-Type: application/json
Content-Length: 208
{
"results": [
{
"checkable": "test02",
"code": 202,
"execution": "c2cc992d-5c15-4b9e-b5cd-ff315998cfe8",
"status": "Accepted"
}
]
}
The documentation sais, that the execution can be queried, so I did this:
[root@icinga2 ~]# curl -k -s -S -i -u root:icinga 'https://localhost:5665/v1/objects/hosts/test02?pretty=1' | grep -A 5 executions
"executions": {
"c2cc992d-5c15-4b9e-b5cd-ff315998cfe8": {
"deadline": 1678883958.22948,
"pending": true
}
},
And after some time it just looks like this:
[root@icinga2 ~]# curl -k -s -S -i -u root:icinga 'https://localhost:5665/v1/objects/hosts/mv-test02?pretty=1' | grep executions
"executions": {},
So, how can I get the output of the check-command?