Snippet Usage Questions (auto-tagging & docker socket)
Closed this issue · 5 comments
When creating new monitors via snippets:
- Tags are automatically created even though
AUTOKUMA_TAG_NAME
andAUTOKUMA_TAG_COLOR
are not used. Is there a way to disable tagging while using snippets? - 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.
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.
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
Is there a workaround for the 2nd item (docker host is not automatically assigned to the new monitor created by autokuma)?
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.
that worked! Thanks very much. For anyone else in the future, here is my snippet (I manually created the docker-host in Uptime Kuma):
AUTOKUMA__SNIPPETS__DOCKER: |-
{{container_name}}.docker.name: {{container_name}}
{{container_name}}.docker.docker_container: {{container_name}}
{{container_name}}.docker.docker_host: 1
Using the kuma.__docker
label automatically creates the appropriate monitor in Uptime Kuma.