Monitorix
Monitorix copied to clipboard
Feature Request: docker stats
Hey @mikaku ,
One more suggestion: what about docker stats
? It'd be cool to have something like docker_processes
where we could throw names of containers to be tracked.
$ docker stats redis1 redis2 CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O
redis1 0.07% 796 KB / 64 MB 1.21% 788 B / 648 B 3.568 MB / 512 KB
redis2 0.07% 2.746 MB / 64 MB 4.29% 1.266 KB / 648 B 12.4 MB / 0 B
Just a suggestion. No rush at all.
Thanks!
Just touching this, in case it could be look through again :)
Yes, I'm a bit busy lately at work, so that's why this and other issues may seem freezed. Sorry for the inconveniences.
@uri200,
I don't have docker
but podman
since I'm using Fedora, but I think they are similar, if not the same.
I'm not very versed with containers so, excuse my ignorance.
I've create a test docker with podman run -it fedora bash
under my regular desktop user. I'm able to see the stats of this docker with:
$ podman stats -a --no-stream
ID NAME CPU % MEM USAGE / LIMIT MEM % NET IO BLOCK IO PIDS CPU TIME AVG CPU %
2e61a62db12f nostalgic_allen 2.88% 7.066MB / 8.188GB 0.09% -- / -- -- / -- 1 46.959ms 2.88%
But I've seen that executing the same command under root
it returns nothing.
Since Monitorix runs under root
, do you know a way to get the same statistics using the root
user?
See docker stats with Monitorix will be really nice
docker stats -a --no-stream and sudo docker stats produces the same behaviour::
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
ade4d2b8366d ubuntu 0.00% 0B / 0B 0.00% 0B / 0B 0B / 0B 0
955b4fd616b3 mobsf 0.01% 57.61MiB / 7.812GiB 0.72% 1.23MB / 816kB 22.6MB / 0B 3
860688fc4d71 portainer 0.00% 23.86MiB / 31.05GiB 0.08% 1.22MB / 2.29MB 10.2MB / 5.6MB 9
Dependencies will be docker-py
Currently I'm using glances (python) to seed docker stats
https://github.com/nicolargo/glances
CONTAINERS 2 (served by Docker 20.10.12) Name Status CPU% MEM IOR/s IOW/s RX/s TX/s Command mobsf running 0.0 60.0M 0b 0b 0b 0b portainer running 0.0 29.9M 0b 0b 0b 0b ["/portainer"]
Another tool is ctop
@ehnwebmaster,
I see differences when running podman stats -a --no-stream
either under the regular user which is running a container, and root
:
$ podman stats -a --no-stream
ID NAME CPU % MEM USAGE / LIMIT MEM % NET IO BLOCK IO PIDS CPU TIME AVG CPU %
6725ce9cb235 compassionate_bose 0.00% 57.34kB / 16.63GB 0.00% 430B / 110B 0B / 0B 1 7.45ms 0.00%
$
It seems that root
user is unable to see all running containers (Fedora 36):
# podman stats -a --no-stream
ID NAME CPU % MEM USAGE / LIMIT MEM % NET IO BLOCK IO PIDS CPU TIME AVG CPU %
Also, the same command under root
clears the screen before showing any stats.
What am I missing?
It looks that this is podman feature.
to see containers for user with uid 1000 run:
systemd-run --uid=1000 --pty --wait --collect --service-type=exec /usr/bin/podman ps -a
Source: https://unix.stackexchange.com/questions/680171/list-containers-from-other-users
For docker this "hack" is not required as root can see all containers.
Yes, but this would complicate the configuration on a system with multiple users using podman. I'd like to know if there is a way to list all containers of all users with a single command.
Not a podman expert. As far as I know not for podman. And my understanding is that this is by design for Rootless. Maybe we can ask in podman (https://github.com/containers/podman). Docker (the request is for docker) lists all containers for all users (again AFAIK) by default.
I think you're right, as you said, podman is rootless by design, so I guess it won't be possible to do it with it. So, better focus on Docker.