Open alloran opened 6 years ago
Hi Yevgeniy,
Try to troubleshoot your problem https://github.com/monitoringartist/zabbix-docker-monitoring#troubleshooting - you will see more details in the zabbix agent log file. There will be full Docker API response.
28219:20180328:153917.512 Docker's socket query: GET /containers/3f211afa76aa/json HTTP/1.0
28219:20180328:153917.513 Docker's socket response: { edited }
28219:20180328:153917.514 Item [State] found in the received JSON object
28219:20180328:153917.514 Array item: Status
28219:20180328:153917.514 Item [State][Health][Status] found in the received JSON object:
28219:20180328:153917.514 zbx_module_docker_inspect_exec OK:
28219:20180328:153917.514 Sending back []
It seems like docker.inspect metric expects 4th parameter (from docs: par3 - optional name of 3rd level JSON property or selector of item in the JSON array) only as json array item selector, not json property
docker api output:
{
"Id": "3f211afa76aa606f5e013329ccf3dd0347e7b76214e7ad3c192ec4c5ccdac499",
"Created": "2018-03-28T04:42:03.806546139Z",
"Path": "node",
"Args": [
"./bin/www"
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 1,
"Error": "",
"StartedAt": "2018-03-28T09:37:00.086091983Z",
"FinishedAt": "2018-03-28T09:38:00.197739443Z",
"Health": {
"Status": "unhealthy",
"FailingStreak": 0,
"Log": [
{
"Start": "2018-03-28T10:43:04.805430365+06:00",
"End": "2018-03-28T10:43:05.200160407+06:00",
"ExitCode": 137,
"Output": "c"
},
{
"Start": "2018-03-28T10:52:45.934850275+06:00",
"End": "2018-03-28T10:52:46.063728468+06:00",
"ExitCode": 137,
"Output": ""
},
{
"Start": "2018-03-28T11:16:38.505969494+06:00",
"End": "2018-03-28T11:16:38.611610528+06:00",
"ExitCode": 137,
"Output": "cur"
},
{
"Start": "2018-03-28T15:38:00.086922197+06:00",
"End": "2018-03-28T15:38:00.191713371+06:00",
"ExitCode": 137,
"Output": "curl"
}
]
}
},
< edited >
}
2nd level property works as expected
$ zabbix_get -s 127.0.0.1 -p 10050 -k 'docker.inspect[/3f211afa76aa,State,StartedAt]'
2018-03-28T09:37:00.086091983Z
You are right. 3rd parameter needs improvement:
$ zabbix_get -s 127.0.0.1 -k docker.inspect[/988f5698cb4d,GraphDriver,Data,DeviceId]
<nothing here :( >
Also 4rd parameter can be usefull, e.g.:
$ zabbix_get -s 127.0.0.1 -k docker.inspect[/988f5698cb4d,NetworkSettings,Networks,bridge,IPAddress]
<nothing here :( >
Feel free to create PR.
Hi,I also encountered this problem.
Hi!
I try to use docker.inspect metric to get container health status, but it returns empty string if required value is json property, not json array item.
Accroding to docs it should return
unhealthy