monitoringartist / zabbix-docker-monitoring

:whale: Docker/Kubernetes/Mesos/Marathon/Chronos/LXC/LXD/Swarm container monitoring - Docker image, Zabbix template and C module
https://hub.docker.com/r/monitoringartist/zabbix-agent-xxl-limited/
GNU General Public License v2.0
1.19k stars 266 forks source link

Docker containers AND systemd units monitoring #56

Closed achekalin closed 7 years ago

achekalin commented 7 years ago

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?

jangaraj commented 7 years ago

docker.service is not a docker container, but it's systemd unit. So in the theory you can use https://github.com/monitoringartist/zabbix-systemd-monitoring. However module will detect docker and it will use docker cgroup path, not a systemd path => it's not possible atm. I was thinking about this issue before, but it needs implementation.

achekalin commented 7 years ago

Oh, I got your idea, I really missed that '.service' part of the path. Well, what I need is to keep track of docker containers, but on my server I can see your module can check all but 'memory'-based values.

Are there any way to monitor these without systemd, for example? I don't want to deal with systemd if we can bypass it, since it'll be less complex and more robust way, I suspect.

jangaraj commented 7 years ago

Yes, this module is for Docker container monitoring. Docker is based on cgroups and systemd is based on cgroups as well => additional feature of this module is that is able to monitor also systemd units. If you need to monitor only Docker container, then use it only for Docker container -> np.

achekalin commented 7 years ago

Ok, but what is the right way to monitor container memory now? I think it should be possible to use plaint old approach anyway, isn't it? I just miss how to do that. Look, https://github.com/monitoringartist/zabbix-systemd-monitoring provides only templates, not module itself (and frankly speaking I need module not container images), so I can't build it to test.

jangaraj commented 7 years ago

Please read readme. Forgot about https://github.com/monitoringartist/zabbix-systemd-monitoring - you want to monitor containers, not systemd units.