Multi Agent Not Working (traefik-log-dashboard discussion #90)

:speech_balloon: GitHub discussion traefik-log-dashboard #90 in Help, started by keonramses on GitHub

Dashboard is trying to access the default agent URL, despite entering my agent and it connecting successfully

External Image

External Image

Compose Section:

traefik-agent-main:
    image: hhftechnology/traefik-log-dashboard-agent:latest
    container_name: traefik-agent-main
    restart: unless-stopped
    ports:
      - 5100:5000
    volumes:
      - ${DOCKER_DATA_DIR}/traefik/logs:/logs:ro
      - ${DOCKER_STACKS_DIR}/pangolin/config/traefik/maxmind:/geoip:ro
      - ${DOCKER_DATA_DIR}/traefik/logs/log-positions:/data
    environment:
      - TRAEFIK_LOG_DASHBOARD_ACCESS_PATH=/logs/access.log
      - TRAEFIK_LOG_DASHBOARD_AUTH_TOKEN=${TRAEFIK_AGENT_MAIN_TOKEN}
      - TRAEFIK_LOG_DASHBOARD_SYSTEM_MONITORING=true
      - TRAEFIK_LOG_DASHBOARD_GEOIP_ENABLED=true
      - TRAEFIK_LOG_DASHBOARD_GEOIP_CITY_DB=/geoip/GeoLite2-City.mmdb
    networks:
      - homelab
  traefik-agent-pangolin:
    image: hhftechnology/traefik-log-dashboard-agent:latest
    container_name: traefik-agent-pangolin
    restart: unless-stopped
    ports:
      - 5101:5000
    volumes:
      - ${DOCKER_STACKS_DIR}/pangolin/config/traefik/logs:/logs:ro
      - ${DOCKER_STACKS_DIR}/pangolin/config/traefik/maxmind:/geoip:ro
      - …

---
đź’¬ Join in here or [on GitHub](https://github.com/hhftechnology/traefik-log-dashboard/discussions/90).
<!-- hhf-forum-sync -->

hhftechnology commented on GitHub:

your log paths are incorrect, please verify them

keonramses commented on GitHub:

I am not sure what I need to verify here. When I use the agent url env on the dashboard container (single agent), the logs load up in the dashboard.

keonramses commented on GitHub:

If no agent url env is specified in the dashboard container it keeps trying to connect to the default agent.

keonramses replied in a thread on GitHub to keonramses:

No changes were made to the agent. Just specifying the env variable and you can see that the logs load up

External Image

External Image

External Image

External Image

keonramses replied in a thread on GitHub to hhftechnology:

The log paths on my end are correct and are the exact path I used with v1. I even deleted the log file and confirmed it was regenerated in my specified path.

seanob86 replied in a thread on GitHub to keonramses:

I got the same issue.
Set the env agent variables for a single agent set up, all works no issues. This confirms log location is correct.

Remove the env variables and manually add the agent url and token for multi agent setup. Nothing is fetched from the agent.

@​hhftechnology i don’t thing this should be closed.

hhftechnology replied in a thread on GitHub to keonramses:

Default agent has to set via env. You can’t set it via UI, there is no db and all other agents are stored in browser memory. The first agent has to be set via env file compulsory to start the dashboard.

hhftechnology replied in a thread on GitHub to keonramses:

@​seanob86 @​keonramses

seanob86 replied in a thread on GitHub to keonramses:

@​hhftechnology hmm, that’s how I originally attempted multi agents. But the secondary agent, although would connect and show as online does not populate data into the dashboard after switching to that agent in the dashboard. Primary works via the env.

To test further I take my secondary and configure with the agent env. That then populates into the dashboard. But if I add my original primary as my secondary via UI, the same issue is encountered

seanob86 replied in a thread on GitHub to keonramses:

services:
  traefik-agent:
    image: hhftechnology/traefik-log-dashboard-agent:latest
    container_name: traefik-log-dashboard-agent
    restart: unless-stopped
    volumes:
      - /mnt/cache/appdata/traefik/logs/access.log:/logs/access.log:ro
      - /mnt/cache/appdata/traefikdashboard/data/geoip:/geoip:ro
      - /mnt/cache/appdata/traefikdashboard/data/positions:/data
    environment:
      - TRAEFIK_LOG_DASHBOARD_ACCESS_PATH=/logs/access.log
      - TRAEFIK_LOG_DASHBOARD_ERROR_PATH=/logs/access.log
      - TRAEFIK_LOG_DASHBOARD_AUTH_TOKEN=[redacted]
      - TRAEFIK_LOG_DASHBOARD_GEOIP_ENABLED=true
      - TRAEFIK_LOG_DASHBOARD_GEOIP_CITY_DB=/geoip/GeoLite2-City.mmdb
      - TRAEFIK_LOG_DASHBOARD_GEOIP_COUNTRY_DB=/geoip/GeoLite2-Country.mmdb
    networks:
      - traefik

  traefik-dashboard:
    image: hhftechnology/traefik-log-dashboard:latest
    container_name: traefik-log-dashboard
    restart: unless-stopped
    environment:
      - AGENT_API_URL=http://traefik-agent:5000
      - AGENT_API_TOKEN=[redacted]
      - NODE_ENV=production
    labels:
      traefik.enable: true
      traefik.http.routers.traefikdashboard.entrypoints: https
      traefik.http.routers.traefikdashboard.rule: Host(`traefik-dashboard.example.com`)
      traefik.http.services.traefikdashboard.loadbalancer.server.port: 3000
    networks:
      - traefik

networks:
  
    name: traefik-net
    external: true

Secondary Agent

…

  traefik-agent:
    image: hhftechnology/traefik-log-dashboard-agent:latest
    container_name: traefik-agent
    ports:
      - "5000:5000"
    networks:
      - proxy
    volumes:
      - /var/log/traefik/:/logs/:ro
      - ./traefik-dashboard/data/geoip:/geoip:ro
      - ./traefik-dashboard/data/positions:/data
    environment:
      - TRAEFIK_LOG_DASHBOARD_ACCESS_PATH=/logs/access.log
      - TRAEFIK_LOG_DASHBOARD_ERROR_PATH=/logs/traefik.log
      - TRAEFIK_LOG_DASHBOARD_AUTH_TOKEN=[redacted]
      - TRAEFIK_LOG_DASHBOARD_GEOIP_ENABLED=true
      - TRAEFIK_LOG_DASHBOARD_GEOIP_CITY_DB=/geoip/GeoLite2-City.mmdb
      - TRAEFIK_LOG_DASHBOARD_GEOIP_COUNTRY_DB=/geoip/GeoLite2-Country.mmdb

External Image

Dashboard logs don’t seem to be fetching the secondary agent logs

Fetching from agent: http://traefik-agent:5000/api/logs/access?position=-1&lines=1000&tail=false
Agent returned 1000 logs
Fetching from agent: http://traefik-agent:5000/api/logs/access?position=-1&lines=1000&tail=false
Agent returned 1000 logs
Fetching from agent: http://traefik-agent:5000/api/logs/access?position=-1&lines=1000&tail=false
Agent returned 1000 logs
Fetching from agent: http://traefik-agent:5000/api/logs/access?position=-1&lines=1000&tail=false
Agent returned 1000 logs
Fetching from agent: http://traefik-agent:5000/api/logs/access?position=-1&lines=1000&tail=false
Agent returned 1000 logs
Fetching from agent: …

hhftechnology replied in a thread on GitHub to keonramses:

change the ports or the name atleast for the second agent, it thinks both are same

seanob86 replied in a thread on GitHub to keonramses:

Still no luck. Again, I switched between primary and secondary agent for env in my compose file. Still, whatever I put as env, that agent will report and whatever is added in the UI does not.

The only thing I can do is toggle between agents in the dashboard. But switching to secondary doesn’t report any secondary traefik logs and nether does it report CPU/Memory/Disk Usage (switching to secondary just reports the primary machine CPU/Memory/Disk)

Updated secondary agent compose. I changed both name and port to 5001

  traefik-agent-vps:
    image: hhftechnology/traefik-log-dashboard-agent:latest
    container_name: traefik-agent-vps
    ports:
      - "5001:5000"
    networks:
      - proxy
    volumes:
      - /var/log/traefik/:/logs/:ro
      - ./traefik-dashboard/data/geoip:/geoip:ro
      - ./traefik-dashboard/data/positions:/data
    environment:
      - TRAEFIK_LOG_DASHBOARD_ACCESS_PATH=/logs/access.log
      - TRAEFIK_LOG_DASHBOARD_ERROR_PATH=/logs/traefik.log
      - TRAEFIK_LOG_DASHBOARD_AUTH_TOKEN=[redacted]
      - TRAEFIK_LOG_DASHBOARD_GEOIP_ENABLED=true
      - TRAEFIK_LOG_DASHBOARD_GEOIP_CITY_DB=/geoip/GeoLite2-City.mmdb
      - TRAEFIK_LOG_DASHBOARD_GEOIP_COUNTRY_DB=/geoip/GeoLite2-Country.mmdb

External Image

External Image

hhftechnology replied in a thread on GitHub to keonramses:

Tomorrow I will try to recreate it, a bit late here. Currently I am running 33 agents all from ui.

keonramses replied in a thread on GitHub to keonramses:

Thank you.

keonramses replied in a thread on GitHub to keonramses:

@​hhftechnology, did you have a chance to look at this?

hhftechnology replied in a thread on GitHub to keonramses:

Yes, I have re coded it, moved to sqlite db. It’s there on the dev-dashboard tag. Add volume. ./data/dashboard

hhftechnology replied in a thread on GitHub to keonramses:

Out for holidays for a couple of days

keonramses replied in a thread on GitHub to keonramses:

I can confirm it works. I will review and report any issues I come across. Thank you, please enjoy your time off.

seanob86 replied in a thread on GitHub to keonramses:

Also works here. The only thing I had to do was change ownership of mapped folder to 1001:1001 otherwise the db would not get created. Also seems like the db resides in /app/data which I couldn’t find in this post or anywhere else. e.g. - ./data/dashboard:/app/data