monitoringartist / dockbix-agent-xxl

:whale: Dockerized Zabbix agent with Docker metrics and host metrics support for CoreOS, RHEL, CentOS, Ubuntu, Debian, Fedora, Boot2docker, Photon OS, Amazon Linux, ...
https://hub.docker.com/r/monitoringartist/dockbix-agent-xxl-limited/
Other
182 stars 54 forks source link

Cannot get process number in container with dockbix-agent #42

Closed ghost closed 5 years ago

ghost commented 5 years ago

hi everyone~ I install dockbix-xxl in centos 7.4 then use it to monitor a container which is running apache. but when i use "zabbix_get -s 172.16.0.195 -k 'proc.num[apache]'" ,the zabbix-server gets 0.where am i wrong?

[root@lcshop-zabbix ~]# zabbix_get -s 172.16.0.195 -k 'net.tcp.listen[9099]' 1 [root@lcshop-zabbix ~]# zabbix_get -s 172.16.0.195 -k 'proc.num[apache]' 0

jangaraj commented 5 years ago

I don't see any issue with dockbix-agent-xxl. Be familiar with proc.num configuration https://www.zabbix.com/documentation/3.4/manual/config/items/itemtypes/zabbix_agent and configure your item correctly.

ghost commented 5 years ago

hi jangaraj! [root@lcshop-zabbix ~]# zabbix_get -s 172.31.0.66 -k 'proc.num[,,,zabbix_agentd]' 6 [root@lcshop-zabbix ~]# zabbix_get -s 172.16.0.195 -k 'proc.num[,,,zabbix_agentd]' 0

172.31.0.66 is normal zabbix-agent 3.4.5 and 172.16.0.195 is dockbix-agent-xxl,but the results of "proc.num[,,,zabbix_agentd]" are different,why that happened?

jangaraj commented 5 years ago

How did you start agent container?

ghost commented 5 years ago
docker run   --name=dockbix   \
  --net=host   --privileged   -v /:/rootfs \
  -v /var/run:/var/run   --restart unless-stopped   -e "ZA_Server=172.31.0.77"  \
  -e "ZA_ServerActive=172.31.0.77"   -d \
  hub.c.163.com/canghai809/dockbix-agent-xxl-limited:latest
jangaraj commented 5 years ago

Sorry, hub.c.163.com/canghai809/dockbix-agent-xxl-limited:latest is not image in my responsibility, so I can't support any third party image.

ghost commented 5 years ago

hi jangaraj, i change your images: [root@lcshop-ecadmin-001 docker]# docker run \

--name=dockbix-agent-xxl \ --net=host \ --privileged \ -v /:/rootfs \ -v /var/run:/var/run \ --restart unless-stopped \ -e "ZA_Server=172.31.0.77" \ -e "ZA_ServerActive=172.31.0.77" \ -d monitoringartist/dockbix-agent-xxl-limited:latest 4a5491a256233fb6fef096ed640091032756d0c981346cf7e2c07e11a552bdf0 [root@lcshop-ecadmin-001 docker]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4a5491a25623 monitoringartist/dockbix-agent-xxl-limited:latest "/dockbix-agent-xxl" 3 seconds ago Up 2 seconds dockbix-agent-xxl 6f84c1d9e5b9 registry.cn-hangzhou.aliyuncs.com/lechangeshop/ecadmin:20181012 "/bin/bash" 2 days ago Up 2 minutes 0.0.0.0:9099->80/tcp ecadmin

but i still can't get 'proc.num[,,,zabbix_agentd]'... please help me

jangaraj commented 5 years ago

Your container can be isolated. Try --pid=host to use host namespace.

ghost commented 5 years ago

I delete both my apache2 container and dockbix container ,then run both of them with --pid=host.

OK ,i got it!thank U so much! [root@lcshop-zabbix ~]# zabbix_get -s 172.16.0.195 -k 'proc.num[apache2]' 16

but please tell me how to attach dockbix? i found there is no /bin/bash in dockbix container. [root@lcshop-ecadmin-001 docker]# docker exec -it 14a248486e53 /bin/bash OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown

jangaraj commented 5 years ago

Be more familiar with namespaces - only agent needs host namespace. You need paid image https://github.com/monitoringartist/dockbix-agent-xxl#public-limited-vs-private-paid-image if you want to use docker attach, a public limited image doesn't have any shell.

ghost commented 5 years ago

thanks for ur answer