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

Stops working after container restart #7

Closed Asp3ctus closed 8 years ago

Asp3ctus commented 8 years ago
docker run \
  --name=zabbix-agent-xxl \
  -p 10050:10050 \
  -v /:/rootfs \
  -v /var/run:/var/run \
  -e "ZA_Server=server" \
  -e "ZA_ServerActive=server" \
  -e "ZA_StartAgents=5" \
  -e "ZA_Timeout=30" \
  -e "ZA_ListenIP=`ifconfig tun0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'`" \
  -e "ZA_Hostname=$(hostname)"  \
  --net=host \
  -d --restart=always --name zabbix-agent monitoringartist/zabbix-agent-xxl-limited:latest

It starts and works but after i stop and start the container is breaking:

Zocker XXL v0.9.2b 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.
Error #10
Zocker XXL v0.9.2b 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.
Error #10
Zocker XXL v0.9.2b 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.
Error #10
jangaraj commented 8 years ago

How did you restart container?

Mentat420 commented 8 years ago

I have the exact same problem (Error #10 on container restart). I've restarted my container by rebooting by computer. However, even if I just do a "docker stop zabbix-agent-xxl" followed by a "docker start zabbix-agent-xxl", I run into the same issue (Error #10). My docker run is slightly different though:

docker run \
--name=zabbixagent-xxl \
-p 10250:10050 \
-v /:/rootfs \
-v /var/run:/var/run \
-e "ZA_Server=monitoring.domain.local" \
-e "ZA_ServerActive=monitoring.domain.local" \
-h docker-agent-1 \
-d --restart=always monitoringartist/zabbix-agent-xxl-limited:latest
jangaraj commented 8 years ago
--restart=always

Unfortunately restart policy is not supported. At least not in public free image. I have idea how to fix it, but I don't want to waste my time. To be honest I don't like Docker restart policy. IMO it's should be task of your Docker orchestration.

Mentat420 commented 8 years ago

Ok. However, even if I remove the restart policy from the run command, I still run into the same issue if I do a "docker stop" followed by "docker start". Are you saying that stopping and starting the container aren't supported at all? The only way to use this is removing the container and rebuilding it each time? (Just trying to confirm)

Thanks!

jangaraj commented 8 years ago

docker stop + docker start = docker restart = --restart=always = still the same problem. Yes, you need to remove old zabbix-agent container and start new one in your case. Container is stateless, so it's not a problem.

suhsteve commented 8 years ago

Does this mean that if a machine reboots, we will have to remove the zabbix-agent container and start a new one every time ?

jangaraj commented 8 years ago

Yes, you have to remove the zabbix-agent container and start a new one every time. I recommend to use it as a systemd service, so you can create service "hook" which will remove container before start.

mprokopov commented 8 years ago

I've got the same issue, and that's quite weird, if I need to recreate container each time instead of just start it again.

Can you put more description for #10 error? Maybe it's possible to solve this issue by user?

jangaraj commented 8 years ago

10 is in this case: wrapper code was not able to start zabbix-agentd properly

It's expected behaviour/architecture design and you are not able to solve it from the user space.

jangaraj commented 8 years ago

systemd example - https://github.com/monitoringartist/zabbix-agent-xxl#dockerized-zabbix-agent-xxl-service-managed-by-systemd

tufand commented 5 years ago

+1 & solve my problem thanks.