louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
58.87k stars 5.29k forks source link

Documentation on how to setup docker container monitor #2093

Closed joerich closed 1 year ago

joerich commented 2 years ago

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

🛡️ 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

rezzorix commented 2 years ago

@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/

c0derMo commented 2 years ago

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

ChipSkylark37 commented 2 years ago

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.

joerich commented 2 years ago

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!

c0derMo commented 2 years ago

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.

ChipSkylark37 commented 2 years ago

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.

rezzorix commented 2 years ago

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.

c0derMo commented 2 years ago

@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?

joerich commented 2 years ago

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.

rezzorix commented 2 years ago

@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).

github-actions[bot] commented 1 year ago

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] commented 1 year ago

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

ewoks commented 10 months ago

@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?

ChipSkylark37 commented 10 months ago

@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.