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

User ID Question #49

Closed undaunt closed 5 months ago

undaunt commented 6 months ago

Hello,

I'm seeing a line in the uptime-kuma logs that is being generated by autokuma initiated monitors, but I'm not sure why/how.

05/29/2024 04:02:56 PM 2024-05-29T16:02:56-07:00 [MANAGE] INFO: Resume Monitor: 1474 User ID: 1
05/29/2024 04:02:56 PM 2024-05-29T16:02:56-07:00 [MONITOR] INFO: Added Monitor: undefined User ID: 1
05/29/2024 04:02:56 PM 2024-05-29T16:02:56-07:00 [MANAGE] INFO: Resume Monitor: 1474 User ID: 1
05/29/2024 04:02:58 PM 2024-05-29T16:02:58-07:00 [MANAGE] INFO: Resume Monitor: 1475 User ID: 1
05/29/2024 04:02:58 PM 2024-05-29T16:02:58-07:00 [MONITOR] INFO: Added Monitor: undefined User ID: 1

I'm specifying the docker host ID and the notification defaults both as a value of 1, but I'm not sure what is triggering the above. Any insight would be super helpful, thanks!

autokuma compose:

  autokuma:
    image: ghcr.io/bigboot/autokuma:latest
    container_name: autokuma
    restart: unless-stopped
    profiles: ["all","kuma","morty"]
    networks:
      - ${SOCKET_NETWORK}
    depends_on:
      - uptime-kuma
    deploy:
      resources:
        limits:
          memory: 1G
    environment:
      AUTOKUMA__KUMA__URL: http://uptime-kuma:3001
      AUTOKUMA__KUMA__USERNAME: ${KUMA_USER}
      AUTOKUMA__KUMA__PASSWORD: ${KUMA_PASSWORD}
      AUTOKUMA__TAG_NAME: AutoKuma
      AUTOKUMA__DEFAULT_SETTINGS: |- 
        *.notification_id_list: { "1": true }
      AUTOKUMA__ON_DELETE: delete
      AUTOKUMA__SNIPPETS__APP: |-
        {# Assign the first snippet arg for readability #}
        {% set args = args[0] %}

        {# Generate IDs with slugify #}
        {% set id = args.name | slugify %}
        {% if args.service %}
          {% set service_id = args.service | slugify %}
        {% endif %}

        {# Define the top level services/app naming conventions #}
        {% if args.type == "web" or args.type == "solo" %}
          {{ id }}-group.group.name: {{ args.name }}
        {% elif args.type == "web-group" %}
          {{ id }}-group.group.name: {{ args.name }}
          {{ id }}-svc-group.group.parent_name: {{ id }}-group
          {{ id }}-svc-group.group.name: {{ args.name }} App
        {% elif service_id is defined and args.type in ["redis", "mysql", "postgres", "support", "web-support"] %}
          {{ id }}-svc-group.group.parent_name: {{ service_id }}-group
          {{ id }}-svc-group.group.name: {{ args.name }}{% if args.type in ["support", "web-support"] %} App{% endif %}
        {% endif %}

        {# Web containers get http & https checks #}
        {% if args.type == "web-group" or args.type == "web" or args.type == "web-support" %}
          {% if args.type == "web" %}
            {% set parent = id ~ "-group" %}
          {% else %}
            {% set parent = id ~ "-svc-group" %}
          {% endif %}
          {{ id }}-https.http.parent_name: {{ parent }}
          {{ id }}-https.http.name: {{ args.name }} (Web)
          {{ id }}-https.http.url: {{ args.url }}
          {{ id }}-http.http.parent_name: {{ parent }}
          {{ id }}-http.http.name: {{ args.name }} (Internal)
          {% if args.network and args.network == "host" %}
            {{ id }}-http.http.url: http://10.0.20.15:{{ args.internal_port }}
          {% elif args.network and args.network == "vpn" %}
            {{ id }}-http.http.url: http://{{ container_name }}-vpn:{{ args.internal_port }}
          {% else %}
            {{ id }}-http.http.url: http://{{ container_name }}:{{ args.internal_port }}
          {% endif %}
          {# Check for authentication and set basic auth details #}
          {% if args.auth and args.auth == "basic" %}
            {{ id }}-http.http.authMethod = {{ args.auth }}
            {{ id }}-http.http.basic_auth_user = {{ args.auth_user }}
            {{ id }}-http.http.basic_auth_pass = {{ args.auth_pass }}
          {% endif %}
        {% endif %}

        {# Database containers get db specific checks #}
        {% if args.type in ["redis", "mysql", "postgres"] %}
          {{ id }}-db.{{ args.type }}.name: {{ args.name }} (DB)
          {{ id }}-db.{{ args.type }}.parent_name: {{ id }}-svc-group
          {{ id }}-db.{{ args.type }}.database_connection_string: {{ args.db_url }}
        {% endif %}

        {# All containers get a container check #}
        {{ id }}-container.docker.name: {{ args.name }} (Container)
        {% if args.type == "web" or args.type == "solo" %}
          {% set parent_name = id ~ "-group" %}
        {% else %}
          {% set parent_name = id ~ "-svc-group" %}
        {% endif %}
        {{ id }}-container.docker.parent_name: {{ parent_name }}
        {{ id }}-container.docker.docker_container: {{ container_name }}
        {{ id }}-container.docker.docker_host: 1
      DOCKER_HOST: http://socket-proxy:2375
    labels:
      kuma.__app: '{ "name": "AutoKuma", "type": "support", "service": "Uptime-Kuma" }'
undaunt commented 5 months ago

Disregard, seems to be the container that is undefined, not the user.