uptime-kuma icon indicating copy to clipboard operation
uptime-kuma copied to clipboard

Documentation on how to setup docker container monitor

Open joerich opened this issue 2 years ago • 11 comments

⚠️ Please verify that this bug has NOT been raised before.

  • [X] I checked and didn't find similar issue

🛡️ Security Policy

📝 Describe your problem

Documentation on how to setup docker container monitor

🐻 Uptime-Kuma Version

Version: 1.18.0

💻 Operating System and Arch

Ubuntu 14.0

🌐 Browser

Chrome is up to date Version 105.0.5195.127

🐋 Docker Version

No response

🟩 NodeJS Version

No response

joerich avatar Sep 15 '22 15:09 joerich

@c0derMo is the main contributor of this option, maybe can he help out?

Aside from this @joerich it might be useful to know how docker daemons work. Therefore here the link to docker documenation: https://docs.docker.com/engine/reference/commandline/dockerd/

rezzorix avatar Sep 17 '22 04:09 rezzorix

I'm gonna try to post a step by step guide on how to use docker monitors here:

  1. Add a new docker host (either via Settings -> Docker Hosts or when creating a new monitor) a. You may need to make the unix socket (which is under /var/run/docker.sock by default) available to the container. (e.g. by using -v /var/run/docker.sock:/var/run/docker.sock when starting Uptime Kuma) b. On Windows, or if you want to monitor a remote docker host, you'll have to configure docker to expose an TCP port. See the dockerd documentation and how to configure the daemon for more info.
  2. If you press the "Test" button when setting up your docker host, it should tell you if it could connect correctly, and display the amount of containers running on the docker host.
  3. Add a container like you would normally, selecting the docker host you just setup, and using the container name / id obtained from the docker ps command.

Hope this clears it up a bit

c0derMo avatar Sep 17 '22 11:09 c0derMo

Do you have any tips on how to configure Docker monitoring for a Synology Docker setup? I don't believe it exposes a website / TCP port by default and I cannot find documentation on this.

ChipSkylark37 avatar Sep 18 '22 12:09 ChipSkylark37

c0derMo My issue is that I have docker running on my TerraMaster NAS, I've tried using the command you set forth "-v /var/run/docker.sock:/var/run/docker.sock" didn't work. When I login via SSH I can see the directory "/var/run/" and the file "docker.sock" I don't understand what the problem is.

I love this software and would really like to use the docker monitors

On my NAS, Docker was through the TerraMaster control panel Portainer was also. Everything installed in docker works great.

do I need to open a tcp port for docker and config it that way?

thanks in advance for your help!

joerich avatar Sep 18 '22 13:09 joerich

I cant give accurate advice for any of these systems, since I'm not familiar with them.

If you are trying to monitor the docker environment where Uptime Kuma also runs on, chances are high you can access the local docker socket at /var/run/docker.sock, binding it to the container as written above.

c0derMo avatar Sep 18 '22 14:09 c0derMo

That doesn't seem to work for Synology, but I'll try a few different things and see if I can get something to work.

ChipSkylark37 avatar Sep 18 '22 15:09 ChipSkylark37

I understand there are use cases for monitoring the container is up or down instead of monitoring the service (e.g. monitoring wireguard/UDP would be such a case).

So it really depends on the type of service one runs. It also depends if the uptime-kuma instance is running within same network or not.

In most cases I bet it would be easiest to just setup TCP or HTTP(s) monitors. If not accessible from the outside world, but with (outgoing) network access, then in "Upside Down Mode". Also there are heaps of possibilities to access internal services with the different authentication and/or proxy options.

My question regarding dockerd or here uptime-kuma docker monitor... does it return health status of the container? A docker container status could be "active" but be unhealthy... I didnt find it on first glance in the docs.

rezzorix avatar Sep 19 '22 02:09 rezzorix

@rezzorix Currently, the monitor does not look at a container's health, just whether it's running or not, since I found it difficult to say generally, that a monitor should count as "down" when it's container is unhealthy... maybe adding a checkbox to the monitor for this purpose would help?

c0derMo avatar Sep 19 '22 08:09 c0derMo

That doesn't seem to work for Synology, but I'll try a few different things and see if I can get something to work.

Let me know what you find out! I'll try it on my TerraMaster NAS.

joerich avatar Sep 20 '22 15:09 joerich

@rezzorix Currently, the monitor does not look at a container's health, just whether it's running or not, since I found it difficult to say generally, that a monitor should count as "down" when it's container is unhealthy... maybe adding a checkbox to the monitor for this purpose would help?

Yeah it might help, however, to be honest, I personally think checking docker containers status is easier/quicker to implement via any of the other monitor options... (except for UDP services of course).

rezzorix avatar Sep 24 '22 06:09 rezzorix

We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 2 days.

github-actions[bot] avatar Dec 23 '22 12:12 github-actions[bot]

This issue was closed because it has been stalled for 2 days with no activity.

github-actions[bot] avatar Dec 25 '22 12:12 github-actions[bot]

@ChipSkylark37 did you find a way to expose docker.socket of remote Synology via TCP/HTTP(s) so Uptime-Kuma can use it for monitoring non local docker host?

ewoks avatar Dec 20 '23 17:12 ewoks

@ChipSkylark37 did you find a way to expose docker.socket of remote Synology via TCP/HTTP(s) so Uptime-Kuma can use it for monitoring non local docker host?

No, I gave up he instead just monitor the services hosted by the docker.

ChipSkylark37 avatar Dec 20 '23 21:12 ChipSkylark37