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
310 stars 15 forks source link

Unable to parse docker_host #2

Closed rvoosterhout closed 9 months ago

rvoosterhout commented 9 months ago

My uptime kuma is connected to my docker containers using docker.sock. When using the friendly name of the docker connection in the label "kuma.{{container_name}}.docker.docker_host=Donnager", i get unable to parse error in the logs. What should I fill in as option?

BigBoot commented 9 months ago

Uptime Kuma expects the docker host id there, not the name, unfortunately I don't think you can get this id from the UI, if you only ever had a single docker host it, you could just try 1 as the id.

Alternatively you could create a docker monitor using the UI and then use kuma cli to get the id from that using something like this kuma monitor list | jq '. | recurse | objects | select(has("docker_host")) | {host:.docker_host, container:.docker_container}'

rvoosterhout commented 9 months ago

Unfortunately 1 is not working. Where should I enter that command? I tried entering it in the uptime kuma CLI and the autokuma CLI, but I had no success.

BigBoot commented 9 months ago

I'm referring the the Kuma CLI in this repo, you can download prebuilt binaries from the latest release (just download the kuma-<os> corresponding to your OS.

mvnixon commented 2 months ago

Hi, I know this is closed and the instructions above work fine to find the docker host "number", however is there a way to set the docker host number as a variable in the default settings, based on the host that the container was created on, rather than having to specify the docker host in the labels every time?

BigBoot commented 2 months ago

Hey @mvnixon, This isn't something AutoKuma can do automatically, but I could expose the system information struct to the template context, then you could create a map e.g. based on the ID or Name.