Open alexmirtoff opened 5 years ago
Did you compile the module for your system with correct Zabbix version? Could you provide more logs before backtrace, please?
Did you compile the module for your system with correct Zabbix version? Could you provide more logs before backtrace, please?
Yes. I have compiled the correct version. These hosts are running as manager-worker mode. On the host without a cluster everything is fine. Some logs:
65158:20181212:145638.254 Requested [docker.mem[d8dc14731a9ca28c2c8f4b2c3063db03f752b751ef40bf17d0c07e169a3e2918,total_cache]]
65158:20181212:145638.254 In zbx_module_docker_mem()
65158:20181212:145638.254 In zbx_module_docker_get_fci()
65158:20181212:145638.254 Original full container id will be used
65158:20181212:145638.254 Metric source file: /sys/fs/cgroup/memory/docker/d8dc14731a9ca28c2c8f4b2c3063db03f752b751ef40bf17d0c07e169a3e2918/memory.stat
65158:20181212:145638.254 Looking metric total_cache in memory.stat file
65158:20181212:145638.254 Id: d8dc14731a9ca28c2c8f4b2c3063db03f752b751ef40bf17d0c07e169a3e2918; metric: total_cache; value: 77406208
65158:20181212:145638.254 Sending back [77406208]
65158:20181212:145638.255 __zbx_zbx_setproctitle() title:'listener #3 [waiting for connection]'
65158:20181212:145638.256 __zbx_zbx_setproctitle() title:'listener #3 [processing request]'
65158:20181212:145638.257 Requested [docker.mem[3fd2b78b602d02a879dffb33a0073725d38dc04c48959a50b5b115dae7feba9b,total_rss]]
65158:20181212:145638.257 In zbx_module_docker_mem()
65158:20181212:145638.257 In zbx_module_docker_get_fci()
65158:20181212:145638.257 Original full container id will be used
65158:20181212:145638.257 Metric source file: /sys/fs/cgroup/memory/docker/3fd2b78b602d02a879dffb33a0073725d38dc04c48959a50b5b115dae7feba9b/memory.stat
65158:20181212:145638.258 Looking metric total_rss in memory.stat file
65158:20181212:145638.258 Id: 3fd2b78b602d02a879dffb33a0073725d38dc04c48959a50b5b115dae7feba9b; metric: total_rss; value: 73814016
65158:20181212:145638.258 Sending back [73814016]
65158:20181212:145638.258 __zbx_zbx_setproctitle() title:'listener #3 [waiting for connection]'
65157:20181212:145638.260 __zbx_zbx_setproctitle() title:'listener #2 [processing request]'
65157:20181212:145638.261 Requested [docker.mem[598fb024a76008b3919ba2debe37319d9a96d2a90dce521f23b6dc7c3dd2a648,total_swap]]
65157:20181212:145638.261 In zbx_module_docker_mem()
65157:20181212:145638.261 In zbx_module_docker_get_fci()
65157:20181212:145638.261 Original full container id will be used
65157:20181212:145638.261 Metric source file: /sys/fs/cgroup/memory/docker/598fb024a76008b3919ba2debe37319d9a96d2a90dce521f23b6dc7c3dd2a648/memory.stat
65157:20181212:145638.261 Cannot open metric file: '/sys/fs/cgroup/memory/docker/598fb024a76008b3919ba2debe37319d9a96d2a90dce521f23b6dc7c3dd2a648/memory.stat'
65157:20181212:145638.261 Sending back [ZBX_NOTSUPPORTED: Cannot open memory.stat file]
65157:20181212:145638.261 __zbx_zbx_setproctitle() title:'listener #2 [waiting for connection]'
65157:20181212:145638.263 __zbx_zbx_setproctitle() title:'listener #2 [processing request]'
65157:20181212:145638.264 Requested [docker.up[f508d3c86f17820bf51dea6517045a1ce6dddc457d53ec397c61309ecd6b090e]]
65157:20181212:145638.264 In zbx_module_docker_up()
65157:20181212:145638.264 In zbx_module_docker_get_fci()
65157:20181212:145638.264 Original full container id will be used
65157:20181212:145638.264 Metric source file: /sys/fs/cgroup/cpu,cpuacct/docker/f508d3c86f17820bf51dea6517045a1ce6dddc457d53ec397c61309ecd6b090e/cpuacct.stat
65157:20181212:145638.264 Cannot open metric file: '/sys/fs/cgroup/cpu,cpuacct/docker/f508d3c86f17820bf51dea6517045a1ce6dddc457d53ec397c61309ecd6b090e/cpuacct.stat', container doesn't run
65157:20181212:145638.264 Sending back [0]
65157:20181212:145638.264 __zbx_zbx_setproctitle() title:'listener #2 [waiting for connection]'
65157:20181212:145638.266 __zbx_zbx_setproctitle() title:'listener #2 [processing request]'
65157:20181212:145638.267 Requested [docker.xnet[f3a1997592d3b0dc7cad00e834759e8f699e9e96108d5d6dc0c3d5afe38701a3,eth0,RX-OK]]
65157:20181212:145638.267 In zbx_module_docker_net()
65157:20181212:145638.267 In zbx_module_docker_get_fci()
65157:20181212:145638.267 Original full container id will be used
65157:20181212:145638.267 netns file: /var/run/netns/zabbix_module_docker_f3a1997592d3b0dc7cad00e834759e8f699e9e96108d5d6dc0c3d5afe38701a3
65157:20181212:145638.267 Tasks file: /sys/fs/cgroup/devices/docker/f3a1997592d3b0dc7cad00e834759e8f699e9e96108d5d6dc0c3d5afe38701a3/tasks
65157:20181212:145638.267 Cannot open Docker tasks file: '/sys/fs/cgroup/devices/docker/f3a1997592d3b0dc7cad00e834759e8f699e9e96108d5d6dc0c3d5afe38701a3/tasks'
65157:20181212:145638.267 Sending back [ZBX_NOTSUPPORTED: Cannot open Docker tasks file]
65157:20181212:145638.267 __zbx_zbx_setproctitle() title:'listener #2 [waiting for connection]'
65157:20181212:145638.273 __zbx_zbx_setproctitle() title:'listener #2 [processing request]'
65157:20181212:145638.274 Requested [docker.xnet[71b227a3c00d0b6862cd82187d9bcd68be4698ece453bc90c3ff8dd6bc3b6f26,eth0,RX-OK]]
65157:20181212:145638.274 In zbx_module_docker_net()
65157:20181212:145638.274 In zbx_module_docker_get_fci()
65157:20181212:145638.274 Original full container id will be used
65157:20181212:145638.274 netns file: /var/run/netns/zabbix_module_docker_71b227a3c00d0b6862cd82187d9bcd68be4698ece453bc90c3ff8dd6bc3b6f26
65157:20181212:145638.274 Tasks file: /sys/fs/cgroup/devices/docker/71b227a3c00d0b6862cd82187d9bcd68be4698ece453bc90c3ff8dd6bc3b6f26/tasks
*** Error in `/usr/sbin/zabbix-agentd: listener #2 [processing request]': munmap_chunk(): invalid pointer: 0x00007f9ea11ce840 ***
Problem is with docker.xnet
. Did you fulfill requirements mentioned in the Readme?
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
Some network data appeared in Zabbix before the agent died.
Probably it is crashing somewhere in this part https://github.com/monitoringartist/zabbix-docker-monitoring/blob/dba2fb727e411493bcc4e540d5bac681836d12fc/src/modules/zabbix_module_docker/zabbix_module_docker.c#L1286-L1306
Probably some pointer for free
function is not valid. It will require deeper investigation to prove it.
I also have this problem, but I have zabbix-agent version 4.4.3. Debian 9.9
But I downgrade my zabbix-agent to 4.2.8 and compiled .so - it worked!
same problem: os: ubuntu 18.04, debian 9, debian 10; agent version: 5.0.12 zabbix_module_docker.so was downloaded from master branch.
It looks to me that the problem is here: https://github.com/monitoringartist/zabbix-docker-monitoring/blob/fd3f6e818e31989972f15fbe86079573fc1c6608/src/modules/zabbix_module_docker/zabbix_module_docker.c#L1274-L1280 If fgets()
fails, then loop body is never executed and first_task
is not initialized and subsequent attempt to release memory: https://github.com/monitoringartist/zabbix-docker-monitoring/blob/fd3f6e818e31989972f15fbe86079573fc1c6608/src/modules/zabbix_module_docker/zabbix_module_docker.c#L1290 ...will lead to a crash.
The solution would be to convert this while
loop into if else
construct. However, I don't know what to put in else
branch, because I am looking at it purely from C developer's perspective. @jangaraj and the rest, what does it mean if Tasks file is empty? How should module behave in this case?