Skip to content

InfluxDB on Traefik 2.0 is missing the user on the API callback #5530

@killua99

Description

@killua99

Do you want to request a feature or report a bug?

Bug

Did you try using a 1.7.x configuration for the version 2.0?

  • Yes
  • No

What did you do?

I'm trying to use influxdb as metric but the http API callback might has change, because it get a 403 user is require

The error log is quite simple, the user is missing, it might be because the API has change on the endpoing or what?

time="2019-09-28T00:20:55Z" level=error msg="Error while writing to InfluxDB: {\"error\":\"user is required to write to database \\\"db_influxdb\\\"\"}\n" metricsProviderName=influxdb

I've setup everything as the documentation said for docker.

What did you expect to see?

Just a normal entry on influxdb for metrics

What did you see instead?

An error on traefik log:

time="2019-09-28T00:20:55Z" level=error msg="Error while writing to InfluxDB: {\"error\":\"user is required to write to database \\\"db_influxdb\\\"\"}\n" metricsProviderName=influxdb

Output of traefik version: (What version of Traefik are you using?)

/ # traefik version
Version:      2.0.1
Codename:     montdor
Go version:   go1.13.1
Built:        2019-09-26T16:25:52Z
OS/Arch:      linux/arm64

What is your environment & configuration (arguments, toml, provider, platform, ...)?

api:
  insecure: true

providers:
  docker:
    network: swarm_proxy
    endpoint: "unix:///var/run/docker.sock"
    swarmMode: true

entryPoints:
  web:
    address: ":80"
  websecure:
    address: ":443"

certificatesResolvers:

  killua_me:
    acme:
      email: guevara.luigi@protonmail.com
      storage: acme.json
      dnsChallenge:
        provider: digitalocean
        delayBeforeCheck: 0

  php_org_es:
    acme:

      email: guevara.luigi@protonmail.com
      storage: acme.json

      dnsChallenge:
        provider: cloudflare
        delayBeforeCheck: 0

      httpChallenge:
        entryPoint: web

metrics:
  influxdb:
    address: http://192.168.1.170:8086
    protocol: http
    database: db_influxdb
    username: irrelevant 
    password: irrelevantx2

traefik docker compose:

# docker stack deploy -c docker-compose.yml traefik --prune
version: '3.7'

services:

  traefik:
    image: traefik:montdor
    environment:
      - DO_AUTH_TOKEN=DEtoken
      - CF_API_EMAIL=an-email
      - CF_API_KEY=DEkey
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    networks:
      - swarm_proxy
    deploy:
      restart_policy:
        condition: on-failure
      placement:
        constraints:
          - node.role == manager
        preferences:
          - spread: node.id
      labels:
        - traefik.enable=true
        - traefik.docker.network=swarm_proxy
        - traefik.http.services.traefik.loadbalancer.server.port=8080
        - traefik.http.routers.traefik.rule=Host(`traefik.killua.me`)
        - traefik.http.routers.traefik.entrypoints=websecure
        - traefik.http.routers.traefik.tls.certresolver=killua_me
        - traefik.http.middlewares.traefik.redirectscheme.scheme=https
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /mnt/k_nfs/stacks/traefik/traefik.yml:/traefik.yml
      - /mnt/k_nfs/stacks/traefik/acme.json:/acme.json

networks:
  swarm_proxy:
    driver: overlay
    name: swarm_proxy
    attachable: true

Influx docker compose

# docker stack deploy -c docker-compose.yml influxdb --prune --resolve-image never
version: '3.7'

services:

  influxdb:
    image: influxdb
    networks:
      - influxdb
    ports:
      - "8086:8086"
      - "8083:8083"
    environment:
      INFLUXDB_DB: db_influxdb
      INFLUXDB_HTTP_AUTH_ENABLED: "true"
      INFLUXDB_USER: myUserK
      INFLUXDB_USER_PASSWORD: "AfgyubexjkixbSfygvb.rSebtrdawd"
    volumes:
      - /home/alarm/influxdb:/var/lib/influxdb
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.labels.internal == true
      restart_policy:
        condition: on-failure
        delay: 15s
        max_attempts: 3
      labels:
        - traefik.enable=false

  chronograf:
    image: chronograf
    networks:
      - influxdb
      - swarm_proxy
    ports:
      - "8888:8888"
    command: sh -c 'chronograf --influxdb-url=http://influxdb:8086'
    deploy:
      mode: replicated
      replicas: 1
      placement:
        constraints:
          - node.labels.public == true
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
      labels:
        - traefik.enable=true

        - traefik.docker.network=swarm_proxy

        - traefik.http.routers.chronograf_http.entrypoints=web
        - traefik.http.routers.chronograf_http.rule=Host(`influxdb.killua.me`)
        - traefik.http.routers.chronograf_http.middlewares=https-only

        - traefik.http.middlewares.https-only.redirectscheme.permanent=true
        - traefik.http.middlewares.https-only.redirectscheme.scheme=https

        - traefik.http.routers.chronograf_https.entrypoints=websecure
        - traefik.http.routers.chronograf_https.rule=Host(`influxdb.killua.me`)
        - traefik.http.routers.chronograf_https.tls.certresolver=killua_me
        - traefik.http.routers.chronograf_https.service=chronograf

        - traefik.http.services.chronograf.loadbalancer.server.port=8888

networks:
  swarm_proxy:
    external: true
  influxdb:
    name: influxdb
    driver: overlay
    attachable: true

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions