Skip to content

docker.inspect return empty value for 3rd level JSON property #92

@alloran

Description

@alloran

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.

$ zabbix_get -s 127.0.0.1 -p 10050 -k 'docker.inspect[/3f211afa76aa,Config,Env,NODE_ENV=]'
development
$ zabbix_get -s 127.0.0.1 -p 10050 -k 'docker.inspect[/3f211afa76aa,State,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":""}]}
$ zabbix_get -s 127.0.0.1 -p 10050 -k 'docker.inspect[/3f211afa76aa,State,Health,Status]'
< \n here >

Accroding to docs it should return unhealthy

$ docker info 
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 64
Server Version: 17.12.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 89623f28b87a6004d4b785663257362d1658a729
runc version: b2567b37d7b75eb4cf325b77297b140ea686ce8f
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-36-generic
Operating System: Ubuntu 16.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.47GiB
Name: c6963sa
ID: VAJQ:VCHN:PKFK:U5UP:VTLR:L2J4:RR67:XDN7:QL46:UY5S:JNM6:6QCW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
HTTP Proxy: http://127.0.0.1:3128/
Username: alloran
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions