Code Monkey home page Code Monkey logo

monitoringartist / zabbix-docker-monitoring Goto Github PK

View Code? Open in Web Editor NEW
1.2K 86.0 265.0 6.85 MB

:whale: Docker/Kubernetes/Mesos/Marathon/Chronos/LXC/LXD/Swarm container monitoring - Docker image, Zabbix template and C module

Home Page: https://hub.docker.com/r/monitoringartist/zabbix-agent-xxl-limited/

License: GNU General Public License v2.0

Makefile 0.15% C 91.15% Shell 1.77% Dockerfile 6.92%
docker zabbix monitoring devops zabbix-templates zabbix-agentd zabbix-docker monitoring-artist

zabbix-docker-monitoring's Introduction

Managed by Monitoring Artist: DevOps / Docker / Kubernetes / AWS ECS / Zabbix / Zenoss / Terraform / Monitoring

Zabbix Docker Monitoring Build binaries Gitpod ready-to-code

Overview of Monitoring Artist (dockerized) monitoring ecosystem:


Monitoring of Docker container by using Zabbix. Available CPU, mem, blkio, net container metrics and some containers config details, e.g. IP, name, ... Zabbix Docker module has native support for Docker containers (Systemd included) and should also support a few other container types (e.g. LXC) out of the box. Please feel free to test and provide feedback/open issue. The module is focused on performance, see section Module vs. UserParameter script.

Module is available also as a part of different GitHub project - Docker image dockbix-agent-xxl-limited (OS Linux host metrics and other selected metrics are supported as well). Quickstart:

Dockbix Agent XXL Docker container

docker run \
  --name=dockbix-agent-xxl \
  --net=host \
  --privileged \
  -v /:/rootfs \
  -v /var/run:/var/run \
  --restart unless-stopped \
  -e "ZA_Server=<ZABBIX SERVER IP/DNS NAME/IP RANGE>" \
  -e "ZA_ServerActive=<ZABBIX SERVER IP/DNS NAME>" \
  -d monitoringartist/dockbix-agent-xxl-limited:latest

For more information, visit Dockbix agent XXL with Docker monitoring support.

Please donate to the author, so he can continue to publish other awesome projects for free:

Paypal donate button

Installation

Available templates:

You can use Docker image monitoringartist/zabbix-templates for import of Zabbix-Template-App-Docker.xml template. For example:

docker run --rm \
  -e XXL_apiurl=http://zabbix.org/zabbix \
  -e XXL_apiuser=Admin \
  -e XXL_apipass=zabbix \
  monitoringartist/zabbix-templates

Download latest build of zabbix_module_docker.so for Zabbix 6.0/5.4/5.0/4.0 agents:

OS Zabbix 6.0 Zabbix 5.4 Zabbix 5.0 Zabbix 4.0
Amazon Linux 2 Download Download Download Download
Amazon Linux 1 Download Download Download Download
CentOS 7 Download Download Download Download
Debian 11 Download Download Download Download
Debian 10 Download Download Download Download
Debian 9 Download Download Download Download
Fedora 35 Download Download Download Download
Fedora 34 Download Download Download Download
Fedora 33 Download Download Download Download
openSUSE 15 Download Download Download Download
openSUSE 42 Download Download Download Download
RHEL 7 Download Download Download Download
Ubuntu 20 Download Download Download Download
Ubuntu 18 Download Download Download Download
Ubuntu 16 Download Download Download Download
Ubuntu 14 Download Download Download Download

If the provided build doesn't work on your system, please see section Compilation. You can check folder dockerfiles, where Dockerfiles for different OS/Zabbix versions can be customised.

Grafana dashboard

Custom Grafana dashboard for Docker monitoring with used Zabbix Docker (Mesos, Marathon/Chronos) templates are available in Grafana Zabbix dashboards repo.

Grafana dashboard Overview Docker

Available metrics

Note: cid - container ID, two options are available:

  • full container ID (macro {#FCONTAINERID}), e.g. 2599a1d88f75ea2de7283cbf469ea00f0e5d42aaace95f90ffff615c16e8fade
  • human name or short container ID (macros {#HCONTAINERID} or {#SCONTAINERID}) - prefix "/" must be used, e.g. /zabbix-server or /2599a1d88f75
Key Description
docker.discovery[<par1>,<par2>,<par3>] LLD container discovering:
Only running containers are discovered.
Additional Docker permissions are needed when you want to see container name (human name) in metrics/graphs instead of short container ID. Optional parameters are used for definition of HCONTAINERID - docker.inspect function will be used in this case.
For example:
docker.discovery[Config,Env,MESOS_TASK_ID=] is recommended for Mesos/Chronos/Marathon container monitoring
Note 1: docker.discovery is faster version of docker.discovery[Name]
Note 2: Available macros:
{#FCONTAINERID} - full container ID (64 character string)
{#SCONTAINERID} - short container ID (12 character string)
{#HCONTAINERID} - human name of container
{#SYSTEM.HOSTNAME} - system hostname
docker.port.discovery[cid,<protocol>] LLD published container port dicovering:
protocol - port protocol, which should be discovered, default value all, available protocols: tcp,udp
docker.mem[cid,mmetric] Memory metrics:
mmetric - any available memory metric in the pseudo-file memory.stat, e.g.: cache, rss, mapped_file, pgpgin, pgpgout, swap, pgfault, pgmajfault, inactive_anon, active_anon, inactive_file, active_file, unevictable, hierarchical_memory_limit, hierarchical_memsw_limit, total_cache, total_rss, total_mapped_file, total_pgpgin, total_pgpgout, total_swap, total_pgfault, total_pgmajfault, total_inactive_anon, total_active_anon, total_inactive_file, total_active_file, total_unevictable, Note: if you have a problem with memory metrics, be sure that memory cgroup subsystem is enabled - kernel parameter: cgroup_enable=memory
docker.cpu[cid,cmetric] CPU metrics:
cmetric - any available CPU metric in the pseudo-file cpuacct.stat/cpu.stat, e.g.: system, user, total (current sum of system/user or container throttling metrics: nr_throttled, throttled_time
Note: CPU user/system/total metrics must be recalculated to % utilization value by Zabbix - Delta (speed per second).
docker.dev[cid,bfile,bmetric] Blk IO metrics:
bfile - container blkio pseudo-file, e.g.: blkio.io_merged, blkio.io_queued, blkio.io_service_bytes, blkio.io_serviced, blkio.io_service_time, blkio.io_wait_time, blkio.sectors, blkio.time, blkio.avg_queue_size, blkio.idle_time, blkio.dequeue, ...
bmetric - any available blkio metric in selected pseudo-file, e.g.: Total. Option for selected block device only is also available e.g. '8:0 Sync' (quotes must be used in key parameter in this case)
Note: Some pseudo blkio files are available only if kernel config CONFIG_DEBUG_BLK_CGROUP=y, see recommended docs.
docker.inspect[cid,par1,<par2>,<par3>] Docker inspection:
Requested value from Docker inspect JSON object (e.g. API v1.21) is returned.
par1 - name of 1st level JSON property
par2 - optional name of 2nd level JSON property
par3 - optional name of 3rd level JSON property or selector of item in the JSON array
For example:
docker.inspect[cid,Config,Image], docker.inspect[cid,NetworkSettings,IPAddress], docker.inspect[cid,Config,Env,MESOS_TASK_ID=], docker.inspect[cid,State,StartedAt], docker.inspect[cid,Name]
Note 1: Requested value must be plain text/numeric value. JSON objects and booleans are not supported.
Note 2: Additional Docker permissions are needed.
Note 3: If you use selector for selecting value in array, then selector string is removed from returned value.
docker.info[info] Docker information:
Requested value from Docker info JSON object (e.g. API v1.21) is returned.
info - name of requested information, e.g. Containers, Images, NCPU, ...
Note: Additional Docker permissions are needed.
docker.stats[cid,par1,<par2>,<par3>] Docker container resource usage statistics:
Docker version 1.5+ is required
Requested value from Docker stats JSON object (e.g. API v1.21) is returned.
par1 - name of 1st level JSON property
par2 - optional name of 2nd level JSON property
par3 - optional name of 3rd level JSON property
For example:
docker.stats[cid,memory_stats,usage], docker.stats[cid,network,rx_bytes], docker.stats[cid,cpu_stats,cpu_usage,total_usage]
Note 1: Requested value must be plain text/numeric value. JSON objects/arrays are not supported.
Note 2: Additional Docker permissions are needed.
Note 3: The most accurate way to get Docker container stats, but it's also the slowest (0.3-0.7s), because data are readed from on demand container stats stream.
docker.cstatus[status] Count of Docker containers in defined status:
status - container status, available statuses:
All - count of all containers
Up - count of running containers (Paused included)
Exited - count of exited containers
Crashed - count of crashed containers (exit code != 0)
Paused - count of paused containers
Note: Additional Docker permissions are needed.
docker.istatus[status] Count of Docker images in defined status:
status - image status, available statuses:
All - all images
Dangling - count of dangling images
Note: Additional Docker permissions are needed.
docker.vstatus[status] Count of Docker volumes in defined status:
status - volume status, available statuses:
All - all volumes
Dangling - count of dangling volumes
Note 1: Additional Docker permissions are needed.
Note2: Docker API v1.21+ is required
docker.up[cid] Running state check:
1 if container is running, otherwise 0
docker.modver Version of the loaded docker module
docker.xnet[cid,interface,nmetric] Network metrics (experimental):
interface - name of interface, e.g. eth0, if name is all, then sum of selected metric across all interfaces is returned (lo included)
nmetric - any available network metric name from output of command netstat -i:
MTU, Met, RX-OK, RX-ERR, RX-DRP, RX-OVR, TX-OK, TX-ERR, TX-DRP, TX-OVR
For example:
docker.xnet[cid,eth0,TX-OK]
docker.xnet[cid,all,RX-ERR]

Note 1: Root permissions (AllowRoot=1) are required, because net namespaces (/var/run/netns/) are created/used
Note 2: netstat is needed to be installed and available in PATH

Container log monitoring

Standard Zabbix log monitoring can be used. Keep in mind, that Zabbix agent must support active mode for log monitoring. Stdout/stderr Docker container console output is logged by Docker into file /var/lib/docker/containers/<fid>/<fid>-json.log (fid - full container ID = macro {#FCONTAINERID}). If the application in container is not able to log to stdout/stderr, link log file to stdout/stderr. For example:

ln -sf /dev/stdout /var/log/nginx/access.log
ln -sf /dev/stderr /var/log/nginx/error.log

Example of -json log file:

{"log":"2015-07-03 00:15:05,870 DEBG fd 13 closed, stopped monitoring \u003cPOutputDispatcher at 37974528 for \u003cSubprocess at 37493936 with name php-fpm in state STARTING\u003e (stdout)\u003e\n","stream":"stdout","time":"2015-07-03T00:15:05.871956756Z"}
{"log":"2015-07-03 00:15:05,873 DEBG fd 17 closed, stopped monitoring \u003cPOutputDispatcher at 37974240 for \u003cSubprocess at 37493936 with name php-fpm in state STARTING\u003e (stderr)\u003e\n","stream":"stdout","time":"2015-07-03T00:15:05.875886957Z"}
{"log":"2015-07-03 00:15:06,878 INFO success: nginx entered RUNNING state, process has stayed up for \u003e than 1 seconds (startsecs)\n","stream":"stdout","time":"2015-07-03T00:15:06.882435459Z"}
{"log":"2015-07-03 00:15:06,879 INFO success: nginx-reload entered RUNNING state, process has stayed up for \u003e than 1 seconds (startsecs)\n","stream":"stdout","time":"2015-07-03T00:15:06.882548486Z"}

Recommended Zabbix log key for this case:

log[/var/lib/docker/containers/<fid>/<fid>-json.log,"\"log\":\"(.*)\",\"stream",,,skip,\1]

You can utilize Zabbix LLD for automatic Docker container log monitoring. In this case it'll be:

log[/var/lib/docker/containers/{#FCONTAINERID}/{#FCONTAINERID}-json.log,"\"log\":\"(.*)\",\"stream",,,skip,\1]

Images

Docker container CPU graph in Zabbix: Docker container CPU graph in Zabbix Docker container memory graph in Zabbix: Docker container memory graph in Zabbix Docker container state graph in Zabbix: Docker container state graph in Zabbix

Additional Docker permissions

You have two options, how to get additional Docker permissions:

  • Add zabbix user to docker group (recommended option):
usermod -aG docker zabbix

Or

  • Edit zabbix_agentd.conf and set AllowRoot (Zabbix agent with root permissions):
AllowRoot=1

Note: If you use Docker from RHEL/Centos repositories, then you have to use AllowRoot=1 option.

SELinux

If you are on a system that has SELinux in enforcing-mode (check with getenforce), you can make it work with this SELinux module. This module will persist reboots. Save it, then run:

wget https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/selinux/zabbix-docker.te
checkmodule -M -m -o zabbix-docker.mod zabbix-docker.te
semodule_package -o zabbix-docker.pp -m zabbix-docker.mod
semodule -i zabbix-docker.pp

Compilation

You have to compile the module if provided binary doesn't work on your system. Basic compilation steps (please use right Zabbix branch version):

# Required CentOS/RHEL apps:   yum install -y wget autoconf automake gcc git pcre-devel jansson-devel
# Required Debian/Ubuntu apps: apt-get install -y wget autoconf automake gcc git make pkg-config libpcre3-dev libjansson-dev
# Required Fedora apps:        dnf install -y wget autoconf automake gcc git make pcre-devel jansson-devel
# Required openSUSE apps:      zypper install -y wget autoconf automake gcc git make pkg-config pcre-devel libjansson-devel
# Required Gentoo apps 1:      emerge net-misc/wget sys-devel/autoconf sys-devel/automake sys-devel/gcc
# Required Gentoo apps 2:      emerge dev-vcs/git sys-devel/make dev-util/pkgconfig dev-libs/libpcre dev-libs/jansson
# Source, use your version:    git clone -b 4.2.2 --depth 1 https://github.com/zabbix/zabbix.git /usr/src/zabbix
cd /usr/src/zabbix
./bootstrap.sh
./configure --enable-agent
mkdir src/modules/zabbix_module_docker
cd src/modules/zabbix_module_docker
wget https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/src/modules/zabbix_module_docker/zabbix_module_docker.c
wget https://raw.githubusercontent.com/monitoringartist/zabbix-docker-monitoring/master/src/modules/zabbix_module_docker/Makefile
make

The output will be the binary file (dynamically linked shared object library) zabbix_module_docker.so, which can be loaded by Zabbix agent.

You can also use Docker for compilation. Example of Dockerfiles, which have been prepared for module compilation - https://github.com/monitoringartist/zabbix-docker-monitoring/tree/master/dockerfiles

Troubleshooting

Edit your zabbix_agentd.conf and set DebugLevel:

DebugLevel=4

Module debugs messages will be available in standard zabbix_agentd.log.

Issues and feature requests

Please use Github issue tracker.

Module vs. UserParameter script

The module is ~10x quicker because it's compiled the binary code. I've used my project Zabbix agent stress test for performance tests.

Part of config in zabbix_agentd.conf:

UserParameter=xdocker.cpu[*],grep $2 /cgroup/cpuacct/docker/$1/cpuacct.stat | awk '{print $$2}'
LoadModule=zabbix_module_docker.so

Tests:

[root@dev zabbix-agent-stress-test]# ./zabbix-agent-stress-test.py -s 127.0.0.1 -k "xdocker.cpu[d5bf68ec1fb570d8ac3047226397edd8618eed14278ce035c98fbceef02d7730,system]" -t 20
Warning: you are starting more threads, than your system has available CPU cores (4)!
Starting 20 threads, host: 127.0.0.1:10050, key: xdocker.cpu[d5bf68ec1fb570d8ac3047226397edd8618eed14278ce035c98fbceef02d7730,system]
Success: 291    Errors: 0       Avg speed: 279.68 qps   Execution time: 1.00 sec
Success: 548    Errors: 0       Avg speed: 349.04 qps   Execution time: 2.00 sec
Success: 803    Errors: 0       Avg speed: 282.72 qps   Execution time: 3.00 sec
Success: 1060   Errors: 0       Avg speed: 209.31 qps   Execution time: 4.00 sec
Success: 1310   Errors: 0       Avg speed: 187.14 qps   Execution time: 5.00 sec
Success: 1570   Errors: 0       Avg speed: 178.80 qps   Execution time: 6.01 sec
Success: 1838   Errors: 0       Avg speed: 189.36 qps   Execution time: 7.01 sec
Success: 2106   Errors: 0       Avg speed: 225.68 qps   Execution time: 8.01 sec
Success: 2382   Errors: 0       Avg speed: 344.51 qps   Execution time: 9.01 sec
Success: 2638   Errors: 0       Avg speed: 327.88 qps   Execution time: 10.01 sec
Success: 2905   Errors: 0       Avg speed: 349.93 qps   Execution time: 11.01 sec
Success: 3181   Errors: 0       Avg speed: 352.23 qps   Execution time: 12.01 sec
Success: 3450   Errors: 0       Avg speed: 239.38 qps   Execution time: 13.01 sec
Success: 3678   Errors: 0       Avg speed: 209.88 qps   Execution time: 14.02 sec
Success: 3923   Errors: 0       Avg speed: 180.30 qps   Execution time: 15.02 sec
Success: 4178   Errors: 0       Avg speed: 201.58 qps   Execution time: 16.02 sec
Success: 4434   Errors: 0       Avg speed: 191.92 qps   Execution time: 17.02 sec
Success: 4696   Errors: 0       Avg speed: 332.06 qps   Execution time: 18.02 sec
Success: 4968   Errors: 0       Avg speed: 325.55 qps   Execution time: 19.02 sec
Success: 5237   Errors: 0       Avg speed: 325.61 qps   Execution time: 20.02 sec
^C
Success: 5358   Errors: 0       Avg rate: 192.56 qps    Execution time: 20.53 sec
Avg rate based on total execution time and success connections: 261.02 qps

[root@dev zabbix-agent-stress-test]# ./zabbix-agent-stress-test.py -s 127.0.0.1 -k "docker.cpu[d5bf68ec1fb570d8ac3047226397edd8618eed14278ce035c98fbceef02d7730,system]" -t 20
Warning: you are starting more threads, than your system has available CPU cores (4)!
Starting 20 threads, host: 127.0.0.1:10050, key: docker.cpu[d5bf68ec1fb570d8ac3047226397edd8618eed14278ce035c98fbceef02d7730,system]
Success: 2828   Errors: 0       Avg speed: 2943.98 qps  Execution time: 1.00 sec
Success: 5095   Errors: 0       Avg speed: 1975.77 qps  Execution time: 2.01 sec
Success: 7623   Errors: 0       Avg speed: 2574.55 qps  Execution time: 3.01 sec
Success: 10098  Errors: 0       Avg speed: 4720.20 qps  Execution time: 4.02 sec
Success: 12566  Errors: 0       Avg speed: 3423.56 qps  Execution time: 5.02 sec
Success: 14706  Errors: 0       Avg speed: 2397.01 qps  Execution time: 6.03 sec
Success: 17128  Errors: 0       Avg speed: 903.63 qps   Execution time: 7.05 sec
Success: 19520  Errors: 0       Avg speed: 2663.53 qps  Execution time: 8.05 sec
Success: 21899  Errors: 0       Avg speed: 1516.36 qps  Execution time: 9.07 sec
Success: 24219  Errors: 0       Avg speed: 3570.47 qps  Execution time: 10.07 sec
Success: 26676  Errors: 0       Avg speed: 1204.58 qps  Execution time: 11.08 sec
Success: 29162  Errors: 0       Avg speed: 2719.87 qps  Execution time: 12.08 sec
Success: 31671  Errors: 0       Avg speed: 2265.67 qps  Execution time: 13.08 sec
Success: 34186  Errors: 0       Avg speed: 3490.64 qps  Execution time: 14.08 sec
Success: 36749  Errors: 0       Avg speed: 2094.59 qps  Execution time: 15.09 sec
Success: 39047  Errors: 0       Avg speed: 3213.35 qps  Execution time: 16.09 sec
Success: 41361  Errors: 0       Avg speed: 3171.67 qps  Execution time: 17.09 sec
Success: 43739  Errors: 0       Avg speed: 3946.53 qps  Execution time: 18.09 sec
Success: 46100  Errors: 0       Avg speed: 1308.88 qps  Execution time: 19.09 sec
Success: 48556  Errors: 0       Avg speed: 2663.52 qps  Execution time: 20.09 sec
^C
Success: 49684  Errors: 0       Avg rate: 2673.85 qps   Execution time: 20.52 sec
Avg rate based on total execution time and success connections: 2420.70 qps

Results of 20s stress test:

StartAgent value Module qps UserParameter script qps
3 2420.70 261.02
10 2612.20 332.62
20 2487.93 348.52

Discovery test:

Part of config in zabbix_agentd.conf:

UserParameter=xdocker.discovery,/etc/zabbix/scripts/container_discover.sh
LoadModule=zabbix_module_docker.so

Shell implementation container_discover.sh:

Test with 237 running containers:

[root@dev ~]# docker info
Containers: 237
Images: 121
Storage Driver: btrfs
Execution Driver: native-0.2
Kernel Version: 3.10.0-229.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.1 (Maipo)
CPUs: 10
Total Memory: 62.76 GiB
Name: dev.local
ID: AOAM:BO3G:5MCE:5FMM:IWKP:NPM4:PRKV:ZZ34:BYFL:XGAV:SRNJ:LKDH
Username: username
Registry: [https://index.docker.io/v1/]
[root@dev ~]# time zabbix_get -s 127.0.0.1 -k docker.discovery > /dev/null

real    0m0.112s
user    0m0.000s
sys     0m0.003s
[root@dev ~]# time zabbix_get -s 127.0.0.1 -k xdocker.discovery > /dev/null

real    0m5.856s
user    0m0.000s
sys     0m0.002s
[root@dev ~]# ./zabbix-agent-stress-test.py -s 127.0.0.1 -k xdocker.discovery
Starting 1 threads, host: 127.0.0.1:10050, key: xdocker.discovery
Success: 0      Errors: 0       Avg rate: 0.00 qps      Execution time: 1.00 sec
Success: 0      Errors: 0       Avg rate: 0.00 qps      Execution time: 2.00 sec
Success: 0      Errors: 0       Avg rate: 0.00 qps      Execution time: 3.02 sec
Success: 0      Errors: 0       Avg rate: 0.00 qps      Execution time: 4.02 sec
Success: 0      Errors: 0       Avg rate: 0.00 qps      Execution time: 5.02 sec
Success: 1      Errors: 0       Avg rate: 0.10 qps      Execution time: 6.02 sec
Success: 1      Errors: 0       Avg rate: 0.10 qps      Execution time: 7.02 sec
Success: 1      Errors: 0       Avg rate: 0.10 qps      Execution time: 8.02 sec
Success: 1      Errors: 0       Avg rate: 0.10 qps      Execution time: 9.02 sec
Success: 1      Errors: 0       Avg rate: 0.10 qps      Execution time: 10.02 sec
Success: 2      Errors: 0       Avg rate: 0.14 qps      Execution time: 11.02 sec
Success: 2      Errors: 0       Avg rate: 0.14 qps      Execution time: 12.03 sec
Success: 2      Errors: 0       Avg rate: 0.14 qps      Execution time: 13.03 sec
Success: 2      Errors: 0       Avg rate: 0.14 qps      Execution time: 14.03 sec
Success: 2      Errors: 0       Avg rate: 0.14 qps      Execution time: 15.03 sec
Success: 3      Errors: 0       Avg rate: 0.16 qps      Execution time: 16.03 sec
Success: 3      Errors: 0       Avg rate: 0.16 qps      Execution time: 17.03 sec
Success: 3      Errors: 0       Avg rate: 0.16 qps      Execution time: 18.03 sec
Success: 3      Errors: 0       Avg rate: 0.16 qps      Execution time: 19.03 sec
Success: 3      Errors: 0       Avg rate: 0.16 qps      Execution time: 20.03 sec
Success: 3      Errors: 0       Avg rate: 0.16 qps      Execution time: 21.04 sec
Success: 4      Errors: 0       Avg rate: 0.17 qps      Execution time: 22.04 sec
Success: 4      Errors: 0       Avg rate: 0.17 qps      Execution time: 23.04 sec
Success: 4      Errors: 0       Avg rate: 0.17 qps      Execution time: 24.04 sec
Success: 4      Errors: 0       Avg rate: 0.17 qps      Execution time: 25.05 sec
Success: 5      Errors: 0       Avg rate: 0.20 qps      Execution time: 26.05 sec
Success: 5      Errors: 0       Avg rate: 0.20 qps      Execution time: 27.05 sec
Success: 5      Errors: 0       Avg rate: 0.20 qps      Execution time: 28.05 sec
Success: 5      Errors: 0       Avg rate: 0.20 qps      Execution time: 29.05 sec
Success: 5      Errors: 0       Avg rate: 0.20 qps      Execution time: 30.05 sec
Success: 5      Errors: 0       Avg rate: 0.20 qps      Execution time: 31.05 sec
^C
Success: 5      Errors: 0       Avg rate: 0.20 qps      Execution time: 31.35 sec
Avg rate based on total execution time and success connections: 0.16 qps
[root@dev ~]# ./zabbix-agent-stress-test.py -s 127.0.0.1 -k docker.discovery
Starting 1 threads, host: 127.0.0.1:10050, key: docker.discovery
Success: 5      Errors: 0       Avg rate: 6.26 qps      Execution time: 1.00 sec
Success: 5      Errors: 0       Avg rate: 6.26 qps      Execution time: 2.00 sec
Success: 12     Errors: 0       Avg rate: 7.45 qps      Execution time: 3.00 sec
Success: 20     Errors: 0       Avg rate: 6.77 qps      Execution time: 4.00 sec
Success: 28     Errors: 0       Avg rate: 7.82 qps      Execution time: 5.00 sec
Success: 36     Errors: 0       Avg rate: 7.21 qps      Execution time: 6.01 sec
Success: 43     Errors: 0       Avg rate: 10.22 qps     Execution time: 7.01 sec
Success: 43     Errors: 0       Avg rate: 10.22 qps     Execution time: 8.01 sec
Success: 50     Errors: 0       Avg rate: 6.79 qps      Execution time: 9.01 sec
Success: 57     Errors: 0       Avg rate: 6.11 qps      Execution time: 10.01 sec
Success: 66     Errors: 0       Avg rate: 8.50 qps      Execution time: 11.01 sec
Success: 73     Errors: 0       Avg rate: 6.51 qps      Execution time: 12.01 sec
Success: 81     Errors: 0       Avg rate: 7.18 qps      Execution time: 13.01 sec
Success: 82     Errors: 0       Avg rate: 7.85 qps      Execution time: 14.01 sec
Success: 87     Errors: 0       Avg rate: 6.54 qps      Execution time: 15.02 sec
Success: 95     Errors: 0       Avg rate: 7.84 qps      Execution time: 16.02 sec
Success: 103    Errors: 0       Avg rate: 9.24 qps      Execution time: 17.02 sec
Success: 111    Errors: 0       Avg rate: 9.94 qps      Execution time: 18.02 sec
Success: 119    Errors: 0       Avg rate: 7.63 qps      Execution time: 19.02 sec
Success: 120    Errors: 0       Avg rate: 6.70 qps      Execution time: 20.12 sec
Success: 121    Errors: 0       Avg rate: 3.61 qps      Execution time: 21.12 sec
Success: 128    Errors: 0       Avg rate: 8.46 qps      Execution time: 22.12 sec
Success: 136    Errors: 0       Avg rate: 7.63 qps      Execution time: 23.12 sec
Success: 144    Errors: 0       Avg rate: 6.21 qps      Execution time: 24.12 sec
Success: 150    Errors: 0       Avg rate: 6.89 qps      Execution time: 25.12 sec
Success: 157    Errors: 0       Avg rate: 10.87 qps     Execution time: 26.18 sec
Success: 160    Errors: 0       Avg rate: 7.52 qps      Execution time: 27.18 sec
Success: 168    Errors: 0       Avg rate: 9.81 qps      Execution time: 28.18 sec
Success: 174    Errors: 0       Avg rate: 6.69 qps      Execution time: 29.18 sec
Success: 181    Errors: 0       Avg rate: 6.35 qps      Execution time: 30.18 sec
Success: 188    Errors: 0       Avg rate: 7.64 qps      Execution time: 31.19 sec
^C
Success: 193    Errors: 0       Avg rate: 8.83 qps      Execution time: 31.79 sec
Avg rate based on total execution time and success connections: 6.07 qps

How it works

See https://blog.docker.com/2013/10/gathering-lxc-docker-containers-metrics/ Metrics for containers are read from cgroup file system. Docker API is used for discovering and some keys. However root or docker permissions are required for communication with Docker via unix socket. You can test API also in your command line:

echo -e "GET /containers/json?all=0 HTTP/1.0\r\n" | nc -U /var/run/docker.sock
# or if you have curl 7.40+
curl --unix-socket /var/run/docker.sock --no-buffer -XGET v1.24/containers/json?all=0

Recommended docs

Built-in Zabbix Docker monitoring

Keep in mind that Zabbix itself supports Docker monitoring. It is available only for agent2 - see Zabbix agent2 doc.

Contributors

Thank you to all project contributors.

Author

Devops Monitoring Expert, who loves monitoring systems and cutting/bleeding edge technologies: Docker, Kubernetes, ECS, AWS, Google GCP, Terraform, Lambda, Zabbix, Grafana, Elasticsearch, Kibana, Prometheus, Sysdig,...

Summary:

Professional devops / monitoring / consulting services:

Monitoring Artist

zabbix-docker-monitoring's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zabbix-docker-monitoring's Issues

Timeout while executing operation.

Hello, I was using zabbix-docker-monitoring plugin. But I got an error:

 Get value from agent failed: ZBX_TCP_READ() timed out

when the zabbix_agent run for a while.

Could you give me some advice to solve it.

problem of "normalize CPU usage"

the code shows that it normalize CPU usage by using number of online CPUs
why not by calculating CpuShares/1024 or CpuQuota/100000 in docker inspect, thats the CPUs container use actually.

Use Docker labels as Zabbix item names

Hi,

I am setting up the monitoring for several AWS ECS clusters with around 200 Docker containers and I would love to use your module for it.

However at the moment I end up with a HCONTAINERID of for example ecs-PRELIVE-IntelligentSearchService-3-IntelligentSearchService-d2f28fb1a2be81b7e301 which is pretty long.
I understand, that this is the key and it is used for the lookups, but it would be awesome if one could utilize the labels of the container at least for the name of the Zabbix item. This would prevent my very long item names :)

Is this already possible?

Regards
hrzbrg

Error importing template xml

Hi,
I have zabbix 2.2.11 on ubuntu 14.04.
I have the following error When trying to import "Zabbix-Template-App-Docker.xml" :

XML file contains fatal error 41:Specification mandate value for attribute data-pjax-transient [ Line: 52 | Column: 40 ]

Any suggestion?
Thank you very much

Gianluca

How to AllowRoot in zabbix-agent-xxl?

I want to add an monitoring item docker.xnet[cid,interface,nmetric], but I don't know how to add AllowRoot=1 to zabbix-agent-xxl container config file, could you give me some suggests?

docker image doesn't run

Hi

i try to use your docker image monitoringartist/zabbix-agent-xxl-limited:latest
but it crashes with error

Zocker XXL v0.9.1b public limited version
Copyright (C) 2014-2016 Jan Garaj - www.monitoringartist.com
Freeware licence - Usage of this binary is restricted to oficial monitoringartist Docker images only.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x8 pc=0x4e77d7]

goroutine 1 [running]:
github.com/fsouza/go-dockerclient.(*Env).Map(0x0, 0x1b)
        /usr/lib/golang/src/github.com/fsouza/go-dockerclient/env.go:159 +0x27
github.com/fsouza/go-dockerclient.(*Env).Get(0x0, 0x7e07e0, 0x4, 0x0, 0x0)
        /usr/lib/golang/src/github.com/fsouza/go-dockerclient/env.go:20 +0x2f
main.main()
        /root/zabbix-agent-docker-commercial/zocker-xxl.go:50 +0xc27

goroutine 22 [select]:
net/http.(*persistConn).readLoop(0xc8200ca160)
        /usr/lib/golang/src/net/http/transport.go:976 +0xac7
created by net/http.(*Transport).dialConn
        /usr/lib/golang/src/net/http/transport.go:685 +0xc78

goroutine 23 [select]:
net/http.(*persistConn).writeLoop(0xc8200ca160)
        /usr/lib/golang/src/net/http/transport.go:1009 +0x40c
created by net/http.(*Transport).dialConn
        /usr/lib/golang/src/net/http/transport.go:686 +0xc9d

How to configure agent for mesos

Hi

According to doc i should use docker.discovery[Config,Env,MESOS_TASK_ID=] for mesos cluster.
seems it works for docker.up[/{#HCONTAINERID}] only

but it doesn't work for other items.
Agent prints error:
Cannot find the [Config][Env][MESOS_TASK_ID=] item in the received JSON object (selector - param3 doesn't match any value)

I use template from your git repo - https://github.com/monitoringartist/zabbix-docker-monitoring/blob/master/template/Zabbix-Template-App-Docker.xml

What is wrong with my settings?

Screenshots of Zabbix settigns

  1. discovery - https://www.dropbox.com/s/678o6c1yxywowks/zabbix_template_discovery.png
  2. items - https://www.dropbox.com/s/gsk8c5yerh87jt7/zabbix_template_items.png

Thanks,

Option to generate the discovered docker instances as new hosts

Hello

Could it be possible to have a template or a script to create the docker instances as new zabbix hosts.
So we don t lose their stats when they migrate to a new host, we can search for docker images in zabbix and that avoid to get a single host with a ton of stats.

Docker containers AND systemd units monitoring

For some reason I can see on my RHEL 7 host the following paths available:

/sys/fs/cgroup/cpuset/docker/$CONTAINER_ID
/sys/fs/cgroup/blkio/docker/$CONTAINER_ID
/sys/fs/cgroup/perf_event/docker/$CONTAINER_ID
/sys/fs/cgroup/devices/docker/$CONTAINER_ID
/sys/fs/cgroup/hugetlb/docker/$CONTAINER_ID
/sys/fs/cgroup/freezer/docker/$CONTAINER_ID
/sys/fs/cgroup/net_cls/docker/$CONTAINER_ID
/sys/fs/cgroup/cpu,cpuacct/docker/$CONTAINER_ID

where appropriate metrics files are located.

The module itself checks /sys/fs/cgroup/memory/docker/$CONTAINER_ID/memory.stat, not /sys/fs/cgroup/memory/system.slice/docker.service/docker/$CONTAINER_ID.

Is it possible to have module check these locations too?

Allow HCONTAINERID to be taken from different container property

When running docker with mesos and marathon, the Name ends up like mesos-018bcb1a-5511-44a3-bbb5-6d79c1f13c95, however it's possible to get a more useful name:

root@server:/$ docker inspect mesos-018bcb1a-5511-44a3-bbb5-6d79c1f13c95
    "Name": "/mesos-018bcb1a-5511-44a3-bbb5-6d79c1f13c95",
    "Config": {
        "Env": [
            "MARATHON_APP_ID=/useful-app/name",

Is it possible to get the HCONTAINERID from this property if it exists? I had a quick go myself but my C is not great.

Error running the module

I compiled the module as it says in the README.
On "OpenMediaVault" debian version 7.8
But when the zabbix agent starts I get an error, here is a debug level 4 log:
using configuration file: /usr/local/etc/zabbix_agentd.conf
19975:20150906:230914.178 In load_modules()
19975:20150906:230914.179 loading module "/usr/local/lib/modules/zabbix_module_docker.so"
19975:20150906:230914.179 cannot load module "zabbix_module_docker.so": /usr/local/lib/modules/zabbix_module_docker.so: undefined symbol: add_request_param
19975:20150906:230914.179 End of load_modules():FAIL
19975:20150906:230914.179 loading modules failed, exiting...

CPU user time over 8000% ?

Hi,

I am using App Docker Template active (30s interval). Zabbix discovery is working nice when I start a new container.

I am running a stress test container. I have an Intel Core 2 Duo processor (Mac Book Pro 2011). The container is running inside a VirtualBox VM (2 CPUs 2Gb RAM).

The curious thing is that the CPU user time graph for this container is showing over 8000% (eight thousand). Is that right?

Inside docker host, if i run docker stats <stress_container> I get around 250% CPU, sometimes it goes to 300%. I presence quick tick of over 410%.

How this measure works ?

Thank you.

Template Import Problems

When importing either template on Ubuntu 14.04 with Zabbix 2.2.2 (MySQL) I get the following error when importing template.

Created: Application "Docker" on "Template App Docker - active".
mb_strlen() expects parameter 1 to be string, array given [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → DB::checkValueTypes() → zbx_strlen() → mb_strlen() in /usr/share/zabbix/include/func.inc.php:955]
Array to string conversion [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → implode() in /usr/share/zabbix/include/classes/db/DB.php:443]
Error in query [INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('Running containers','7','','','300','0','','','0','0','','0','','','','','0','','','','','',Array,'10','','docker.discovery','','10107','1','4','0',NULL,'23660')] [Unknown column 'Array' in 'field list']
SQL statement execution has failed "INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('Running containers','7','','','300','0','','','0','0','','0','','','','','0','','','','','',Array,'10','','docker.discovery','','10107','1','4','0',NULL,'23660')".

Can't run zabbix agent

cat /etc/issue
Ubuntu 15.10

docker version
Client:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Tue Apr 26 23:38:55 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.1
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   5604cbe
 Built:        Tue Apr 26 23:38:55 2016
 OS/Arch:      linux/amd64

ls /var/run
acpid.socket   containerd    dbus         initctl         lightdm      mlocate.daily.lock  netns           pppconfig     samba            sshd.pid         teamviewerd.pid  user
agetty.reload  crond.pid     docker       initramfs       lightdm.pid  motd.dynamic        network         resolvconf    sendsigs.omit.d  sudo             thermald         utmp
avahi-daemon   crond.reboot  docker.pid   irqbalance.pid  lock         mount               NetworkManager  rsyslogd.pid  shm              systemd          tmpfiles.d       uuidd
cgmanager      cups          docker.sock  kerneloops.pid  log          mysqld              plymouth        runc          sshd             teamviewerd.ipc  udev

Run container

root@:~# docker run  --name=zabbix-agent-xxl \
 -h $(hostname) \
 -p 10050:10050  \
-v /:/rootfs \
 -e "ZA_Server=zabbix.srv" \
 -e "ZA_ServerActive=zabbix.srv" \
 -e "ZA_StartAgents=10" \
 -e "ZA_Timeout=30" \
-it --rm \
--privileged \
monitoringartist/zabbix-agent-xxl-limited:latest

Zocker XXL v0.9.4b public limited version
Copyright (C) 2014-2016 Jan Garaj - www.monitoringartist.com 
Freeware licence - Usage of this binary is restricted to official monitoringartist Docker images only.
Starting Zabbix Agent [sciencepulse.vitech.com.ua]. Zabbix 3.0.4 XXL (2016-08-21) (revision 61185).
Press Ctrl+C to exit.

    11:20160914:102452.722 Starting Zabbix Agent [sciencepulse.vitech.com.ua]. Zabbix 3.0.4 XXL (2016-08-21) (revision 61185).
    11:20160914:102452.722 **** Enabled features ****
    11:20160914:102452.722 IPv6 support:          YES
    11:20160914:102452.722 TLS support:           YES
    11:20160914:102452.722 **************************
    11:20160914:102452.722 using configuration file: /etc/zabbix/zabbix_agentd.conf
    11:20160914:102452.723 Cannot connect to standard docker's socket /var/run/docker.sock
    11:20160914:102452.723 loaded modules: zabbix_module_docker.so, zabbix_module_stress.so
    11:20160914:102452.724 agent #0 started [main process]
    12:20160914:102452.724 agent #1 started [collector]
    13:20160914:102452.724 agent #2 started [listener #1]
    14:20160914:102452.725 agent #3 started [listener #2]
    18:20160914:102452.725 agent #7 started [listener #6]
    19:20160914:102452.726 agent #8 started [listener #7]
    21:20160914:102452.726 agent #10 started [listener #9]
    15:20160914:102452.728 agent #4 started [listener #3]
    23:20160914:102452.728 agent #12 started [active checks #1]
    17:20160914:102452.728 agent #6 started [listener #5]
    20:20160914:102452.729 agent #9 started [listener #8]
    16:20160914:102452.730 agent #5 started [listener #4]
    22:20160914:102452.732 agent #11 started [listener #10]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x40596a]

goroutine 1 [running]:
panic(0x7eb920, 0xc82000a090)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
main.main()
    /root/git/zabbix-agent-xxl-source-code-private/zabbix-agent-3.0-limited/zocker-xxl.go:191 +0x496a

Add docker container name to docker.discovery

Hi, is it possible to add
docker container "name" (in this example name is "docker_nginx" ) to discovery keys?
so it could be more human readable in items/triggers.

docker ps
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                                                 NAMES
b22f3f28a36e        dockerfile/nginx:latest   "nginx"                5 hours ago         Up 5 hours          443/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:8001->8001/tcp   docker_nginx

How can I use Zabbix-Docker-Monitoring on CentOS 6.5?

I want to use Zabbix-Docker-Monitoring on CentOS 6.5.
So I added LoadModulePath and LoadModule parameter to /etc/zabbix/zabbix_agentd.conf.

LoadModulePath=/etc/zabbix/zabbix_agentd.d/modules
LoadModule=zabbix_module_docker.so

After that I copied zabbix_module_docker.so to /etc/zabbix/zabbix_agentd.d/modules.
But following errors occured when I started my zabbix_agent.

# cat /var/log/zabbix/zabbix_agentd.log
  7729:20140901:091923.030 Got signal [signal:15(SIGTERM),sender_pid:44374,sender_uid:0,reason:0]. Exiting ...
  7726:20140901:091923.030 Got signal [signal:15(SIGTERM),sender_pid:44374,sender_uid:0,reason:0]. Exiting ...
  7728:20140901:091923.030 Got signal [signal:15(SIGTERM),sender_pid:44374,sender_uid:0,reason:0]. Exiting ...
  7727:20140901:091923.030 Got signal [signal:15(SIGTERM),sender_pid:44374,sender_uid:0,reason:0]. Exiting ...
  7725:20140901:091923.031 Got signal [signal:15(SIGTERM),sender_pid:44374,sender_uid:0,reason:0]. Exiting ...
  7723:20140901:091923.031 One child process died (PID:7729,exitcode/signal:255). Exiting ...
  7723:20140901:091923.033 Zabbix Agent stopped. Zabbix 2.2.6 (revision 48483).
 44385:20140901:091923.144 Starting Zabbix Agent [rchcga01]. Zabbix 2.2.6 (revision 48483).
 44385:20140901:091923.144 using configuration file: /etc/zabbix/zabbix_agentd.conf
 44385:20140901:091923.145 cannot load module "zabbix_module_docker.so": /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /etc/zabbix/zabbix_agentd.d/modules/zabbix_module_docker.so)
 44385:20140901:091923.145 loading modules failed, exiting...

My Cent OS 6.5 has only GLIBC_2.12'.

# /lib64/libc.so.6 -v
GNU C Library stable release version 2.12, by Roland McGrath et al.
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.4.7 20120313 (Red Hat 4.4.7-4).
Compiled on a Linux 2.6.32 system on 2013-11-21.
Available extensions:
        The C stubs add-on version 2.1.2.
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
        RT using linux kernel aio
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
.

So I decided to compile Zabbix-Docker-Monitoring on Cent OS 6.5 with GLIBC_2.12 like this.
But I couldn't.
Could you give me some advice?

# cd /tmp
# wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.6/zabbix-2.2.6.tar.gz/download -O zabbix-2.2.6.tar.gz
# tar xvfz zabbix-2.2.6.tar.gz
# wget https://github.com/jangaraj/Zabbix-Docker-Monitoring/archive/master.zip
# unzip master.zip
# cp -pr /tmp/Zabbix-Docker-Monitoring-master/src/modules/zabbix_module_docker /tmp/zabbix-2.2.6/src/modules
# cd /tmp/zabbix-2.2.6/src/modules/zabbix_module_docker
# cp -p Makefile Makefile.org
# vi Makefile
zabbix_module_docker: zabbix_module_docker.c
        gcc -fPIC -shared -o zabbix_module_docker.so zabbix_module_docker.c -I../../../include

# diff -y Makefile Makefile.org
zabbix_module_docker: zabbix_module_docker.c                  | zabbix_module_docker: docker.c
        gcc -fPIC -shared -o zabbix_module_docker.so zabbix_m /         gcc -fPIC -shared -o zabbix_module_docker.so zabbix_m
# make
gcc -fPIC -shared -o zabbix_module_docker.so zabbix_module_docker.c -I../../../include
In file included from zabbix_module_docker.c:20:
../../../include/sysinc.h:23:20: error: config.h: No such file or directory
In file included from ../../../include/module.h:23,
                 from zabbix_module_docker.c:21:
../../../include/zbxtypes.h:106: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_offset_t’
../../../include/zbxtypes.h:132: error: expected specifier-qualifier-list before ‘uint64_t’
In file included from zabbix_module_docker.c:21:
../../../include/module.h:52: error: expected specifier-qualifier-list before ‘uint64_t’
../../../include/module.h:61: error: expected specifier-qualifier-list before ‘uint64_t’
../../../include/module.h:73: error: expected specifier-qualifier-list before ‘uint64_t’
In file included from zabbix_module_docker.c:23:
../../../include/common.h:213: error: expected specifier-qualifier-list before ‘uint64_t’
../../../include/common.h:658: error: expected specifier-qualifier-list before ‘uint64_t’
../../../include/common.h:691: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:691: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:692: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:693: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:779: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:779: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:779: error: expected declaration specifiers or ‘...’ before ‘uint64_t’
../../../include/common.h:779: error: expected declaration specifiers or ‘...’ before ‘uint64_t’
../../../include/common.h:802: error: expected declaration specifiers or ‘...’ before ‘uint64_t’
../../../include/common.h:816: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:844: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:847: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:849: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_get_escape_string_len’
../../../include/common.h:851: error: expected ‘)’ before ‘seed’
../../../include/common.h:852: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘calculate_proxy_nextcheck’
../../../include/common.h:853: error: expected declaration specifiers or ‘...’ before ‘time_t’
../../../include/common.h:854: error: expected ‘)’ before ‘c’
../../../include/common.h:855: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_hex2num’
../../../include/common.h:856: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_binary2hex’
../../../include/common.h:857: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_hex2binary’
../../../include/common.h:859: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_get_next_field’
../../../include/common.h:861: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:907: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__zbx_zbx_snprintf’
../../../include/common.h:908: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:908: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:910: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_vsnprintf’
../../../include/common.h:912: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:912: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:912: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:913: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:913: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:914: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:914: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:919: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_strlcpy’
../../../include/common.h:920: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_strlcat’
../../../include/common.h:922: error: expected declaration specifiers or ‘...’ before ‘va_list’
../../../include/common.h:938: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:938: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:939: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:939: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:940: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:940: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:941: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:946: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:946: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:958: error: expected declaration specifiers or ‘...’ before ‘uint64_t’
../../../include/common.h:968: warning: ‘struct timeval’ declared inside parameter list
../../../include/common.h:968: warning: its scope is only this definition or declaration, which is probably not what you want
../../../include/common.h:970: error: expected ‘)’ before ‘date’
../../../include/common.h:971: error: expected ‘)’ before ‘time’
../../../include/common.h:981: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:981: error: expected declaration specifiers or ‘...’ before ‘uint64_t’
../../../include/common.h:982: error: expected ‘)’ before ‘*’ token
../../../include/common.h:983: error: expected ‘)’ before ‘*’ token
../../../include/common.h:984: error: expected ‘)’ before ‘*’ token
../../../include/common.h:985: error: expected ‘)’ before ‘*’ token
../../../include/common.h:986: error: expected ‘)’ before ‘*’ token
../../../include/common.h:1005: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_utf8_char_len’
../../../include/common.h:1006: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_strlen_utf8’
../../../include/common.h:1007: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_strlen_utf8_n’
../../../include/common.h:1016: error: expected declaration specifiers or ‘...’ before ‘uint64_t’
../../../include/common.h:1028: error: expected declaration specifiers or ‘...’ before ‘uint64_t’
../../../include/common.h:1030: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:1031: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:1036: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_letoh_uint64’
../../../include/common.h:1037: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘zbx_htole_uint64’
../../../include/common.h:1061: error: expected declaration specifiers or ‘...’ before ‘size_t’
../../../include/common.h:1061: error: expected declaration specifiers or ‘...’ before ‘size_t’
zabbix_module_docker.c: In function ‘zbx_module_docker_up’:
zabbix_module_docker.c:103: error: ‘AGENT_RESULT’ has no member named ‘msg’
zabbix_module_docker.c:103: warning: incompatible implicit declaration of built-in function ‘strdup’
zabbix_module_docker.c:110: warning: incompatible implicit declaration of built-in function ‘strlen’
zabbix_module_docker.c:111: warning: incompatible implicit declaration of built-in function ‘malloc’
zabbix_module_docker.c:122: error: ‘AGENT_RESULT’ has no member named ‘dbl’
zabbix_module_docker.c:127: error: ‘AGENT_RESULT’ has no member named ‘dbl’
zabbix_module_docker.c: In function ‘zbx_module_docker_dev’:
zabbix_module_docker.c:141: error: ‘AGENT_RESULT’ has no member named ‘msg’
zabbix_module_docker.c:141: warning: incompatible implicit declaration of built-in function ‘strdup’
zabbix_module_docker.c:150: warning: incompatible implicit declaration of built-in function ‘strlen’
zabbix_module_docker.c:151: warning: incompatible implicit declaration of built-in function ‘malloc’
zabbix_module_docker.c:162: error: ‘AGENT_RESULT’ has no member named ‘msg’
zabbix_module_docker.c:162: warning: incompatible implicit declaration of built-in function ‘strdup’
zabbix_module_docker.c:168: warning: incompatible implicit declaration of built-in function ‘memcpy’
zabbix_module_docker.c:170: error: ‘uint64_t’ undeclared (first use in this function)
zabbix_module_docker.c:170: error: (Each undeclared identifier is reported only once
zabbix_module_docker.c:170: error: for each function it appears in.)
zabbix_module_docker.c:170: error: expected ‘;’ before ‘value’
zabbix_module_docker.c:177: error: ‘value’ undeclared (first use in this function)
zabbix_module_docker.c:183: error: ‘AGENT_RESULT’ has no member named ‘ui64’
zabbix_module_docker.c:190: error: ‘AGENT_RESULT’ has no member named ‘msg’
zabbix_module_docker.c: In function ‘zbx_module_docker_mem’:
zabbix_module_docker.c:205: error: ‘AGENT_RESULT’ has no member named ‘msg’
zabbix_module_docker.c:205: warning: incompatible implicit declaration of built-in function ‘strdup’
zabbix_module_docker.c:213: warning: incompatible implicit declaration of built-in function ‘strlen’
zabbix_module_docker.c:214: warning: incompatible implicit declaration of built-in function ‘malloc’
zabbix_module_docker.c:225: error: ‘AGENT_RESULT’ has no member named ‘msg’
zabbix_module_docker.c:225: warning: incompatible implicit declaration of built-in function ‘strdup’
zabbix_module_docker.c:231: warning: incompatible implicit declaration of built-in function ‘memcpy’
zabbix_module_docker.c:233: error: ‘uint64_t’ undeclared (first use in this function)
zabbix_module_docker.c:233: error: expected ‘;’ before ‘value’
zabbix_module_docker.c:240: error: ‘value’ undeclared (first use in this function)
zabbix_module_docker.c:246: error: ‘AGENT_RESULT’ has no member named ‘ui64’
zabbix_module_docker.c:253: error: ‘AGENT_RESULT’ has no member named ‘msg’
zabbix_module_docker.c: In function ‘zbx_module_docker_cpu’:
zabbix_module_docker.c:268: error: ‘AGENT_RESULT’ has no member named ‘msg’
zabbix_module_docker.c: In function ‘zbx_module_docker_net’:
zabbix_module_docker.c:277: error: ‘AGENT_RESULT’ has no member named ‘msg’
In file included from zabbix_module_docker.c:283:
../../../include/zbxjson.h: In function ‘zbx_module_docker_discovery’:
../../../include/zbxjson.h:136: error: expected declaration specifiers or ‘...’ before ‘uint64_t’
zabbix_module_docker.c:287: error: ‘DIR’ undeclared (first use in this function)
zabbix_module_docker.c:287: error: ‘dir’ undeclared (first use in this function)
zabbix_module_docker.c:288: error: storage size of ‘sb’ isn’t known
zabbix_module_docker.c:293: warning: incompatible implicit declaration of built-in function ‘strlen’
zabbix_module_docker.c:294: warning: incompatible implicit declaration of built-in function ‘malloc’
zabbix_module_docker.c:302: error: ‘errno’ undeclared (first use in this function)
zabbix_module_docker.c:313: error: dereferencing pointer to incomplete type
zabbix_module_docker.c:313: error: dereferencing pointer to incomplete type
zabbix_module_docker.c:316: error: dereferencing pointer to incomplete type
zabbix_module_docker.c:318: error: ‘S_IFMT’ undeclared (first use in this function)
zabbix_module_docker.c:318: error: ‘S_IFDIR’ undeclared (first use in this function)
zabbix_module_docker.c:323: error: dereferencing pointer to incomplete type
zabbix_module_docker.c:324: error: dereferencing pointer to incomplete type
zabbix_module_docker.c:338: error: ‘AGENT_RESULT’ has no member named ‘str’
zabbix_module_docker.c: In function ‘zbx_module_init’:
zabbix_module_docker.c:363: error: storage size of ‘s’ isn’t known
zabbix_module_docker.c:383: error: ‘S_IFMT’ undeclared (first use in this function)
zabbix_module_docker.c:383: error: ‘S_IFDIR’ undeclared (first use in this function)
make: *** [zabbix_module_docker] Error 1

SIGSEGV in zbx_module_docker_cpu

Hi,

I'm getting SIGSEGV when running your module (the latest built from master branch). The server is bootstrapped from the scratch via puppet. Is there any possibility it could crash this way, when zabbix-agent starts before Docker process or before any container is created?

Used SW:

  • Debian Wheezy
  • Zabbix 2.4.5
  • Docker 1.6.2
21055:20150630:075317.461 Got signal [signal:11(SIGSEGV),reason:1,refaddr:(nil)]. Crashing ...
 21055:20150630:075317.461 ====== Fatal information: ======
 21055:20150630:075317.461 Program counter: 0x7fce403e08cf
 21055:20150630:075317.461 === Registers: ===
 21055:20150630:075317.461 r8      =                0 =                    0 =                    0
 21055:20150630:075317.461 r9      =          15a21b7 =             22684087 =             22684087
 21055:20150630:075317.461 r10     =                2 =                    2 =                    2
 21055:20150630:075317.461 r11     =                6 =                    6 =                    6
 21055:20150630:075317.461 r12     =                0 =                    0 =                    0
 21055:20150630:075317.462 r13     =                0 =                    0 =                    0
 21055:20150630:075317.462 r14     =                0 =                    0 =                    0
 21055:20150630:075317.462 r15     =                0 =                    0 =                    0
 21055:20150630:075317.462 rdi     =                0 =                    0 =                    0
 21055:20150630:075317.462 rsi     =     7fce3d315e2e =      140523766636078 =      140523766636078
 21055:20150630:075317.462 rbp     =     7ffc2df30780 =      140721079388032 =      140721079388032
 21055:20150630:075317.462 rbx     =          15a1d20 =             22682912 =             22682912
 21055:20150630:075317.462 rdx     =                a =                   10 =                   10
 21055:20150630:075317.462 rax     =                0 =                    0 =                    0
 21055:20150630:075317.462 rcx     =                0 =                    0 =                    0
 21055:20150630:075317.462 rsp     =     7ffc2df2fef8 =      140721079385848 =      140721079385848
 21055:20150630:075317.462 rip     =     7fce403e08cf =      140523817797839 =      140523817797839
 21055:20150630:075317.462 efl     =            10246 =                66118 =                66118
 21055:20150630:075317.462 csgsfs  =               33 =                   51 =                   51
 21055:20150630:075317.462 err     =                4 =                    4 =                    4
 21055:20150630:075317.462 trapno  =                e =                   14 =                   14
 21055:20150630:075317.462 oldmask =                4 =                    4 =                    4
 21055:20150630:075317.462 cr2     =                0 =                    0 =                    0
 21055:20150630:075317.462 === Backtrace: ===
 21055:20150630:075317.462 12: /usr/sbin/zabbix_agentd: listener #2 [processing request](print_fatal_info+0x9e) [0x425cde]
 21055:20150630:075317.462 11: /usr/sbin/zabbix_agentd: listener #2 [processing request]() [0x4260e7]
 21055:20150630:075317.462 10: /lib/x86_64-linux-gnu/libc.so.6(+0x321e0) [0x7fce402f81e0]
 21055:20150630:075317.462 9: /lib/x86_64-linux-gnu/libc.so.6(+0x11a8cf) [0x7fce403e08cf]
 21055:20150630:075317.462 8: /usr/lib/samepage/zabbix/modules/zabbix_module_docker.so(zbx_module_docker_cpu+0x195) [0x7fce3d311852]
 21055:20150630:075317.462 7: /usr/sbin/zabbix_agentd: listener #2 [processing request](process+0x324) [0x414414]
 21055:20150630:075317.462 6: /usr/sbin/zabbix_agentd: listener #2 [processing request](listener_thread+0x1b3) [0x413543]
 21055:20150630:075317.462 5: /usr/sbin/zabbix_agentd: listener #2 [processing request](zbx_thread_start+0x62) [0x424952]
 21055:20150630:075317.462 4: /usr/sbin/zabbix_agentd: listener #2 [processing request](MAIN_ZABBIX_ENTRY+0x1de) [0x4130be]
 21055:20150630:075317.462 3: /usr/sbin/zabbix_agentd: listener #2 [processing request](daemon_start+0x18c) [0x4255ec]
 21055:20150630:075317.462 2: /usr/sbin/zabbix_agentd: listener #2 [processing request](main+0x171) [0x40c0a1]
 21055:20150630:075317.462 1: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7fce402e4ead]
 21055:20150630:075317.462 0: /usr/sbin/zabbix_agentd: listener #2 [processing request]() [0x40c191]
 21055:20150630:075317.462 === Memory map: ===
 21055:20150630:075317.463 00400000-00447000 r-xp 00000000 fd:00 661607                             /usr/sbin/zabbix_agentd
 21055:20150630:075317.463 00647000-00649000 rw-p 00047000 fd:00 661607                             /usr/sbin/zabbix_agentd
 21055:20150630:075317.463 00649000-0064e000 rw-p 00000000 00:00 0 
 21055:20150630:075317.463 0159b000-015bc000 rw-p 00000000 00:00 0                                  [heap]
 21055:20150630:075317.463 7fce3d0f8000-7fce3d10d000 r-xp 00000000 fd:00 658644                     /lib/x86_64-linux-gnu/libgcc_s.so.1
 21055:20150630:075317.463 7fce3d10d000-7fce3d30d000 ---p 00015000 fd:00 658644                     /lib/x86_64-linux-gnu/libgcc_s.so.1
 21055:20150630:075317.463 7fce3d30d000-7fce3d30e000 rw-p 00015000 fd:00 658644                     /lib/x86_64-linux-gnu/libgcc_s.so.1
 21055:20150630:075317.463 7fce3d30e000-7fce3d318000 r-xp 00000000 fd:00 536171                     /usr/lib/samepage/zabbix/modules/zabbix_module_docker.master
 21055:20150630:075317.463 7fce3d318000-7fce3d517000 ---p 0000a000 fd:00 536171                     /usr/lib/samepage/zabbix/modules/zabbix_module_docker.master
 21055:20150630:075317.463 7fce3d517000-7fce3d518000 rw-p 00009000 fd:00 536171                     /usr/lib/samepage/zabbix/modules/zabbix_module_docker.master
 21055:20150630:075317.463 7fce3d518000-7fce3d523000 r-xp 00000000 fd:00 658589                     /lib/x86_64-linux-gnu/libnss_files-2.13.so
 21055:20150630:075317.463 7fce3d523000-7fce3d722000 ---p 0000b000 fd:00 658589                     /lib/x86_64-linux-gnu/libnss_files-2.13.so
 21055:20150630:075317.463 7fce3d722000-7fce3d723000 r--p 0000a000 fd:00 658589                     /lib/x86_64-linux-gnu/libnss_files-2.13.so
 21055:20150630:075317.463 7fce3d723000-7fce3d724000 rw-p 0000b000 fd:00 658589                     /lib/x86_64-linux-gnu/libnss_files-2.13.so
 21055:20150630:075317.463 7fce3d724000-7fce3d72e000 r-xp 00000000 fd:00 658666                     /lib/x86_64-linux-gnu/libnss_nis-2.13.so
 21055:20150630:075317.463 7fce3d72e000-7fce3d92d000 ---p 0000a000 fd:00 658666                     /lib/x86_64-linux-gnu/libnss_nis-2.13.so
 21055:20150630:075317.463 7fce3d92d000-7fce3d92e000 r--p 00009000 fd:00 658666                     /lib/x86_64-linux-gnu/libnss_nis-2.13.so
 21055:20150630:075317.463 7fce3d92e000-7fce3d92f000 rw-p 0000a000 fd:00 658666                     /lib/x86_64-linux-gnu/libnss_nis-2.13.so
 21055:20150630:075317.463 7fce3d92f000-7fce3d944000 r-xp 00000000 fd:00 658686                     /lib/x86_64-linux-gnu/libnsl-2.13.so
 21055:20150630:075317.463 7fce3d944000-7fce3db43000 ---p 00015000 fd:00 658686                     /lib/x86_64-linux-gnu/libnsl-2.13.so
 21055:20150630:075317.463 7fce3db43000-7fce3db44000 r--p 00014000 fd:00 658686                     /lib/x86_64-linux-gnu/libnsl-2.13.so
 21055:20150630:075317.463 7fce3db44000-7fce3db45000 rw-p 00015000 fd:00 658686                     /lib/x86_64-linux-gnu/libnsl-2.13.so
 21055:20150630:075317.463 7fce3db45000-7fce3db47000 rw-p 00000000 00:00 0 
 21055:20150630:075317.463 7fce3db47000-7fce3db4e000 r-xp 00000000 fd:00 658678                     /lib/x86_64-linux-gnu/libnss_compat-2.13.so
 21055:20150630:075317.463 7fce3db4e000-7fce3dd4d000 ---p 00007000 fd:00 658678                     /lib/x86_64-linux-gnu/libnss_compat-2.13.so
 21055:20150630:075317.463 7fce3dd4d000-7fce3dd4e000 r--p 00006000 fd:00 658678                     /lib/x86_64-linux-gnu/libnss_compat-2.13.so
 21055:20150630:075317.463 7fce3dd4e000-7fce3dd4f000 rw-p 00007000 fd:00 658678                     /lib/x86_64-linux-gnu/libnss_compat-2.13.so
 21055:20150630:075317.463 7fce3dd4f000-7fce3dd52000 r-xp 00000000 fd:00 658583                     /lib/x86_64-linux-gnu/libkeyutils.so.1.4
 21055:20150630:075317.463 7fce3dd52000-7fce3df51000 ---p 00003000 fd:00 658583                     /lib/x86_64-linux-gnu/libkeyutils.so.1.4
 21055:20150630:075317.463 7fce3df51000-7fce3df52000 r--p 00002000 fd:00 658583                     /lib/x86_64-linux-gnu/libkeyutils.so.1.4
 21055:20150630:075317.463 7fce3df52000-7fce3df53000 rw-p 00003000 fd:00 658583                     /lib/x86_64-linux-gnu/libkeyutils.so.1.4
 21055:20150630:075317.463 7fce3df53000-7fce3df5b000 r-xp 00000000 fd:00 397946                     /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
 21055:20150630:075317.463 7fce3df5b000-7fce3e15a000 ---p 00008000 fd:00 397946                     /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
 21055:20150630:075317.463 7fce3e15a000-7fce3e15b000 r--p 00007000 fd:00 397946                     /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
 21055:20150630:075317.463 7fce3e15b000-7fce3e15c000 rw-p 00008000 fd:00 397946                     /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
 21055:20150630:075317.463 7fce3e15c000-7fce3e15f000 r-xp 00000000 fd:00 658669                     /lib/x86_64-linux-gnu/libcom_err.so.2.1
 21055:20150630:075317.463 7fce3e15f000-7fce3e35e000 ---p 00003000 fd:00 658669                     /lib/x86_64-linux-gnu/libcom_err.so.2.1
 21055:20150630:075317.463 7fce3e35e000-7fce3e35f000 r--p 00002000 fd:00 658669                     /lib/x86_64-linux-gnu/libcom_err.so.2.1
 21055:20150630:075317.463 7fce3e35f000-7fce3e360000 rw-p 00003000 fd:00 658669                     /lib/x86_64-linux-gnu/libcom_err.so.2.1
 21055:20150630:075317.463 7fce3e360000-7fce3e386000 r-xp 00000000 fd:00 397953                     /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
 21055:20150630:075317.463 7fce3e386000-7fce3e586000 ---p 00026000 fd:00 397953                     /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
 21055:20150630:075317.463 7fce3e586000-7fce3e587000 r--p 00026000 fd:00 397953                     /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
 21055:20150630:075317.463 7fce3e587000-7fce3e588000 rw-p 00027000 fd:00 397953                     /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
 21055:20150630:075317.463 7fce3e588000-7fce3e589000 rw-p 00000000 00:00 0 
 21055:20150630:075317.463 7fce3e589000-7fce3e652000 r-xp 00000000 fd:00 397900                     /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
 21055:20150630:075317.463 7fce3e652000-7fce3e851000 ---p 000c9000 fd:00 397900                     /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
 21055:20150630:075317.463 7fce3e851000-7fce3e85b000 r--p 000c8000 fd:00 397900                     /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
 21055:20150630:075317.463 7fce3e85b000-7fce3e85d000 rw-p 000d2000 fd:00 397900                     /usr/lib/x86_64-linux-gnu/libkrb5.so.3.3
 21055:20150630:075317.463 7fce3e85d000-7fce3e860000 r-xp 00000000 fd:00 658704                     /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
 21055:20150630:075317.463 7fce3e860000-7fce3ea5f000 ---p 00003000 fd:00 658704                     /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
 21055:20150630:075317.463 7fce3ea5f000-7fce3ea60000 rw-p 00002000 fd:00 658704                     /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
 21055:20150630:075317.463 7fce3ea60000-7fce3ea71000 r-xp 00000000 fd:00 398005                     /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
 21055:20150630:075317.463 7fce3ea71000-7fce3ec70000 ---p 00011000 fd:00 398005                     /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
 21055:20150630:075317.463 7fce3ec70000-7fce3ec71000 r--p 00010000 fd:00 398005                     /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
 21055:20150630:075317.464 7fce3ec71000-7fce3ec72000 rw-p 00011000 fd:00 398005                     /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
 21055:20150630:075317.464 7fce3ec72000-7fce3ec82000 r-xp 00000000 fd:00 397877                     /usr/lib/x86_64-linux-gnu/libtasn1.so.3.1.16
 21055:20150630:075317.464 7fce3ec82000-7fce3ee81000 ---p 00010000 fd:00 397877                     /usr/lib/x86_64-linux-gnu/libtasn1.so.3.1.16
 21055:20150630:075317.464 7fce3ee81000-7fce3ee82000 r--p 0000f000 fd:00 397877                     /usr/lib/x86_64-linux-gnu/libtasn1.so.3.1.16
 21055:20150630:075317.464 7fce3ee82000-7fce3ee83000 rw-p 00010000 fd:00 397877                     /usr/lib/x86_64-linux-gnu/libtasn1.so.3.1.16
 21055:20150630:075317.464 7fce3ee83000-7fce3ee9c000 r-xp 00000000 fd:00 398045                     /usr/lib/x86_64-linux-gnu/librtmp.so.0
 21055:20150630:075317.464 7fce3ee9c000-7fce3f09c000 ---p 00019000 fd:00 398045                     /usr/lib/x86_64-linux-gnu/librtmp.so.0
 21055:20150630:075317.464 7fce3f09c000-7fce3f09d000 rw-p 00019000 fd:00 398045                     /usr/lib/x86_64-linux-gnu/librtmp.so.0
 21055:20150630:075317.464 7fce3f09d000-7fce3f0b3000 r-xp 00000000 fd:00 658720                     /lib/x86_64-linux-gnu/libz.so.1.2.7
 21055:20150630:075317.464 7fce3f0b3000-7fce3f2b2000 ---p 00016000 fd:00 658720                     /lib/x86_64-linux-gnu/libz.so.1.2.7
 21055:20150630:075317.464 7fce3f2b2000-7fce3f2b3000 r--p 00015000 fd:00 658720                     /lib/x86_64-linux-gnu/libz.so.1.2.7
 21055:20150630:075317.464 7fce3f2b3000-7fce3f2b4000 rw-p 00016000 fd:00 658720                     /lib/x86_64-linux-gnu/libz.so.1.2.7
 21055:20150630:075317.464 7fce3f2b4000-7fce3f2f0000 r-xp 00000000 fd:00 397914                     /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
 21055:20150630:075317.464 7fce3f2f0000-7fce3f4f0000 ---p 0003c000 fd:00 397914                     /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
 21055:20150630:075317.464 7fce3f4f0000-7fce3f4f1000 r--p 0003c000 fd:00 397914                     /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
 21055:20150630:075317.464 7fce3f4f1000-7fce3f4f3000 rw-p 0003d000 fd:00 397914                     /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2.2
 21055:20150630:075317.464 7fce3f4f3000-7fce3f51a000 r-xp 00000000 fd:00 398046                     /usr/lib/x86_64-linux-gnu/libssh2.so.1.0.1
 21055:20150630:075317.464 7fce3f51a000-7fce3f71a000 ---p 00027000 fd:00 398046                     /usr/lib/x86_64-linux-gnu/libssh2.so.1.0.1
 21055:20150630:075317.464 7fce3f71a000-7fce3f71b000 r--p 00027000 fd:00 398046                     /usr/lib/x86_64-linux-gnu/libssh2.so.1.0.1
 21055:20150630:075317.464 7fce3f71b000-7fce3f71c000 rw-p 00028000 fd:00 398046                     /usr/lib/x86_64-linux-gnu/libssh2.so.1.0.1
 21055:20150630:075317.464 7fce3f71c000-7fce3f74e000 r-xp 00000000 fd:00 397937                     /usr/lib/x86_64-linux-gnu/libidn.so.11.6.8
 21055:20150630:075317.464 7fce3f74e000-7fce3f94e000 ---p 00032000 fd:00 397937                     /usr/lib/x86_64-linux-gnu/libidn.so.11.6.8
 21055:20150630:075317.464 7fce3f94e000-7fce3f94f000 r--p 00032000 fd:00 397937                     /usr/lib/x86_64-linux-gnu/libidn.so.11.6.8
 21055:20150630:075317.464 7fce3f94f000-7fce3f950000 rw-p 00033000 fd:00 397937                     /usr/lib/x86_64-linux-gnu/libidn.so.11.6.8
 21055:20150630:075317.464 7fce3f950000-7fce3f967000 r-xp 00000000 fd:00 658636                     /lib/x86_64-linux-gnu/libpthread-2.13.so
 21055:20150630:075317.464 7fce3f967000-7fce3fb66000 ---p 00017000 fd:00 658636                     /lib/x86_64-linux-gnu/libpthread-2.13.so
 21055:20150630:075317.464 7fce3fb66000-7fce3fb67000 r--p 00016000 fd:00 658636                     /lib/x86_64-linux-gnu/libpthread-2.13.so
 21055:20150630:075317.464 7fce3fb67000-7fce3fb68000 rw-p 00017000 fd:00 658636                     /lib/x86_64-linux-gnu/libpthread-2.13.so
 21055:20150630:075317.464 7fce3fb68000-7fce3fb6c000 rw-p 00000000 00:00 0 
 21055:20150630:075317.464 7fce3fb6c000-7fce3fbe7000 r-xp 00000000 fd:00 658699                     /lib/x86_64-linux-gnu/libgcrypt.so.11.7.0
 21055:20150630:075317.464 7fce3fbe7000-7fce3fde7000 ---p 0007b000 fd:00 658699                     /lib/x86_64-linux-gnu/libgcrypt.so.11.7.0
 21055:20150630:075317.464 7fce3fde7000-7fce3fde8000 r--p 0007b000 fd:00 658699                     /lib/x86_64-linux-gnu/libgcrypt.so.11.7.0
 21055:20150630:075317.464 7fce3fde8000-7fce3fdeb000 rw-p 0007c000 fd:00 658699                     /lib/x86_64-linux-gnu/libgcrypt.so.11.7.0
 21055:20150630:075317.464 7fce3fdeb000-7fce3fea4000 r-xp 00000000 fd:00 397956                     /usr/lib/x86_64-linux-gnu/libgnutls.so.26.22.4
 21055:20150630:075317.464 7fce3fea4000-7fce400a3000 ---p 000b9000 fd:00 397956                     /usr/lib/x86_64-linux-gnu/libgnutls.so.26.22.4
 21055:20150630:075317.464 7fce400a3000-7fce400a9000 r--p 000b8000 fd:00 397956                     /usr/lib/x86_64-linux-gnu/libgnutls.so.26.22.4
 21055:20150630:075317.464 7fce400a9000-7fce400ab000 rw-p 000be000 fd:00 397956                     /usr/lib/x86_64-linux-gnu/libgnutls.so.26.22.4
 21055:20150630:075317.464 7fce400ab000-7fce400c5000 r-xp 00000000 fd:00 398034                     /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
 21055:20150630:075317.464 7fce400c5000-7fce402c4000 ---p 0001a000 fd:00 398034                     /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
 21055:20150630:075317.464 7fce402c4000-7fce402c5000 r--p 00019000 fd:00 398034                     /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
 21055:20150630:075317.464 7fce402c5000-7fce402c6000 rw-p 0001a000 fd:00 398034                     /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
 21055:20150630:075317.464 7fce402c6000-7fce40447000 r-xp 00000000 fd:00 658726                     /lib/x86_64-linux-gnu/libc-2.13.so
 21055:20150630:075317.464 7fce40447000-7fce40647000 ---p 00181000 fd:00 658726                     /lib/x86_64-linux-gnu/libc-2.13.so
 21055:20150630:075317.464 7fce40647000-7fce4064b000 r--p 00181000 fd:00 658726                     /lib/x86_64-linux-gnu/libc-2.13.so
 21055:20150630:075317.464 7fce4064b000-7fce4064c000 rw-p 00185000 fd:00 658726                     /lib/x86_64-linux-gnu/libc-2.13.so
 21055:20150630:075317.464 7fce4064c000-7fce40651000 rw-p 00000000 00:00 0 
 21055:20150630:075317.464 7fce40651000-7fce40664000 r-xp 00000000 fd:00 658654                     /lib/x86_64-linux-gnu/libresolv-2.13.so
 21055:20150630:075317.464 7fce40664000-7fce40863000 ---p 00013000 fd:00 658654                     /lib/x86_64-linux-gnu/libresolv-2.13.so
 21055:20150630:075317.464 7fce40863000-7fce40864000 r--p 00012000 fd:00 658654                     /lib/x86_64-linux-gnu/libresolv-2.13.so
 21055:20150630:075317.464 7fce40864000-7fce40865000 rw-p 00013000 fd:00 658654                     /lib/x86_64-linux-gnu/libresolv-2.13.so
 21055:20150630:075317.464 7fce40865000-7fce40867000 rw-p 00000000 00:00 0 
 21055:20150630:075317.464 7fce40867000-7fce4086e000 r-xp 00000000 fd:00 658640                     /lib/x86_64-linux-gnu/librt-2.13.so
 21055:20150630:075317.464 7fce4086e000-7fce40a6d000 ---p 00007000 fd:00 658640                     /lib/x86_64-linux-gnu/librt-2.13.so
 21055:20150630:075317.464 7fce40a6d000-7fce40a6e000 r--p 00006000 fd:00 658640                     /lib/x86_64-linux-gnu/librt-2.13.so
 21055:20150630:075317.464 7fce40a6e000-7fce40a6f000 rw-p 00007000 fd:00 658640                     /lib/x86_64-linux-gnu/librt-2.13.so
 21055:20150630:075317.464 7fce40a6f000-7fce40a71000 r-xp 00000000 fd:00 658670                     /lib/x86_64-linux-gnu/libdl-2.13.so
 21055:20150630:075317.465 7fce40a71000-7fce40c71000 ---p 00002000 fd:00 658670                     /lib/x86_64-linux-gnu/libdl-2.13.so
 21055:20150630:075317.465 7fce40c71000-7fce40c72000 r--p 00002000 fd:00 658670                     /lib/x86_64-linux-gnu/libdl-2.13.so
 21055:20150630:075317.465 7fce40c72000-7fce40c73000 rw-p 00003000 fd:00 658670                     /lib/x86_64-linux-gnu/libdl-2.13.so
 21055:20150630:075317.465 7fce40c73000-7fce40cf4000 r-xp 00000000 fd:00 658652                     /lib/x86_64-linux-gnu/libm-2.13.so
 21055:20150630:075317.465 7fce40cf4000-7fce40ef3000 ---p 00081000 fd:00 658652                     /lib/x86_64-linux-gnu/libm-2.13.so
 21055:20150630:075317.465 7fce40ef3000-7fce40ef4000 r--p 00080000 fd:00 658652                     /lib/x86_64-linux-gnu/libm-2.13.so
 21055:20150630:075317.465 7fce40ef4000-7fce40ef5000 rw-p 00081000 fd:00 658652                     /lib/x86_64-linux-gnu/libm-2.13.so
 21055:20150630:075317.465 7fce40ef5000-7fce40f56000 r-xp 00000000 fd:00 398048                     /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.2.0
 21055:20150630:075317.465 7fce40f56000-7fce41155000 ---p 00061000 fd:00 398048                     /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.2.0
 21055:20150630:075317.465 7fce41155000-7fce41158000 r--p 00060000 fd:00 398048                     /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.2.0
 21055:20150630:075317.465 7fce41158000-7fce41159000 rw-p 00063000 fd:00 398048                     /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.2.0
 21055:20150630:075317.465 7fce41159000-7fce41167000 r-xp 00000000 fd:00 398040                     /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
 21055:20150630:075317.465 7fce41167000-7fce41366000 ---p 0000e000 fd:00 398040                     /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
 21055:20150630:075317.465 7fce41366000-7fce41367000 r--p 0000d000 fd:00 398040                     /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
 21055:20150630:075317.465 7fce41367000-7fce41368000 rw-p 0000e000 fd:00 398040                     /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
 21055:20150630:075317.465 7fce41368000-7fce413b4000 r-xp 00000000 fd:00 398041                     /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.8.3
 21055:20150630:075317.465 7fce413b4000-7fce415b4000 ---p 0004c000 fd:00 398041                     /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.8.3
 21055:20150630:075317.465 7fce415b4000-7fce415b6000 r--p 0004c000 fd:00 398041                     /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.8.3
 21055:20150630:075317.465 7fce415b6000-7fce415b7000 rw-p 0004e000 fd:00 398041                     /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.8.3
 21055:20150630:075317.465 7fce415b7000-7fce415b9000 rw-p 00000000 00:00 0 
 21055:20150630:075317.465 7fce415b9000-7fce415d9000 r-xp 00000000 fd:00 658665                     /lib/x86_64-linux-gnu/ld-2.13.so
 21055:20150630:075317.465 7fce4178d000-7fce4179a000 rw-s 00000000 00:04 393217                     /SYSV6d001b90 (deleted)
 21055:20150630:075317.465 7fce4179a000-7fce417c5000 rw-s 00000000 00:04 360448                     /SYSV6c001b90 (deleted)
 21055:20150630:075317.465 7fce417c5000-7fce417d1000 rw-p 00000000 00:00 0 
 21055:20150630:075317.465 7fce417d3000-7fce417d4000 rw-p 00000000 00:00 0 
 21055:20150630:075317.465 7fce417d4000-7fce417d6000 rw-p 00000000 00:00 0 
 21055:20150630:075317.465 7fce417d6000-7fce417d8000 rw-p 00000000 00:00 0 
 21055:20150630:075317.465 7fce417d8000-7fce417d9000 r--p 0001f000 fd:00 658665                     /lib/x86_64-linux-gnu/ld-2.13.so
 21055:20150630:075317.465 7fce417d9000-7fce417da000 rw-p 00020000 fd:00 658665                     /lib/x86_64-linux-gnu/ld-2.13.so
 21055:20150630:075317.465 7fce417da000-7fce417db000 rw-p 00000000 00:00 0 
 21055:20150630:075317.465 7ffc2df14000-7ffc2df35000 rw-p 00000000 00:00 0                          [stack]
 21055:20150630:075317.465 7ffc2dfd7000-7ffc2dfd8000 r-xp 00000000 00:00 0                          [vdso]
 21055:20150630:075317.465 7ffc2dfd8000-7ffc2dfda000 r--p 00000000 00:00 0                          [vvar]
 21055:20150630:075317.465 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
 21055:20150630:075317.465 ================================
 21055:20150630:075317.465 Please consider attaching a disassembly listing to your bug report.
 21055:20150630:075317.465 This listing can be produced with, e.g., objdump -DSswx zabbix_agentd.
 21055:20150630:075317.465 ================================
 21052:20150630:075317.466 One child process died (PID:21055,exitcode/signal:1). Exiting ...
zabbix_agentd [21052]: Error on thread waiting.
 21052:20150630:075317.468 Zabbix Agent stopped. Zabbix 2.4.5 (revision 53282).
 21052:20150630:075317.474 /var/run/netns/: [2] No such file or directory
 21052:20150630:075317.474 uninitialization failed 

Cannot create graph

Cannot create graph: graph with the same name "CPU utilization of foobar container" already exists.

Whenever a new container with the same name is discovered, it won't have the stacked graphs.

Unable to build debian Dockerfile

Build ends with following error:

cp: cannot stat `/root/Zabbix-Docker-Monitoring/src/modules/zabbix_module_docker/': No such file or directory
The command '/bin/sh -c apt-get update &&    apt-get --assume-yes install git subversion automake autoconf gcc make pkg-config &&    git clone https://github.com/monitoringartist/Zabbix-Docker-Monitoring &&    mkdir ~/zabbix/ &&    svn co svn://svn.zabbix.com/${ZABBIX_VERSION} ~/zabbix/ &&    cd ~/zabbix/ &&    ./bootstrap.sh  &&    ./configure --enable-agent  &&    cp -R ~/Zabbix-Docker-Monitoring/src/modules/zabbix_module_docker/ ~/zabbix/src/modules/  &&    cd ~/zabbix/src/modules/zabbix_module_docker &&    make' returned a non-zero code: 1

It's caused by ommited WORKDIR instruction - git clone command clones repository to / and all other commands expect it in /root. Adding of WORKDIR /root instruction to the Dockerfile before RUN instruction solves this.

Can't run on ubuntu 14.04

Zabbix 3.2.1 deb's, precompiled or compiled module, I get error:

10734:20170111:125709.899 Starting Zabbix Agent [host.prod]. Zabbix 3.2.1 (revision 62890). 10734:20170111:125709.899 **** Enabled features **** 10734:20170111:125709.899 IPv6 support: YES 10734:20170111:125709.899 TLS support: YES 10734:20170111:125709.899 ************************** 10734:20170111:125709.899 using configuration file: /etc/zabbix/zabbix_agentd.conf 10734:20170111:125709.900 cannot load module "zabbix_module_docker.so": /usr/lib/zabbix/modules/zabbix_module_docker.so: **undefined symbol: zbx_alarm_timed_out** 10734:20170111:125709.900 loading modules failed, exiting...

[Discovery] Group prototypes

Hello,
I need to create group prototype with the hostname of each container agent.
Is it possible to do that by using macros like {#HOST.NAME} ?
I'm working on it for few hours and... nothing for now.
Thanks

unsupported module "zabbix_module_docker.so" version: 1

Hello

The module wont load since 3.2

19198:20160926:141504.448 Starting Zabbix Agent [raaabbb]. Zabbix 3.2.0 (revision 62485).
19198:20160926:141504.448 **** Enabled features ****
19198:20160926:141504.448 IPv6 support: YES
19198:20160926:141504.448 TLS support: YES
19198:20160926:141504.448 **************************
19198:20160926:141504.448 using configuration file: /etc/zabbix/zabbix_agentd.conf
19198:20160926:141504.448 unsupported module "zabbix_module_docker.so" version: 1
19198:20160926:141504.448 loading modules failed, exiting...

[14:18:24] root@raaabbb - /usr/lib/modules> ls -l /usr/lib/modules/zabbix_module_docker.so
-rw-r--r-- 1 root root 86567 26 sept. 14:10 /usr/lib/modules/zabbix_module_docker.so

[14:19:39] root@raaabbb - /usr/lib/modules> md5sum /usr/lib/modules/zabbix_module_docker.so
da4de4b955d7aa46524c770f36ff20b1 /usr/lib/modules/zabbix_module_docker.so

[14:19:46] root@raaabbb - /usr/lib/modules> uname -a
Linux raaabbb 4.7.4-1-ARCH #1 SMP PREEMPT Thu Sep 15 15:24:29 CEST 2016 x86_64 GNU/Linux

[14:19:52] root@raaabbb - /usr/lib/modules> cat /etc/lsb-release
LSB_VERSION=1.4
DISTRIB_ID=Arch
DISTRIB_RELEASE=rolling
DISTRIB_DESCRIPTION="Arch Linux"

for debian

uname -a:
Linux 3.16.0-4-amd64 SMP Debian 3.16.7-ckt4-3 (2015-02-03) x86_64 GNU/Linux

// found line e.g. cgroup /cgroup/cpuacct cgroup rw,relatime,cpuacct 0 0
For debian line is:
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0

full list:

rootfs / rootfs rw 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
udev /dev devtmpfs rw,relatime,size=10240k,nr_inodes=255186,mode=755 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,relatime,size=411720k,mode=755 0 0
/dev/disk/by-uuid/9a7fd20b-faed-4c65-b8cb-f7efc38ce27a / ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd 0 0
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=21,pgrp=1,timeout=300,minproto=5,maxproto=5,direct 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
/dev/disk/by-uuid/9a7fd20b-faed-4c65-b8cb-f7efc38ce27a /var/lib/docker/aufs ext4 rw,relatime,errors=remount-ro,data=ordered 0 0
none /var/lib/docker/aufs/mnt/127eab9c9f85d11f68aaaec76f536b3d04b4d6f7d4893111bd2a65218b7ef24a aufs rw,relatime,si=c0061a75a25ac11e 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,relatime 0 0
none /var/lib/docker/aufs/mnt/375d7627e9922a6a3a0bb31ca660381dadf84c02aade2ee0f3061daabf577a04 aufs rw,relatime,si=c0061a75a24e611e 0 0
none /var/lib/docker/aufs/mnt/a23110ea8ca5a42194968a7190ffb55afd6b92c1954262d7becb821a0148cc5e aufs rw,relatime,si=c0061a75dcd7e11e 0 0

Building module on Debian Wheezy/7

To build this module on debian wheezy you have to be sure that following package is installed in the system

sudo apt-get install libxml2-dev

also add

-I/usr/include/libxml2

key to Makefile.

I'm not sure where to put this information.

Use container name instead of id in item keys?

Hi Jan,

I just realised my Zabbix monitoring setup has a certain 'downside', which I try to describe it in short:

Most items use the the full container ID to identify a container. If I recreate a container, this ID will change of course. Zabbix will show up the new items once it has discovered the "new" container, and the old items referring to the former container id will receive no data anymore. I have a graph instance as part of a Zabbix screen, and upon container recreation, it still traces the old container and gets deleted after the "keep" period defined in the discovery rule...

What do you think about putting the container name into all item keys instead of the id? Docker enforces the container name to be unique. That way, item, trigger and graph instances would survive container recreations.

I have some doubts that taking the sole name might not be desirable for scaled containers (but they would cause dozens of trigger events as well...), what do you think? Do you have the same 'problem' or is it bound to my specific use case? :-)

Cheers,
Franz

a problem about running zabbix_agentd in docker container to monitor all the containers on the host machine

I made some customizations to enable zabbix_agent (load zabbix-docker-monitoring module) run inside the container , and let it collect discovery/cupacct/memory/xnet infos of all containers running on the host. My customized repos are zabbix-docker-agent and Zabbix-Docker-Monitoring. When I run (f2a87 is my cid which is running)

zabbix_get -s 139.162.9.105 -p 10050 -k "docker.xnet[f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047, eth0, RX-OK]"

zabbix-agent container crashed with the following error:

    33:20151219:100409.441 Translating container name to fci by using docker.inspect
    33:20151219:100409.441 In zbx_module_docker_inspect_exec()
    33:20151219:100409.441 In zbx_module_docker_socket_query()
    33:20151219:100409.441 Docker's socket query: GET /containers/f2a87d26b503/json HTTP/1.0
    33:20151219:100409.442 Docker's socket response: {"Id":"f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047","Created":"2015-12-15T08:06:27.814308898Z","Path":"/usr/local/bin/ssserver","Args":["-s","0.0.0.0","-p","1984","-k","CloudDream008","-m","aes-256-cfb"],"State":{"Status":"running","Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":17285,"ExitCode":0,"Error":"","StartedAt":"2015-12-16T09:47:01.294607061Z","FinishedAt":"2015-12-16T09:46:31.92551985Z"},"Image":"110f3efe7d2dd895b508aa764ac14fe15fa19d53809ab09ab7b01eb290f0c4b4","ResolvConfPath":"/var/lib/docker/containers/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/resolv.conf","HostnamePath":"/var/lib/docker/containers/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/hostname","HostsPath":"/var/lib/docker/containers/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/hosts","LogPath":"/var/lib/docker/containers/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047-json.log","Name":"/insane_ardinghelli","RestartCount":0,"Driver":"devicemapper","ExecDriver":"native-0.2","MountLabel":"","ProcessLabel":"","AppArmorProfile":"","ExecIDs":null,"HostConfig":{"Binds":null,"ContainerIDFile":"","LxcConf":[],"Memory":0,"MemoryReservation":0,"MemorySwap":0,"KernelMemory":0,"CpuShares":0,"CpuPeriod":0,"CpusetCpus":"","CpusetMems":"","CpuQuota":0,"BlkioWeight":0,"OomKillDisable":false,"MemorySwappiness":-1,"Privileged":false,"PortBindings":{"1984/tcp":[{"HostIp":"","HostPort":"1984"}]},"Links":null,"PublishAllPorts":false,"Dns":[],"DnsOptions":[],"DnsSearch":[],"ExtraHosts":null,"VolumesFrom":null,"Devices":[],"NetworkMode":"default","IpcMode":"","PidMode":"","UTSMode":"","CapAdd":null,"CapDrop":null,"GroupAdd":null,"RestartPolicy":{"Name":"no","MaximumRetryCount":0},"SecurityOpt":null,"ReadonlyRootfs":false,"Ulimits":null,"LogConfig":{"Type":"json-file","Config":{}},"CgroupParent":"","ConsoleSize":[0,0],"VolumeDriver":""},"GraphDriver":{"Name":"devicemapper","Data":{"DeviceId":"11","DeviceName":"docker-8:0-57392-f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047","DeviceSize":"107374182400"}},"Mounts":[],"Config":{"Hostname":"f2a87d26b503","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"1984/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["-s","0.0.0.0","-p","1984","-k","CloudDream008","-m","aes-256-cfb"],"Image":"oddrationale/docker-shadowsocks","Volumes":null,"WorkingDir":"","Entrypoint":["/usr/local/bin/ssserver"],"OnBuild":null,"Labels":{}},"NetworkSettings":{"Bridge":"","SandboxID":"a4fc1bb8cee454fc79346730cc03f589c2c17b56d4772b86fc83eccbf9a06480","HairpinMode":false,"LinkLocalIPv6Address":"","LinkLocalIPv6PrefixLen":0,"Ports":{"1984/tcp":[{"HostIp":"0.0.0.0","HostPort":"1984"}]},"SandboxKey":"/var/run/docker/netns/a4fc1bb8cee4","SecondaryIPAddresses":null,"SecondaryIPv6Addresses":null,"EndpointID":"9a97f6592e6fd8cd07c6652829a2b6376da84656ba0b886d7002d7098526863c","Gateway":"172.17.42.1","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"IPAddress":"172.17.0.1","IPPrefixLen":16,"IPv6Gateway":"","MacAddress":"02:42:ac:11:00:01","Networks":{"bridge":{"EndpointID":"9a97f6592e6fd8cd07c6652829a2b6376da84656ba0b886d7002d7098526863c","Gateway":"172.17.42.1","IPAddress":"172.17.0.1","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:01"}}}}
    33:20151219:100409.442 Item [Id] found in the received JSON object: f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047
    33:20151219:100409.442 zbx_module_docker_inspect_exec OK: f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047
    33:20151219:100409.442 Metric source file: /docker/sys/fs/cgroup/cpuacct/docker/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/cpuacct.stat
    33:20151219:100409.442 Can open Docker container metric file: '/docker/sys/fs/cgroup/cpuacct/docker/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/cpuacct.stat', container is running
    33:20151219:100409.442 Sending back [1.000000]
    33:20151219:100409.442 listener #3 [waiting for connection]
    30:20151219:100409.791 collector [processing data]
    30:20151219:100409.791 In update_cpustats()
    30:20151219:100409.791 End of update_cpustats()
    30:20151219:100409.791 collector [idle 1 sec]
    34:20151219:100410.220 In send_buffer() host:'54.223.241.14' port:10051 values:0/100
    34:20151219:100410.220 End of send_buffer():SUCCEED
    34:20151219:100410.220 active checks #1 [idle 1 sec]
    30:20151219:100410.792 collector [processing data]
    30:20151219:100410.792 In update_cpustats()
    30:20151219:100410.793 End of update_cpustats()
    30:20151219:100410.793 collector [idle 1 sec]
    34:20151219:100411.221 In send_buffer() host:'54.223.241.14' port:10051 values:0/100
    34:20151219:100411.221 End of send_buffer():SUCCEED
    34:20151219:100411.221 active checks #1 [idle 1 sec]
    33:20151219:100411.641 listener #3 [processing request]
    33:20151219:100411.641 Requested [vfs.fs.inode[/usr/local/lib/zabbix/zabbix_module_docker.so,pfree]]
    33:20151219:100411.641 Sending back [92.261449]
    33:20151219:100411.641 listener #3 [waiting for connection]
    30:20151219:100411.793 collector [processing data]
    30:20151219:100411.794 In update_cpustats()
    30:20151219:100411.795 End of update_cpustats()
    30:20151219:100411.795 collector [idle 1 sec]
    34:20151219:100412.221 In send_buffer() host:'54.223.241.14' port:10051 values:0/100
    34:20151219:100412.221 End of send_buffer():SUCCEED
    34:20151219:100412.221 active checks #1 [idle 1 sec]
    33:20151219:100412.666 listener #3 [processing request]
    33:20151219:100412.666 Requested [proc.num[,,run]]
    33:20151219:100412.667 Sending back [1]
    33:20151219:100412.667 listener #3 [waiting for connection]
    30:20151219:100412.795 collector [processing data]
    30:20151219:100412.796 In update_cpustats()
    30:20151219:100412.796 End of update_cpustats()
    30:20151219:100412.796 collector [idle 1 sec]
    31:20151219:100412.881 listener #1 [processing request]
    31:20151219:100412.881 Requested [vfs.fs.size[/usr/local/lib/zabbix/zabbix_module_docker.so,free]]
    31:20151219:100412.881 Sending back [10500108288]
    31:20151219:100412.881 listener #1 [waiting for connection]
    32:20151219:100413.106 listener #2 [processing request]
    34:20151219:100413.221 In send_buffer() host:'54.223.241.14' port:10051 values:0/100
    34:20151219:100413.221 End of send_buffer():SUCCEED
    34:20151219:100413.221 active checks #1 [idle 1 sec]
    32:20151219:100413.229 Requested [docker.xnet[f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047, eth0, RX-OK]]
    32:20151219:100413.229 In zbx_module_docker_net()
    32:20151219:100413.229 In zbx_module_docker_get_fci()
    32:20151219:100413.229 Original full container id will be used
    32:20151219:100413.229 netns file: /var/run/netns/zabbix_module_docker_f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047
    32:20151219:100413.229 Tasks file: /docker/sys/fs/cgroup/devices/docker/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/tasks
    32:20151219:100413.229 Trying to open filename2: /docker/sys/fs/cgroup/devices/docker/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/tasks
    32:20151219:100413.229 Succeed to open filename2: /docker/sys/fs/cgroup/devices/docker/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/tasks
    32:20151219:100413.229 Shall calculate filename_size, according to first_task:(null)
    32:20151219:100413.229 Got signal [signal:11(SIGSEGV),reason:1,refaddr:(nil)]. Crashing ...
    32:20151219:100413.229 ====== Fatal information: ======
    32:20151219:100413.229 Program counter: 0x7f499ba25aea
    32:20151219:100413.229 === Registers: ===
    32:20151219:100413.229 r8      =          1179140 =             18321728 =             18321728
    32:20151219:100413.229 r9      =     7f499bd5b7b8 =      139954123814840 =      139954123814840
    32:20151219:100413.229 r10     =     7f499bd5b7b8 =      139954123814840 =      139954123814840
    32:20151219:100413.229 r11     =              202 =                  514 =                  514
    32:20151219:100413.229 r12     =     7ffc8683a7c0 =      140722565261248 =      140722565261248
    32:20151219:100413.229 r13     =                0 =                    0 =                    0
    32:20151219:100413.229 r14     =                0 =                    0 =                    0
    32:20151219:100413.229 r15     =                0 =                    0 =                    0
    32:20151219:100413.229 rdi     =                0 =                    0 =                    0
    32:20151219:100413.229 rsi     =     7ffc86829320 =      140722565190432 =      140722565190432
    32:20151219:100413.229 rbp     =     7ffc86839ec0 =      140722565258944 =      140722565258944
    32:20151219:100413.229 rbx     =               65 =                  101 =                  101
    32:20151219:100413.229 rdx     =                1 =                    1 =                    1
    32:20151219:100413.229 rax     =                0 =                    0 =                    0
    32:20151219:100413.229 rcx     =                0 =                    0 =                    0
    32:20151219:100413.230 rsp     =     7ffc86839568 =      140722565256552 =      140722565256552
    32:20151219:100413.230 rip     =     7f499ba25aea =      139954120448746 =      139954120448746
    32:20151219:100413.230 efl     =            10293 =                66195 =                66195
    32:20151219:100413.230 csgsfs  =   2b000000000033 =    12103423998558259 =    12103423998558259
    32:20151219:100413.230 err     =                4 =                    4 =                    4
    32:20151219:100413.230 trapno  =                e =                   14 =                   14
    32:20151219:100413.230 oldmask =                0 =                    0 =                    0
    32:20151219:100413.230 cr2     =                0 =                    0 =                    0
    32:20151219:100413.230 === Backtrace: ===
    32:20151219:100413.231 12: zabbix_agentd: listener #2 [processing request](print_fatal_info+0xae) [0x424cae]
    32:20151219:100413.231 11: zabbix_agentd: listener #2 [processing request]() [0x424f17]
    32:20151219:100413.231 10: /lib/x86_64-linux-gnu/libc.so.6(+0x36d40) [0x7f499b9d3d40]
    32:20151219:100413.231 9: /lib/x86_64-linux-gnu/libc.so.6(strlen+0x2a) [0x7f499ba25aea]
    32:20151219:100413.231 8: /usr/local/lib/zabbix/zabbix_module_docker.so(zbx_module_docker_net+0x70d) [0x7f499b795550]
    32:20151219:100413.231 7: zabbix_agentd: listener #2 [processing request](process+0x35b) [0x412e8b]
    32:20151219:100413.231 6: zabbix_agentd: listener #2 [processing request](listener_thread+0x1ae) [0x411f2e]
    32:20151219:100413.231 5: zabbix_agentd: listener #2 [processing request](zbx_thread_start+0x45) [0x4238d5]
    32:20151219:100413.231 4: zabbix_agentd: listener #2 [processing request](MAIN_ZABBIX_ENTRY+0x1c6) [0x411a56]
    32:20151219:100413.231 3: zabbix_agentd: listener #2 [processing request](daemon_start+0x106) [0x424506]
    32:20151219:100413.231 2: zabbix_agentd: listener #2 [processing request](main+0x21f) [0x40a97f]
    32:20151219:100413.231 1: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7f499b9beec5]
    32:20151219:100413.231 0: zabbix_agentd: listener #2 [processing request]() [0x40a9eb]
    32:20151219:100413.231 === Memory map: ===
    32:20151219:100413.231 00400000-00447000 r-xp 00000000 fb:02 5247709                            /usr/local/sbin/zabbix_agentd
    32:20151219:100413.232 00646000-00647000 r--p 00046000 fb:02 5247709                            /usr/local/sbin/zabbix_agentd
    32:20151219:100413.232 00647000-00649000 rw-p 00047000 fb:02 5247709                            /usr/local/sbin/zabbix_agentd
    32:20151219:100413.232 00649000-0064e000 rw-p 00000000 00:00 0 
    32:20151219:100413.232 01176000-01197000 rw-p 00000000 00:00 0                                  [heap]
    32:20151219:100413.232 7f499b576000-7f499b58c000 r-xp 00000000 fb:02 5243821                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    32:20151219:100413.232 7f499b58c000-7f499b78b000 ---p 00016000 fb:02 5243821                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    32:20151219:100413.232 7f499b78b000-7f499b78c000 rw-p 00015000 fb:02 5243821                    /lib/x86_64-linux-gnu/libgcc_s.so.1
    32:20151219:100413.232 7f499b78c000-7f499b79c000 r-xp 00000000 08:00 426690                     /usr/local/lib/zabbix/zabbix_module_docker.so
    32:20151219:100413.232 7f499b79c000-7f499b99b000 ---p 00010000 08:00 426690                     /usr/local/lib/zabbix/zabbix_module_docker.so
    32:20151219:100413.232 7f499b99b000-7f499b99c000 r--p 0000f000 08:00 426690                     /usr/local/lib/zabbix/zabbix_module_docker.so
    32:20151219:100413.232 7f499b99c000-7f499b99d000 rw-p 00010000 08:00 426690                     /usr/local/lib/zabbix/zabbix_module_docker.so
    32:20151219:100413.232 7f499b99d000-7f499bb58000 r-xp 00000000 fb:02 5243797                    /lib/x86_64-linux-gnu/libc-2.19.so
    32:20151219:100413.232 7f499bb58000-7f499bd57000 ---p 001bb000 fb:02 5243797                    /lib/x86_64-linux-gnu/libc-2.19.so
    32:20151219:100413.232 7f499bd57000-7f499bd5b000 r--p 001ba000 fb:02 5243797                    /lib/x86_64-linux-gnu/libc-2.19.so
    32:20151219:100413.232 7f499bd5b000-7f499bd5d000 rw-p 001be000 fb:02 5243797                    /lib/x86_64-linux-gnu/libc-2.19.so
    32:20151219:100413.232 7f499bd5d000-7f499bd62000 rw-p 00000000 00:00 0 
    32:20151219:100413.232 7f499bd62000-7f499bd79000 r-xp 00000000 fb:02 5243891                    /lib/x86_64-linux-gnu/libresolv-2.19.so
    32:20151219:100413.232 7f499bd79000-7f499bf79000 ---p 00017000 fb:02 5243891                    /lib/x86_64-linux-gnu/libresolv-2.19.so
    32:20151219:100413.232 7f499bf79000-7f499bf7a000 r--p 00017000 fb:02 5243891                    /lib/x86_64-linux-gnu/libresolv-2.19.so
    32:20151219:100413.232 7f499bf7a000-7f499bf7b000 rw-p 00018000 fb:02 5243891                    /lib/x86_64-linux-gnu/libresolv-2.19.so
    32:20151219:100413.232 7f499bf7b000-7f499bf7d000 rw-p 00000000 00:00 0 
    32:20151219:100413.232 7f499bf7d000-7f499bf80000 r-xp 00000000 fb:02 5243813                    /lib/x86_64-linux-gnu/libdl-2.19.so
    32:20151219:100413.232 7f499bf80000-7f499c17f000 ---p 00003000 fb:02 5243813                    /lib/x86_64-linux-gnu/libdl-2.19.so
    32:20151219:100413.232 7f499c17f000-7f499c180000 r--p 00002000 fb:02 5243813                    /lib/x86_64-linux-gnu/libdl-2.19.so
    32:20151219:100413.232 7f499c180000-7f499c181000 rw-p 00003000 fb:02 5243813                    /lib/x86_64-linux-gnu/libdl-2.19.so
    32:20151219:100413.232 7f499c181000-7f499c1a4000 r-xp 00000000 fb:02 5243777                    /lib/x86_64-linux-gnu/ld-2.19.so
    32:20151219:100413.232 7f499c37e000-7f499c39b000 rw-s 00000000 00:05 0                          /SYSV6c02114e (deleted)
    32:20151219:100413.232 7f499c39b000-7f499c39e000 rw-p 00000000 00:00 0 
    32:20151219:100413.232 7f499c39f000-7f499c3a0000 rw-p 00000000 00:00 0 
    32:20151219:100413.232 7f499c3a0000-7f499c3a3000 rw-p 00000000 00:00 0 
    32:20151219:100413.232 7f499c3a3000-7f499c3a4000 r--p 00022000 fb:02 5243777                    /lib/x86_64-linux-gnu/ld-2.19.so
    32:20151219:100413.232 7f499c3a4000-7f499c3a5000 rw-p 00023000 fb:02 5243777                    /lib/x86_64-linux-gnu/ld-2.19.so
    32:20151219:100413.232 7f499c3a5000-7f499c3a6000 rw-p 00000000 00:00 0 
    32:20151219:100413.232 7ffc8681c000-7ffc8683d000 rw-p 00000000 00:00 0                          [stack]
    32:20151219:100413.232 7ffc8698b000-7ffc8698d000 r--p 00000000 00:00 0                          [vvar]
    32:20151219:100413.232 7ffc8698d000-7ffc8698f000 r-xp 00000000 00:00 0                          [vdso]
    32:20151219:100413.232 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
    32:20151219:100413.232 ================================
    32:20151219:100413.232 Please consider attaching a disassembly listing to your bug report.
    32:20151219:100413.232 This listing can be produced with, e.g., objdump -DSswx zabbix_agentd.
    32:20151219:100413.232 ================================
    29:20151219:100413.232 One child process died (PID:32,exitcode/signal:1). Exiting ...
    29:20151219:100413.232 zbx_on_exit() called
    33:20151219:100413.232 Got signal [signal:15(SIGTERM),sender_pid:29,sender_uid:0,reason:0]. Exiting ...
    31:20151219:100413.233 Got signal [signal:15(SIGTERM),sender_pid:29,sender_uid:0,reason:0]. Exiting ...
    34:20151219:100413.233 Got signal [signal:15(SIGTERM),sender_pid:29,sender_uid:0,reason:0]. Exiting ...
    30:20151219:100413.234 Got signal [signal:15(SIGTERM),sender_pid:29,sender_uid:0,reason:0]. Exiting ...
root@localhost:~/zabbix24/src/modules/zabbix_module_docker# 

Then I checked the "tasks" file in the host machine and inside the container, the output is as following (the data is different!!!):

root@localhost:~/zabbix24/src/modules/zabbix_module_docker# cat /sys/fs/cgroup/devices/docker/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/tasks   17285
root@localhost:~/zabbix24/src/modules/zabbix_module_docker# docker exec -it agent-debug /bin/bash                                                                   
root@localhost:/# cat /docker/sys/fs/cgroup/devices/docker/f2a87d26b503930d474330433bbcdee9fe4d2d19e55fbb32f3f634eeb4f8c047/tasks
root@localhost:/# 

While I run "zabbix_agentd" (with Zabbix_docker_module loaded) directly on the host machine, everything goes right. My guess is: /sys is saved in memory in the appearance of disk, zabbix_agentd inside docker container does not have write access to the "tasks" file. So if there is a way for the zabbix_agentd to read the /sys data directly and do not write data into it. Please help, thanks

Can't detect docker stat directory

Hello,

Hope you find the time to improve this.

I have problem to make it run with zabbix 2.2.6 and docker 1.2.0 on Ubuntu 14.04. The error I'm seeing on the log file is:

3363:20140913:083549.992 Starting Zabbix Agent [dockerdev.str5.net]. Zabbix 2.2.6 (revision 48483).
3363:20140913:083549.992 using configuration file: /etc/zabbix/zabbix_agentd.conf
3363:20140913:083549.992 Can't detect docker stat directory
3363:20140913:083549.992 cannot initialize module "zabbix_module_docker.so"
3363:20140913:083549.992 loading modules failed, exiting...

Any hints?

Regards,
Stratos.

Zabbix wont start correctly

There is a problem happening when zabbix is trying to start up after a reboot. A restart of zabbix after boot manually fixes solves the problem. So this is only happening on boot.

I sat the zabbix-agent debug log to 4, and this is what was in the log;

  • Woulnt start, had zabbix-docker-monitoring enabled
1381:20151209:225333.348 Starting Zabbix Agent [d3]. Zabbix 2.4.7 (revision 56694).
1381:20151209:225333.348 using configuration file: /etc/zabbix/zabbix_agentd.conf
1381:20151209:225333.348 In load_modules()
1381:20151209:225333.348 loading module "/usr/local/lib/zabbix/agent//zabbix_module_docker.so"
1381:20151209:225333.348 In zbx_module_api_version()
1381:20151209:225333.348 In zbx_module_init()
1381:20151209:225333.348 zabbix_module_docker v0.5.0, compilation time: Dec  2 2015 22:39:38
1381:20151209:225333.348 In zbx_docker_dir_detect()
1381:20151209:225333.349 Detected docker stat directory: /sys/fs/cgroup/
1381:20151209:225333.349 Cannot detect used docker driver
1381:20151209:225333.349 In zbx_module_docker_socket_query()
1381:20151209:225333.349 Docker's socket query: GET /_ping HTTP/1.0
.... hangs here ....
  • Disabling the module, this is what happened
1384:20151209:225916.324 Starting Zabbix Agent [d3]. Zabbix 2.4.7 (revision 56694).
1384:20151209:225916.324 using configuration file: /etc/zabbix/zabbix_agentd.conf
1384:20151209:225916.324 In load_modules()
1384:20151209:225916.324 End of load_modules():SUCCEED
1384:20151209:225916.324 In init_collector_data()
1384:20151209:225916.324 End of init_collector_data()
1384:20151209:225916.324 agent #0 started [main process]
1388:20151209:225916.325 agent #3 started [listener #2]
1388:20151209:225916.325 listener #2 [waiting for connection]
1390:20151209:225916.325 agent #5 started [active checks #1]
1389:20151209:225916.325 agent #4 started [listener #3]
1390:20151209:225916.326 In init_active_metrics()
1387:20151209:225916.326 agent #2 started [listener #1]
1389:20151209:225916.326 listener #3 [waiting for connection]
1390:20151209:225916.326 buffer: first allocation for 100 elements
.... full start, a lot of output ....

The only zabbix proccess that is able to start when the module is enabled is /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf. Running strace -p ... on it only displays read(4,.

When the module is not enabled, these proccesses are able to start;

/usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
/usr/sbin/zabbix_agentd: collector [idle 1 sec]
/usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
/usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
/usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
/usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

It's almost like the module doesn't report back to zabbix that it is done loading and zabbix can continue.

If I do systemctl restart zabbix when the system is up, zabbix is able to start, even with the plugin loaded.

Env:

  • Centos 7
  • zabbix-agent-2.4.7-1.el7.x86_64
  • selinux states; tried both enforcing and permissive

Zabbix Agent on start up, the logs don't show libzbxpgsql.so module

Hi Jan,

I have setup zabbix agent using a docker . The container starts up fine. however need to monitor PostgreSQL which too is a container on Docker .
I made config changes to zabbix_agentd.conf file and provided the load module path as well as load module name in that conf file.

However on starting of Zabbix agent process in the container, it does not load that PostgreSQL module, result I am not able to monitor the db processes using the Zabbix agent.

Here's the snippet of that log

 8:20160614:001116.170 Starting Zabbix Agent [xx.xx.xx.xx] Zabbix 3.0.3 XXL (2016-05-29) (revision {ZABBIX_REVISION}).
 8:20160614:001116.170 **** Enabled features ****
 8:20160614:001116.170 IPv6 support:          YES
 8:20160614:001116.170 TLS support:           YES
 8:20160614:001116.170 **************************
 8:20160614:001116.170 using configuration file: /etc/zabbix/zabbix_agentd.conf
 8:20160614:001116.173 loaded modules: zabbix_module_docker.so, zabbix_module_stress.so
 8:20160614:001116.173 agent #0 started [main process]
12:20160614:001116.174 agent #4 started [listener #3]
 9:20160614:001116.175 agent #1 started [collector]
10:20160614:001116.176 agent #2 started [listener #1]
11:20160614:001116.177 agent #3 started [listener #2]

This was the command run
docker run --name=zabbix-agent_test -h hostname -p 10050:10050 -v /:/rootfs -e "ZA_Server=xx.xx.xx.xx" -d monitoringartist/zabbix-agent-xxl-limited:latest

ZBX_NOTSUPPORTED: Docker's socket API is not avalaible

It doesn't work

root@admin1-VirtualBox:~# zabbix_get -s 127.0.0.1  -k docker.info[info]
ZBX_NOTSUPPORTED: Docker's socket API is not avalaible
root@admin1-VirtualBox:~# echo -e "GET /containers/json?all=0 HTTP/1.0\r\n" | nc -U /var/run/docker.sock
HTTP/1.0 200 OK
Content-Type: application/json
Server: Docker/1.12.1 (linux)
Date: Mon, 10 Oct 2016 14:47:45 GMT

[{"Id":"546d2e0d6f978e62a78a56974697af44f3fa48492d3b8a1e84167ac12678ca3b","Names":["/shipyard-proxy"],"Image":"shipyard/docker-proxy:latest","ImageID":"sha256:cfee14e5d6f280892b9fb16e830aae5c9458e61a7502048ac45b6b1723e8b0b9","Command":"/usr/local/bin/run","Created":1476099299,"Ports":[{"IP":"0.0.0.0","PrivatePort":2375,"PublicPort":2375,"Type":"tcp"}],"Labels":{},"State":"running","Status":"Up 3 hours","HostConfig":{"NetworkMode":"default"},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"6871dbb0e5a930e8f7811d10d2c544d0e23ad6929b1a68614b25d2428a4d6bd4","EndpointID":"a012b54196b5f5f914f891209ef001411c6b120a8c63d21e2b36fb1cbf473251","Gateway":"172.17.0.1","IPAddress":"172.17.0.7","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:07"}}},"Mounts":[{"Source":"/var/run/docker.sock","Destination":"/var/run/docker.sock","Mode":"","RW":true,"Propagation":"rprivate"}]},{"Id":"6746ab65f5885e1e4a6e088ec30e4b63301c5efee796ee6525c88c8db92db34a","Names":["/swarm-agent"],"Image":"swarm:latest","ImageID":"sha256:942fd5fd357e2fe2fcecbaf3dd77c313f22ce18a84a5a4d288c0df407a61e623","Command":"/swarm join --addr 10.25.14.152:2375 consul://10.25.14.152:8500","Created":1476099248,"Ports":[{"PrivatePort":2375,"Type":"tcp"}],"Labels":{},"State":"running","Status":"Up 3 hours","HostConfig":{"NetworkMode":"default"},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"6871dbb0e5a930e8f7811d10d2c544d0e23ad6929b1a68614b25d2428a4d6bd4","EndpointID":"b61115b79474165b101a7fedcd360644700e63d60c7f9fafde3a9284eab6fc84","Gateway":"172.17.0.1","IPAddress":"172.17.0.3","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:03"}}},"Mounts":[{"Name":"8e237f411f83907fb6e3d5a643fc814cf31c952eb40ca017eca5d1bb119bfe4f","Source":"/var/lib/docker/volumes/8e237f411f83907fb6e3d5a643fc814cf31c952eb40ca017eca5d1bb119bfe4f/_data","Destination":"/.swarm","Driver":"local","Mode":"","RW":true,"Propagation":""}]},{"Id":"b0e95ada12d56940d58ef8e4a0574436dbf8f40710d891594b2114cc85ec8e41","Names":["/shipyard-controller"],"Image":"shipyard/shipyard:latest","ImageID":"sha256:36fb3dc0907d7cdf5536e7f5e5f8aae6763e0dda7e0e3441bdb5b71043d2f250","Command":"/bin/controller server -d tcp://10.25.14.152:3375","Created":1476099170,"Ports":[{"IP":"0.0.0.0","PrivatePort":8080,"PublicPort":8080,"Type":"tcp"}],"Labels":{},"State":"running","Status":"Up 3 hours","HostConfig":{"NetworkMode":"default"},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"6871dbb0e5a930e8f7811d10d2c544d0e23ad6929b1a68614b25d2428a4d6bd4","EndpointID":"fb72a3ab39be0b8e70eac6e5d1d809f4ca7524a4ed6470df615b1439694a5fee","Gateway":"172.17.0.1","IPAddress":"172.17.0.6","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:06"}}},"Mounts":[]},{"Id":"8a3e55093f47cb35bcee0b87af666223d778d511ba1ba138bd8b77559014f666","Names":["/shipyard-rethinkdb","/shipyard-controller/rethinkdb"],"Image":"rethinkdb","ImageID":"sha256:d10cc6435528da5d3018dd5dd65768fb01b5be930e53e225cd39ed126b00f3bc","Command":"rethinkdb --bind all","Created":1476099167,"Ports":[{"PrivatePort":28015,"Type":"tcp"},{"PrivatePort":8080,"Type":"tcp"},{"PrivatePort":29015,"Type":"tcp"}],"Labels":{},"State":"running","Status":"Up 3 hours","HostConfig":{"NetworkMode":"default"},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"6871dbb0e5a930e8f7811d10d2c544d0e23ad6929b1a68614b25d2428a4d6bd4","EndpointID":"b2d508160f39f026abd052062f95c27e56b7f092358edd29aba4aaf6207e9224","Gateway":"172.17.0.1","IPAddress":"172.17.0.5","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:05"}}},"Mounts":[{"Name":"da89f95e128f0d1932f0e79c565a6d7db4a9ab8e89d5046e79a9ed066c47c273","Source":"/var/lib/docker/volumes/da89f95e128f0d1932f0e79c565a6d7db4a9ab8e89d5046e79a9ed066c47c273/_data","Destination":"/data","Driver":"local","Mode":"","RW":true,"Propagation":""}]},{"Id":"fcc964a9bb375f2a513373c49a7ae60380b6e0fc02f9592d0d9ca60bc083c663","Names":["/swarm-manager","/shipyard-controller/swarm"],"Image":"swarm:latest","ImageID":"sha256:942fd5fd357e2fe2fcecbaf3dd77c313f22ce18a84a5a4d288c0df407a61e623","Command":"/swarm manage --host tcp://0.0.0.0:3375 consul://10.25.14.152:8500","Created":1476099124,"Ports":[{"IP":"0.0.0.0","PrivatePort":3375,"PublicPort":3375,"Type":"tcp"},{"PrivatePort":2375,"Type":"tcp"}],"Labels":{},"State":"running","Status":"Up 3 hours","HostConfig":{"NetworkMode":"default"},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"6871dbb0e5a930e8f7811d10d2c544d0e23ad6929b1a68614b25d2428a4d6bd4","EndpointID":"5dea8565b3d4b3c4b86d4c842ddca3b50485dc7d09944c86f151e9da69899323","Gateway":"172.17.0.1","IPAddress":"172.17.0.4","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:04"}}},"Mounts":[{"Name":"b43577308881597a353a4f372375f32e289186f1b2822a1b94853d882d8b9e72","Source":"/var/lib/docker/volumes/b43577308881597a353a4f372375f32e289186f1b2822a1b94853d882d8b9e72/_data","Destination":"/.swarm","Driver":"local","Mode":"","RW":true,"Propagation":""}]},{"Id":"1fe4fe89357ddd701a09eb43bb3c7a67618e4c2fd6b7027a154f07fd99568d1b","Names":["/consul"],"Image":"progrium/consul","ImageID":"sha256:09ea64205e553163a9d7790c9688cff73e3dc2439a8382021a2b2223545f01ff","Command":"/bin/start -server -bootstrap","Created":1476099099,"Ports":[{"PrivatePort":8300,"Type":"tcp"},{"PrivatePort":53,"Type":"tcp"},{"IP":"0.0.0.0","PrivatePort":8500,"PublicPort":8500,"Type":"tcp"},{"PrivatePort":8400,"Type":"tcp"},{"PrivatePort":8302,"Type":"tcp"},{"PrivatePort":8301,"Type":"tcp"},{"PrivatePort":8302,"Type":"udp"},{"PrivatePort":8301,"Type":"udp"},{"PrivatePort":53,"Type":"udp"}],"Labels":{},"State":"running","Status":"Up 3 hours","HostConfig":{"NetworkMode":"default"},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"NetworkID":"6871dbb0e5a930e8f7811d10d2c544d0e23ad6929b1a68614b25d2428a4d6bd4","EndpointID":"95a7f2fa149949793ae4fcfd7b1de7f0ab822a28d74fbb54f7e22d2b5695c7c6","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}}},"Mounts":[{"Name":"8d90c1bbebe7642c0e4e4a209092772322677eddba07ee214384ed497190940d","Source":"/var/lib/docker/volumes/8d90c1bbebe7642c0e4e4a209092772322677eddba07ee214384ed497190940d/_data","Destination":"/data","Driver":"local","Mode":"","RW":true,"Propagation":""}]}]
root@admin1-VirtualBox:~# uname -a
Linux admin1-VirtualBox 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
root@admin1-VirtualBox:~# docker -v
Docker version 1.12.1, build 23cf638
root@admin1-VirtualBox:~# zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 3.0.5
Revision 62889 30 September 2016, compilation time: Oct  2 2016 16:05:32

Copyright (C) 2016 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.

I can't find issue, please help me

better release management

Hello

Could we have a small changelog with every release

Possibly a more verbose description of the module version being loaded in the zabbix agent logs, to know if it s worth or not updating it ?
Like : docker_module v2.1 for zabbix 3.0 64b

Bytes counter with docker.xnet items

Hello,

docker.xnet uses "netstat -i" which does not provide bytes counter. Bytes could be fetched by using something like "ip -s link". Do you plan to add support for bytes counter?

Another question - since docker.xnet invokes ip exec for each item do you think it is better to use stats for network statistics?

Thanks in advance,
emir

Module is trying to pull info from a docker container that doesn't exist

I am using Zabbix to monitor docker containers for Mesos. There are three healthy containers that are reporting correctly, but there is a fourth one listed on the display even though only 3 containers exist.

I looked into the logs and these are the errors each time the information is pulled for the 4th non-existent-mystery container:
4469:20151029:133848.468 Cannot open Docker container metric file: '/sys/fs/cgroup/cpu,cpuacct/system.slice/docker-system.slice.scope/cpuacct.stat' 4469:20151029:133848.468 active check "docker.cpu[system.slice,system]" is not supported 4469:20151029:133848.468 Cannot open Docker container metric file: '/sys/fs/cgroup/cpu,cpuacct/system.slice/docker-system.slice.scope/cpuacct.stat' 4469:20151029:133848.468 active check "docker.cpu[system.slice,user]" is not supported 4469:20151029:133848.468 Cannot open Docker container metric file: '/sys/fs/cgroup/memory/system.slice/docker-system.slice.scope/memory.stat' 4469:20151029:133848.468 active check "docker.mem[system.slice,total_cache]" is not supported 4469:20151029:133848.469 Cannot open Docker container metric file: '/sys/fs/cgroup/memory/system.slice/docker-system.slice.scope/memory.stat' 4469:20151029:133848.469 active check "docker.mem[system.slice,total_rss]" is not supported 4469:20151029:133848.469 Cannot open Docker container metric file: '/sys/fs/cgroup/memory/system.slice/docker-system.slice.scope/memory.stat' 4469:20151029:133848.469 active check "docker.mem[system.slice,total_swap]" is not supported

From looking through the code in zabbix_module_docker.c, it looks like the container variable seems to be set to system.slice instead of an actual docker container id.

'/sys/fs/cgroup/memory/system.slice/docker-**system.slice**.scope/memory.stat'

In the zbx_module_docker_get_fci function that is getting the container value within zbx_module_docker_up function, it is only checking if it starts with a '/' not if the container id is a number.

` char* zbx_module_docker_get_fci(char *fci)
{
zabbix_log(LOG_LEVEL_DEBUG, "In zbx_module_docker_get_fci()");

    // if first character is '/', then detect fci
    if (fci[0] != '/')
    {
        zabbix_log(LOG_LEVEL_DEBUG, "Original full container id will be used");
        return zbx_strdup(NULL, fci);
    } `

container = zbx_module_docker_get_fci(get_rparam(request, 0));

So, the question:
Am I missing something? There were some docker containers that had failed earlier. Would that cause this kind of issue on our display?

screen shot 2015-10-29 at 4 26 33 pm

_this last entry is what I'm talking about ^^_

zbx_module_docker_up not working on debian

Hi, it looks like due to "memory accounting is not available by default on Debian 7" this function is not working. It always return 0.
I also suggest if it can't get a result it's better to return ZBX_NOTSUPPORTED.

Here is a part of log file related to this

21270:20150401:115000.489 In zbx_module_docker_up()
 21270:20150401:115000.489 Metric source file: /sys/fs/cgroup/memory/docker/879964bb231a85fb37517b46a5ab8938cec21fc76ab8d07076b92e7fee6339d8/memory.stat
 21270:20150401:115000.489 Can't open Docker container metric file: '/sys/fs/cgroup/memory/docker/879964bb231a85fb37517b46a5ab8938cec21fc76ab8d07076b92e7fee6339d8/memory.stat', cont
ainer doesn't run
 21270:20150401:115000.489 for key [docker.up[879964bb231a85fb37517b46a5ab8938cec21fc76ab8d07076b92e7fee6339d8]] received value [0.000000]
 21270:20150401:115000.489 In process_value() key:'hostname:docker.up[879964bb231a85fb37517b46a5ab8938cec21fc76ab8d07076b92e7fee6339d8]' value:'0.000000'

Require short docker container ID

Current :

    {
        "{#FCONTAINERID}": "20405e1ffe5c0a1373b1cd5e1d61eb6a263076ae521e0598e26e9db8376b108b",
        "{#HCONTAINERID}": "modest_albattani"
    },

Wish to have :

    {
        "{#FCONTAINERID}": "20405e1ffe5c0a1373b1cd5e1d61eb6a263076ae521e0598e26e9db8376b108b",
        "{#HCONTAINERID}": "modest_albattani",
        "{#SCONTAINERID}": "20405e1ffe5c"
    },

Module does not work with client (2.4.0).

When loading the module after building it the client fails with:
1601:20151006:131828.397 Starting Zabbix Agent [Zabbix server]. Zabbix 2.4.0 (revision 48953).
1601:20151006:131828.399 using configuration file: /etc/zabbix/zabbix_agentd.conf
1601:20151006:131828.400 cannot load module "zabbix_module_docker.so": /opt/zabbix/modules/zabbix_module_docker.so: undefined symbol: zbx_alias_get

The module has been build on the server it is deployed which is Ubuntu 14.04.3 server. Last patches installed. kernel: "Linux lotto-jenkins-docker-node 3.13.0-65-generic #105-Ubuntu SMP Mon Sep 21 18:50:58 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux "

agent crash after some time

OS: boot2docker
zabbix agent 2.2.10 build from sourcse code

docker version

  • Client version: 1.6.2
    Client API version: 1.18
    Go version (client): go1.4.2
    Git commit (client): 7c8fca2
    OS/Arch (client): linux/amd64
  • Server version: 1.6.2
    Server API version: 1.18
    Go version (server): go1.4.2
    Git commit (server): 7c8fca2
    OS/Arch (server): linux/amd64

error information in log

*** Error in `zabbix_agentd: listener #1 [processing request]': free(): invalid next size (fast): 0x0996dc00 ***
======= Backtrace: =========
/lib/libc.so.6(+0x61d47)[0xf763cd47]
/lib/libc.so.6(+0x623c3)[0xf763d3c3]
/usr/local/lib/modules/zabbix_module_docker.so(zbx_module_docker_mem+0x511)[0xf75d1c27]
zabbix_agentd: listener #1 [processing request](process+0x3bd)[0x805817d]
zabbix_agentd: listener #1 [processing request](listener_thread+0x1b4)[0x8057214]
zabbix_agentd: listener #1 [processing request](zbx_thread_start+0x47)[0x8066e37]
zabbix_agentd: listener #1 [processing request](MAIN_ZABBIX_ENTRY+0x198)[0x8056de8]
zabbix_agentd: listener #1 [processing request](daemon_start+0x1dc)[0x806774c]
zabbix_agentd: listener #1 [processing request](main+0x136)[0x804fd86]
/lib/libc.so.6(__libc_start_main+0x13e)[0xf75f4522]
zabbix_agentd: listener #1 [processing request][0x804fe71]
======= Memory map: ========
08048000-0807e000 r-xp 00000000 00:0d 10617912                           /usr/local/sbin/zabbix_agentd
0807e000-0807f000 rw-p 00036000 00:0d 10617912                           /usr/local/sbin/zabbix_agentd
0807f000-08085000 rw-p 00000000 00:00 0
0996d000-0998e000 rw-p 00000000 00:00 0                                  [heap]
f7529000-f753d000 r-xp 00000000 00:0d 7671                               /usr/lib/libgcc_s.so.1
f753d000-f753e000 rw-p 00014000 00:0d 7671                               /usr/lib/libgcc_s.so.1
f753e000-f75bf000 rw-s 00000000 00:01 98304                              /SYSV6c0df989 (deleted)
f75bf000-f75c7000 r-xp 00000000 00:0d 7395                               /lib/libnss_files-2.17.so
f75c7000-f75c8000 r--p 00007000 00:0d 7395                               /lib/libnss_files-2.17.so
f75c8000-f75c9000 rw-p 00008000 00:0d 7395                               /lib/libnss_files-2.17.so
f75cb000-f75d8000 r-xp 00000000 00:0d 10669030                           /usr/local/lib/modules/zabbix_module_docker.so
f75d8000-f75d9000 rw-p 0000c000 00:0d 10669030                           /usr/local/lib/modules/zabbix_module_docker.so
f75d9000-f75db000 rw-p 00000000 00:00 0
f75db000-f76f2000 r-xp 00000000 00:0d 502                                /lib/libc-2.17.so
f76f2000-f76f4000 r--p 00116000 00:0d 502                                /lib/libc-2.17.so
f76f4000-f76f5000 rw-p 00118000 00:0d 502                                /lib/libc-2.17.so
f76f5000-f76f8000 rw-p 00000000 00:00 0
f76f8000-f7706000 r-xp 00000000 00:0d 524                                /lib/libresolv-2.17.so
f7706000-f7707000 r--p 0000e000 00:0d 524                                /lib/libresolv-2.17.so
f7707000-f7708000 rw-p 0000f000 00:0d 524                                /lib/libresolv-2.17.so
f7708000-f770a000 rw-p 00000000 00:00 0
f770a000-f770c000 r-xp 00000000 00:0d 520                                /lib/libdl-2.17.so
f770c000-f770d000 r--p 00001000 00:0d 520                                /lib/libdl-2.17.so
f770d000-f770e000 rw-p 00002000 00:0d 520                                /lib/libdl-2.17.so
f770e000-f7743000 r-xp 00000000 00:0d 527                                /lib/libm-2.17.so
f7743000-f7744000 r--p 00034000 00:0d 527                                /lib/libm-2.17.so
f7744000-f7745000 rw-p 00035000 00:0d 527                                /lib/libm-2.17.so
f7745000-f7746000 rw-p 00000000 00:00 0
f7746000-f7747000 rw-p 00000000 00:00 0
f7747000-f7748000 rw-p 00000000 00:00 0
f7748000-f774a000 r--p 00000000 00:00 0                                  [vvar]
f774a000-f774b000 r-xp 00000000 00:00 0                                  [vdso]
f774b000-f7763000 r-xp 00000000 00:0d 504                                /lib/ld-2.17.so
f7763000-f7764000 r--p 00017000 00:0d 504                                /lib/ld-2.17.so
f7764000-f7765000 rw-p 00018000 00:0d 504                                /lib/ld-2.17.so
ffb9f000-ffbc0000 rw-p 00000000 00:00 0                                  [stack]

log before error

  9188:20151111:114226.942 Item [Id] found in the received JSON object: a87594deff1ec61f6c2c717f81d9ead2882fdaeae04d62de784efc587dca68f8
  9188:20151111:114226.942 zbx_module_docker_inspect_exec OK: a87594deff1ec61f6c2c717f81d9ead2882fdaeae04d62de784efc587dca68f8
  9188:20151111:114226.942 Metric source file: /sys/fs/cgroup/memory/docker/a87594deff1ec61f6c2c717f81d9ead2882fdaeae04d62de784efc587dca68f8/memory.stat
  9188:20151111:114226.942 Looking metric total_swap in memory.stat file
  9188:20151111:114226.942 Container: a87594deff1ec61f6c2c717f81d9ead2882fdaeae04d62de784efc587dca68f8; metric: total_swap; value: 7782400
  9188:20151111:114226.942 Sending back [7782400]
  9188:20151111:114226.942 listener #1 [waiting for connection]
  9188:20151111:114226.942 listener #1 [processing request]
  9188:20151111:114226.943 Requested [docker.cpu[/guidestyles,user]]
  9188:20151111:114226.943 In zbx_module_docker_cpu()
  9188:20151111:114226.943 In zbx_module_docker_get_fci()
  9188:20151111:114226.943 Translating container name to fci by using docker.inspect
  9188:20151111:114226.943 In zbx_module_docker_inspect_exec()
  9188:20151111:114226.943 In zbx_module_docker_socket_query()
  9188:20151111:114226.943 Docker's socket query: GET /containers/guidestyles/json HTTP/1.0
  9188:20151111:114226.945 Docker's socket response: {"AppArmorProfile":"","Args":[],"Config":{"AttachStderr":false,"AttachStdin":false,"AttachStdout":false,"Cmd":["nginx"],"CpuShares":0,"Cpuset":"","Domainname":"","Entrypoint":null,"En
v":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","DEBIAN_FRONTEND=noninteractive","LANG=es_ES.UTF-8","LC_CTYPE=es_ES.UTF-8"],"ExposedPorts":{"443/tcp":{},"80/tcp":{}},"Hostname":"296b3e5e0e9a","Image":"dockrepo.ab
sapp.net/guidestyles","Labels":{},"MacAddress":"","Memory":0,"MemorySwap":0,"NetworkDisabled":false,"OnBuild":null,"OpenStdin":false,"PortSpecs":null,"StdinOnce":false,"Tty":false,"User":"","Volumes":null,"WorkingDir":"/etc/nginx"},"Cre
ated":"2015-10-02T10:07:47.538800213Z","Driver":"aufs","ExecDriver":"native-0.2","ExecIDs":null,"HostConfig":{"Binds":null,"CapAdd":null,"CapDrop":null,"CgroupParent":"","ContainerIDFile":"","CpuShares":0,"CpusetCpus":"","Devices":[],"D
ns":null,"DnsSearch":null,"ExtraHosts":null,"IpcMode":"","Links":null,"LogConfig":{"Config":null,"Type":"json-file"},"LxcConf":[],"Memory":0,"MemorySwap":0,"NetworkMode":"bridge","PidMode":"","PortBindings":{"80/tcp":[{"HostIp":"","Host
Port":"10004"}]},"Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"RestartPolicy":{"MaximumRetryCount":0,"Name":"no"},"SecurityOpt":null,"Ulimits":null,"VolumesFrom":null},"HostnamePath":"/mnt/sda1/var/lib/docker/contai
ners/296b3e5e0e9abbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143/hostname","HostsPath":"/mnt/sda1/var/lib/docker/containers/296b3e5e0e9abbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143/hosts","Id":"296b3e5e0e9abbde3bf87dd7a396b
331e8bbc9394f4b391e03a5a651ece43143","Image":"6d10867afc493e7691a33974195a03715342ae637c5f3d7f27406d31a48c70ca","LogPath":"/mnt/sda1/var/lib/docker/containers/296b3e5e0e9abbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143/296b3e5e0e9a
bbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143-json.log","MountLabel":"","Name":"/guidestyles","NetworkSettings":{"Bridge":"docker0","Gateway":"172.17.42.1","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"IPAddress":"172.17.2.33",
"IPPrefixLen":16,"IPv6Gateway":"","LinkLocalIPv6Address":"fe80::42:acff:fe11:221","LinkLocalIPv6PrefixLen":64,"MacAddress":"02:42:ac:11:02:21","PortMapping":null,"Ports":{"443/tcp":null,"80/tcp":[{"HostIp":"0.0.0.0","HostPort":"10004"}]
}},"Path":"nginx","ProcessLabel":"","ResolvConfPath":"/mnt/sda1/var/lib/docker/containers/296b3e5e0e9abbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143/resolv.conf","RestartCount":0,"State":{"Dead":false,"Error":"","ExitCode":0,"Fini
shedAt":"0001-01-01T00:00:00Z","OOMKilled":false,"Paused":false,"Pid":1566,"Restarting":false,"Running":true,"StartedAt":"2015-10-02T10:07:47.947933315Z"},"Volumes":{},"VolumesRW":{}}
  9188:20151111:114226.945 Item [Id] found in the received JSON object: 296b3e5e0e9abbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143
  9188:20151111:114226.945 zbx_module_docker_inspect_exec OK: 296b3e5e0e9abbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143
  9188:20151111:114226.945 Metric source file: /sys/fs/cgroup/cpuacct/docker/296b3e5e0e9abbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143/cpuacct.stat
  9188:20151111:114226.945 Looking metric user in cpuacct.stat file
  9188:20151111:114226.945 Container: 296b3e5e0e9abbde3bf87dd7a396b331e8bbc9394f4b391e03a5a651ece43143; metric: user; value: 2
  9188:20151111:114226.945 Sending back [2]
  9188:20151111:114226.945 listener #1 [waiting for connection]
  9188:20151111:114226.945 listener #1 [processing request]
  9188:20151111:114226.945 Requested [docker.mem[/backend_md,total_cache]]
  9188:20151111:114226.946 In zbx_module_docker_mem()
  9188:20151111:114226.946 In zbx_module_docker_get_fci()
  9188:20151111:114226.946 Translating container name to fci by using docker.inspect
  9188:20151111:114226.946 In zbx_module_docker_inspect_exec()
  9188:20151111:114226.946 In zbx_module_docker_socket_query()
  9188:20151111:114226.946 Docker's socket query: GET /containers/backend_md/json HTTP/1.0
  9188:20151111:114226.948 Docker's socket response: {"AppArmorProfile":"","Args":["/start.sh"],"Config":{"AttachStderr":false,"AttachStdin":false,"AttachStdout":false,"Cmd":["/bin/bash","/start.sh"],"CpuShares":0,"Cpuset":"","Domainnam
e":"","Entrypoint":null,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/tomcat/bin","DEBIAN_FRONTEND=noninteractive","LANG=es_ES.UTF-8","LC_CTYPE=es_ES.UTF-8","JAVA_HOME=/usr/lib/jvm/java-8-oracle","TOMCAT
_VERSION=8.0.28","AGENT_VERSION=2.2.1","ZABBIX_VERSION=2.2","CATALINA_HOME=/opt/tomcat","JAVA_OPTS=-Djava.awt.headless=true -Dfile.encoding=UTF8 -XX:MaxPermSize=256m -Xms512m -Xmx1600m"],"ExposedPorts":{"10050/tcp":{},"4444/tcp":{},"808
0/tcp":{}},"Hostname":"e7c30667d703","Image":"dockrepo.absapp.net/backend_md","Labels":{},"MacAddress":"","Memory":0,"MemorySwap":0,"NetworkDisabled":false,"OnBuild":null,"OpenStdin":false,"PortSpecs":null,"StdinOnce":false,"Tty":false,
"User":"","Volumes":null,"WorkingDir":"/opt/tomcat"},"Created":"2015-11-11T10:59:55.388506447Z","Driver":"aufs","ExecDriver":"native-0.2","ExecIDs":null,"HostConfig":{"Binds":null,"CapAdd":null,"CapDrop":null,"CgroupParent":"","Containe
rIDFile":"","CpuShares":0,"CpusetCpus":"","Devices":[],"Dns":null,"DnsSearch":null,"ExtraHosts":null,"IpcMode":"","Links":null,"LogConfig":{"Config":null,"Type":"json-file"},"LxcConf":[],"Memory":0,"MemorySwap":0,"NetworkMode":"bridge",
"PidMode":"","PortBindings":{"8080/tcp":[{"HostIp":"","HostPort":"9004"}]},"Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"RestartPolicy":{"MaximumRetryCount":0,"Name":"no"},"SecurityOpt":null,"Ulimits":null,"VolumesF
rom":null},"HostnamePath":"/mnt/sda1/var/lib/docker/containers/e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa892e0749775c1eb/hostname","HostsPath":"/mnt/sda1/var/lib/docker/containers/e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa
892e0749775c1eb/hosts","Id":"e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa892e0749775c1eb","Image":"60a7185d5cc2f64602fa7a2df2f9ea9e535fcda8a73277f66ac067be956582a6","LogPath":"/mnt/sda1/var/lib/docker/containers/e7c30667d70366d9b91
2c88297b51f8848ade7ae0435221aa892e0749775c1eb/e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa892e0749775c1eb-json.log","MountLabel":"","Name":"/backend_md","NetworkSettings":{"Bridge":"docker0","Gateway":"172.17.42.1","GlobalIPv6Addre
ss":"","GlobalIPv6PrefixLen":0,"IPAddress":"172.17.13.69","IPPrefixLen":16,"IPv6Gateway":"","LinkLocalIPv6Address":"fe80::42:acff:fe11:d45","LinkLocalIPv6PrefixLen":64,"MacAddress":"02:42:ac:11:0d:45","PortMapping":null,"Ports":{"10050/
tcp":null,"4444/tcp":null,"8080/tcp":[{"HostIp":"0.0.0.0","HostPort":"9004"}]}},"Path":"/bin/bash","ProcessLabel":"","ResolvConfPath":"/mnt/sda1/var/lib/docker/containers/e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa892e0749775c1eb/
resolv.conf","RestartCount":0,"State":{"Dead":false,"Error":"","ExitCode":0,"FinishedAt":"0001-01-01T00:00:00Z","OOMKilled":false,"Paused":false,"Pid":1229,"Restarting":false,"Running":true,"StartedAt":"2015-11-11T10:59:55.90984331Z"},"
Volumes":{},"VolumesRW":{}}
  9188:20151111:114226.948 Item [Id] found in the received JSON object: e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa892e0749775c1eb
  9188:20151111:114226.948 zbx_module_docker_inspect_exec OK: e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa892e0749775c1eb
  9188:20151111:114226.948 Metric source file: /sys/fs/cgroup/memory/docker/e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa892e0749775c1eb/memory.stat
  9188:20151111:114226.948 Looking metric total_cache in memory.stat file
  9188:20151111:114226.948 Container: e7c30667d70366d9b912c88297b51f8848ade7ae0435221aa892e0749775c1eb; metric: total_cache; value: 163840

Errors when importing template

When importing the templates on Zabbix 2.2 I get the following error.

Created: Application "Docker" on "Template App Docker".
mb_strlen() expects parameter 1 to be string, array given [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → DB::checkValueTypes() → zbx_strlen() → mb_strlen() in /usr/share/zabbix/include/func.inc.php:955]
Array to string conversion [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → implode() in /usr/share/zabbix/include/classes/db/DB.php:450]
Error in query [INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('Running containers','0','','','30','0','','','0','0','','0','','','','','0','','','','','',Array,'10','','docker.discovery','','10209','1','4','0',NULL,'27895')] [Unknown column 'Array' in 'field list']
SQL statement execution has failed "INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('Running containers','0','','','30','0','','','0','0','','0','','','','','0','','','','','',Array,'10','','docker.discovery','','10209','1','4','0',NULL,'27895')".

Cant exec bash on container

How to enter bash in container?

ivan.skiridomov@docker-01:~$ docker exec -it zabbix-agent-xxl bash
exec: "bash": executable file not found in $PATH
ivan.skiridomov@docker-01:~$ docker exec -it zabbix-agent-xxl sh
exec: "sh": executable file not found in $PATH
ivan.skiridomov@docker-01:~$

Discovery names and linked containers confusion

I noticed some of my containers was named like d1_splunk_1/d1_front_1, which is a name in the list of "Names" in the Docker API. The example here is what the d1_front_1 container ends up being named when using the default docker.discovery. I still have a container named d1_splunk_1, but not another one of d1_front_1. https://docs.docker.com/engine/reference/api/docker_remote_api_v1.21/#list-containers says it should be a list, and that list of containers containers linked containers as well.
Basically, it the same list as docker ps -a --no-trunc. I see no guaranty by the API that the name of the container should come first, and it doesnt look like it does either.
So https://github.com/monitoringartist/Zabbix-Docker-Monitoring/blob/master/src/modules/zabbix_module_docker/zabbix_module_docker.c#L1570 is wrong :)

Turning on the truncated output in the API gives the short-name, but also gives us the shortened ID's, which wont work with getting CPU stats and so on.

Another way I found was looking for the entry in the Names array that contains 1 /.

I ended up writing a little python docker.discover2 in the meantime, to get the correct name. But this might be something to do in the module itself? What do you think?
If the length of the array is not 1 after the / check, you could fallback on grabbing the first one. Even tho I don't think that will happen.. :)

Monitoring local disk space of docker host

I'm not able to monitor my disk usage on my docker hosts. Getting:

item "pr-nodedocker2in:vfs.fs.discovery" became not supported: Unsupported item key.

Is there another solution?

zabbix server - Lack of free swap space on Zabbix server

Hi there

I'm using docker zabbix XXL and have been getting this issue of Lack of free swap space on Zabbix server.

My environment, Docker on Oracle Virtualbox on Windows Server 2012. Docker is installed with default settings (no modification done).

Default Docker Machine has 1 GB Base Memory. Is this the root cause? If I increase it, will it solve the problem?

How do I fix this?

Thanks for your help.

Running agent blocks remove of containers

We start our containers via systemd services (typical flow is: prestart: kill, remove, pull, then start, stop is just stop).
After the running containers are discovered by the agent, we cannot restart the container any more. Actually the remove fails as docker claims that some files are still in use. Once we stop the agent, the removal works again.
Is it possible to trigger the agent to release any locks on those files once the container is stopped?

Issues getting container name into HCONTAINERID

Hi,

I've just installed your module today. Like it, so far. However I seem to have an issue with getting the container name into HCONTAINERID. I'm on CentOS 7, so I added zabbix to the dockerroot group and changed ownership of the docker socket to root:dockerroot. As zabbix user I can run all Zabbix commands without issues.
I Started a container with both, hostname and name set, however when I do a lookup I always get the short id as name. I also compiled the mesos branch and tried via an ENV var. Even there, I only get the ID:

docker.discovery[Config,Env,MOD=]
ZBXD���{
"data":[
{
"{#FCONTAINERID}":"a8115e9632e799c1c4e3ccf5c935d085a857fa9d0bfdc899ed680eb08ba59f7f",
"{#HCONTAINERID}":"a8115e9632e7"},
{
"{#FCONTAINERID}":"039966e28e6aa67cc89355c36e50ba16a4515b70b175026eed68be7b1e26e7c5",
"{#HCONTAINERID}":"039966e28e6a"},
{
"{#FCONTAINERID}":"307742a66655ade0d3bcad983e955bb32ee13987d4129c52a411083a140ad089",
"{#HCONTAINERID}":"307742a66655"},
{
"{#FCONTAINERID}":"1e141d3b75d2bc09c70df0938dda74b54ac560209220b8d1cbc2369e3425cd5d",
"{#HCONTAINERID}":"1e141d3b75d2"}]}Connection closed by foreign host.

Here is the output of inspect on the machine: [{ "AppArmorProfile": "",
"Args": [
    "-c",
    "/etc/supervisord.conf"
],
"Config": {
    "AttachStderr": true,
    "AttachStdin": false,
    "AttachStdout": true,
    "Cmd": [
        "/usr/bin/supervisord",
        "-c",
        "/etc/supervisord.conf"
    ],
    "CpuShares": 4096,
    "Cpuset": "",
    "Domainname": foo.local",
    "Entrypoint": null,
    "Env": [
        "INST=foobar",
        "MOD=mod-foo",
        "CONFIG=foobar",
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
        "SERF_HOME=/usr/local/serf",
        "TERM=xterm"
    ],
    "ExposedPorts": {
    },
    "Hostname": "mod-foo",
    "Image": "registry/foo:latest",
    "Labels": {},
    "MacAddress": "",
    "Memory": 2147483648,
    "MemorySwap": 0,
    "NetworkDisabled": false,
    "OnBuild": null,
    "OpenStdin": false,
    "PortSpecs": null,
    "StdinOnce": false,
    "Tty": false,
    "User": "",
    "Volumes": null,
    "WorkingDir": ""
},
"Created": "2015-07-28T14:14:56.392591344Z",
"Driver": "devicemapper",
"ExecDriver": "native-0.2",
"ExecIDs": [
    "60bab9a3174e2b1092c4ebad9c05a112a84a12ac76c385a4374612bbbd9d6af0"
],
"HostConfig": {
    "Binds": null,
    "CapAdd": null,
    "CapDrop": null,
    "CgroupParent": "",
    "ContainerIDFile": "",
    "CpuShares": 4096,
    "CpusetCpus": "",
    "Devices": [],
    "Dns": null,
    "DnsSearch": null,
    "ExtraHosts": null,
    "IpcMode": "",
    "Links": null,
    "LogConfig": {
        "Config": null,
        "Type": "json-file"
    },
    "LxcConf": [],
    "Memory": 2147483648,
    "MemorySwap": 0,
    "NetworkMode": "bridge",
    "PidMode": "",
    "PortBindings": {},
    "Privileged": false,
    "PublishAllPorts": false,
    "ReadonlyRootfs": false,
    "RestartPolicy": {
        "MaximumRetryCount": 0,
        "Name": "no"
    },
    "SecurityOpt": null,
    "Ulimits": null,
    "VolumesFrom": null
},
"HostnamePath": "/var/lib/docker/containers/a8115e9632e799c1c4e3ccf5c935d085a857fa9d0bfdc899ed680eb08ba59f7f/hostname",
"HostsPath": "/var/lib/docker/containers/a8115e9632e799c1c4e3ccf5c935d085a857fa9d0bfdc899ed680eb08ba59f7f/hosts",
"Id": "a8115e9632e799c1c4e3ccf5c935d085a857fa9d0bfdc899ed680eb08ba59f7f",
"Image": "3554ec9321bfdd3ea85a270aa0009a0663e2a444f534f0c234ccb6d04d30a1ca",
"LogPath": "/var/lib/docker/containers/a8115e9632e799c1c4e3ccf5c935d085a857fa9d0bfdc899ed680eb08ba59f7f/a8115e9632e799c1c4e3ccf5c935d085a857fa9d0bfdc899ed680eb08ba59f7f-json.log",
"MountLabel": "",
"Name": "/foo.bar",
"NetworkSettings": {
    "Bridge": "docker0",
    "Gateway": "172.17.42.1",
    "GlobalIPv6Address": "",
    "GlobalIPv6PrefixLen": 0,
    "IPAddress": "172.17.0.19",
    "IPPrefixLen": 16,
    "IPv6Gateway": "",
    "LinkLocalIPv6Address": "fe80::42:acff:fe11:13",
    "LinkLocalIPv6PrefixLen": 64,
    "MacAddress": "02:42:ac:11:00:13",
    "PortMapping": null,
    "Ports": {
        "10050/tcp": null,
        "7373/tcp": null,
        "7946/tcp": null,
        "9001/tcp": null
    }
},
"Path": "/usr/bin/supervisord",
"ProcessLabel": "",
"ResolvConfPath": "/var/lib/docker/containers/a8115e9632e799c1c4e3ccf5c935d085a857fa9d0bfdc899ed680eb08ba59f7f/resolv.conf",
"RestartCount": 0,
"State": {
    "Dead": false,
    "Error": "",
    "ExitCode": 0,
    "FinishedAt": "0001-01-01T00:00:00Z",
    "OOMKilled": false,
    "Paused": false,
    "Pid": 1652,
    "Restarting": false,
    "Running": true,
    "StartedAt": "2015-07-28T14:14:57.670936738Z"
},
"Volumes": {},
"VolumesRW": {},
"VolumesRelabel": {}

}
]

Any ideas? Do you need any more info?

Docker API ID not found in JSON object

Hey,

I have a problem i dont know how to fix this. The Agent doesnt recieve the docker container ID

Docker version:

docker -v
Docker version 1.12.2, build bb80604

Zabbix Agent

zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 3.2.2

Log file Zabbix Agent:

 23771:20161214:071951.448 Cannot find the [Id] item in the received JSON object
 23771:20161214:071957.463 Cannot find the [Id] item in the received JSON object
 23770:20161214:071957.466 Cannot find the [Id] item in the received JSON object
 23770:20161214:072003.483 Cannot find the [Id] item in the received JSON object
 23769:20161214:072009.502 Cannot find the [Id] item in the received JSON object
 23770:20161214:072015.531 Cannot find the [Id] item in the received JSON object

Docker API

curl --unix-socket /var/run/docker.sock http:/containers/json
[{"Id":"fbb89314b9bfbc3787aae4b29149d27eea007fe71fb99b6a600fa4bf7f0ab436" with alot of more text

So at this point i see that everythings works but the zabbix agent cannot fetch the container ID. Can someone point me to the right direction ?

Edit:
Some log i have change the container names to: CONTAINERNAME

30325:20161214:124422.470 __zbx_zbx_setproctitle() title:'collector [processing data]'
30325:20161214:124422.471 In update_cpustats()
30325:20161214:124422.471 End of update_cpustats()
30325:20161214:124422.471 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]'
30329:20161214:124422.498 In send_buffer() host:'127.0.0.1' port:10051 entries:6/100
30329:20161214:124422.499 JSON before sending [{"request":"agent data","data":[{"host":"Docker","key":"docker.cstatus[All]","value":"26","clock":1481715857,"ns":483613955},{"host":"Docker","key":"docker.cstatus[Crashed]","value":"1","clock":1481715857,"ns":486267136},{"host":"Docker","key":"docker.cstatus[Exited]","value":"14","clock":1481715857,"ns":489862640},{"host":"Docker","key":"docker.cstatus[Paused]","value":"0","clock":1481715857,"ns":491516439},{"host":"Docker","key":"docker.cstatus[Up]","value":"12","clock":1481715857,"ns":493058650},{"host":"Docker","key":"docker.discovery","value":"{\"data\":[{\"{#FCONTAINERID}\":\"fbb89314b9bfbc3787aae4b29149d27eea007fe71fb99b6a600fa4bf7f0ab436\",\"{#SCONTAINERID}\":\"fbb89314b9bf\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"561c151f659d0a572e280e165a2a342f71e64503f0dab157704ff7b225d0163b\",\"{#SCONTAINERID}\":\"561c151f659d\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"1390ae8a993053559701592be625080cac6e159e48fa4c2b7389e9ebc5d477ab\",\"{#SCONTAINERID}\":\"1390ae8a9930\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"fe23b6b02bc7cc2a2659deed61a13c49ffdf157a4bcc6e678442465fd536db26\",\"{#SCONTAINERID}\":\"fe23b6b02bc7\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"982b8d28fcab20476d85d59d69b37d1f9bcc65cdb9b68e74548643b50203194a\",\"{#SCONTAINERID}\":\"982b8d28fcab\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"c0b866fe664b087c59477fca27396a912527fd95606761c656ca3cc579c331eb\",\"{#SCONTAINERID}\":\"c0b866fe664b\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"7f825cfce5abae2a593d9f47b1fa640f389d197d8f8c2f5d9d2660c84194d76f\",\"{#SCONTAINERID}\":\"7f825cfce5ab\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"47322ec870274562f42e3c98c7f6ad2122c144a5f0cca6432ae85ccb6a86395f\",\"{#SCONTAINERID}\":\"47322ec87027\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"653401ca6ffb1a395002cdd90bf75f4bc2104266f5f5f71659596c4d0597cd77\",\"{#SCONTAINERID}\":\"653401ca6ffb\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"6e6901e5a32377285c552384c86dcd67b70e691a2cd72b6563f7798c88c46777\",\"{#SCONTAINERID}\":\"6e6901e5a323\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"eaf23e32e873137570c038d547a43354d99320194ceba66fea4b5fb536476536\",\"{#SCONTAINERID}\":\"eaf23e32e873\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"},{\"{#FCONTAINERID}\":\"7af082129d5a1075f3d6d0027d523d1e5f1373449e3d3b6aaf6b757f45580f2b\",\"{#SCONTAINERID}\":\"7af082129d5a\",\"{#SYSTEM.HOSTNAME}\":\"docker\",\"{#HCONTAINERID}\":\"CONTAINERNAME\"}]}","clock":1481715857,"ns":496838304}],"clock":1481715862,"ns":499355266}]
30329:20161214:124422.534 JSON back [{"response":"success","info":"processed: 6; failed: 0; total: 6; seconds spent: 0.033686"}]
30329:20161214:124422.534 In check_response() response:'{"response":"success","info":"processed: 6; failed: 0; total: 6; seconds spent: 0.033686"}'
30329:20161214:124422.534 info from server: 'processed: 6; failed: 0; total: 6; seconds spent: 0.033686'
30329:20161214:124422.534 End of check_response():SUCCEED
30329:20161214:124422.534 OK

When i do it manual everythings works fine.

root@docker:~# zabbix_agentd -t docker.cpu[/fbb89314b9bf,system]
docker.cpu[/fbb89314b9bf,system]              [u|8150]```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.