BigBoot / AutoKuma

AutoKuma is a utility that automates the creation of Uptime Kuma monitors based on Docker container labels. With AutoKuma, you can eliminate the need for manual monitor creation in the Uptime Kuma UI.
MIT License
247 stars 15 forks source link

Snippet Usage Questions (auto-tagging & docker socket) #70

Open sameleff opened 3 weeks ago

sameleff commented 3 weeks ago

When creating new monitors via snippets:

  1. Tags are automatically created even though AUTOKUMA_TAG_NAME and AUTOKUMA_TAG_COLOR are not used. Is there a way to disable tagging while using snippets?
  2. Docker-type monitors are not linked to the appropriate docker host; docker socket is mounted to both uptime-kuma and autokuma. Once manually configured using the edit menu within Uptime Kuma, the monitor created by the snippet works. How to link a docker monitor created by a snippet to the docker host in Uptime Kuma?

I am running on unraid in case that changes anything.

Here is my config:

services:
    homepage:
        image: ghcr.io/gethomepage/homepage:latest
        container_name: homepage
        volumes:
          - /mnt/user/appdata/homepage/config:/app/config
          - /mnt/user/appdata/homepage/icons:/app/public/icons
          - /var/run/docker.sock:/var/run/docker.sock
        ports:
          - 4060:3000
        labels:
          - kuma.__web="<my local IP>", "4060"

    uptime-kuma:
        image: louislam/uptime-kuma:1
        container_name: uptimekuma
        restart: unless-stopped
        ports:
          - 3001:3001
        volumes:
          - /mnt/user/appdata/uptime-kuma:/app/data
          - /var/run/docker.sock:/var/run/docker.sock

      autokuma:
        image: ghcr.io/bigboot/autokuma:latest
        container_name: autokuma
        restart: unless-stopped
        environment:
          AUTOKUMA__KUMA__URL: http://<my local ip>:3001
          AUTOKUMA__KUMA__USERNAME: <my uptime-kuma user>
          AUTOKUMA__KUMA__PASSWORD: <my uptime-kuma pw>
          # AUTOKUMA__TAG_NAME: AutoKuma
          # AUTOKUMA__TAG_COLOR: "#42C0FB"
          AUTOKUMA__DEFAULT_SETTINGS: |- 
             docker.docker_container: {{container_name}}
             http.max_redirects: 10
             *.max_retries: 3
             *.interval: 60
          AUTOKUMA__SNIPPETS__WEB: |- 
             {{container_name}}.docker.name: {{container_name}}
             {{container_name}}.docker.docker_container: {{container_name}}
          AUTOKUMA__DOCKER__HOSTS: unix:///var/run/docker.sock
          AUTOKUMA__DOCKER__LABEL_PREFIX: kuma
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock

The monitor connects once I populate the "Docker Host" field in this screenshot. image

sameleff commented 3 weeks ago

Just found your previous reply here which answers my first question...not sure why I didn't find it either. Looks like it's not possible to disable the tagging.

BigBoot commented 3 weeks ago

AutoKuma requires the tag to associate a monitor with a "autokuma id" (i.e. the id portion of a label), I've though about using the description or the title instead but ultimately settled for labels as the least intrusive way

sameleff commented 2 weeks ago

Is there a workaround for the 2nd item (docker host is not automatically assigned to the new monitor created by autokuma)?

BigBoot commented 5 days ago

Sorry I must've missed the comment, you can assign a docker host you created using the UI or the CLI, e.g.

kuma.my_monitor.docker.docker_host: <id>

To get the id use the kuma CLI:

kuma docker-host list --pretty

You can also assign this as default to all docker montors using AUTOKUMA__DEFAULT_SETTINGS or snippets

Additionally I've recently added support for creating docker hosts using AutoKuma itself, though this is only available on master and is still experimental.