Error connecting influxDB influxQL from local grafana to local influxdb

Hello everybody,

I’m trying to install Grafana with InfluxDB on an Amazon EC2 instance.
I’ve done it multiple times without problems, but now I can’t figure out what is wrong.

On my EC2 innstance, I’m running both grafana-server 9.1.6 and influxDB 1.8.10 on localhost (127.0.0.1), using default ports. I can connect to influxdb using the CLI, and I created a database with a user and a password.
I have also a HAProxy acting as a SSL proxy for connections coming from the outside, and I can reach Grafana.
… So far so good.
But when I try to add a datasource, I get “error connecting influxDB influxQL”

In my grafana.log file, I see:

logger=tsdb.influxdb t=2022-09-30T20:02:30.604913759Z level=warn msg="error performing influxdb healthcheck" err="error connecting influxDB influxQL"
logger=context traceID=00000000000000000000000000000000 userId=1 orgId=1 uname=admin t=2022-09-30T20:02:30.605359361Z level=info msg="Request Completed" method=GET path=/api/datasources/1/health status=400 remote_addr=127.0.0.1 time_ms=3 duration=3.748238ms size=66 referer=https://ec2-x-x-x-x.eu-central-1.compute.amazonaws.com/datasources/edit/0_4HsdVVz traceID=00000000000000000000000000000000 handler=/api/datasources/:id/health

The influx logs tell me:

Sep 30 20:29:55 ip-172-31-41-149 influxd-systemd-start.sh[487]: ts=2022-09-30T20:29:55.708090Z lvl=info msg="Executing query" log_id=0dFyJv4W000 service=query query="SHOW MEASUREMENTS ON smartmeter"
Sep 30 20:29:55 ip-172-31-41-149 influxd-systemd-start.sh[487]: [httpd] 127.0.0.1 - smartmeter [30/Sep/2022:20:29:55 +0000] "GET /query?db=smartmeter&epoch=ms&q=SHOW+measurements HTTP/1.1" 200 57 "-" "Grafana" a546666f-40fe-11ed-8018-062967ceb866 321

Does anyone have an idea how to fix this?

Cheers!
Wim

It might be a bug in grafana…same error here 9.0.8 is working

1 Like

Thanks, I’ll install a previous version of Grafana and try again…


Wim

hello,
i think you should install a more recent version of influxdb.
is your influxdb instance is running by his own ?
cover this ip adress that i cannot see.

Hi,
Have the same error und connecting issues. I run Grafana and Influx inside docker-compose with treafik and letsencrypt

Here is my compose file:

version: '3'

services:
  grafana:
    labels:
      # SSL redirect requires a separate router (https://github.com/containous/traefik/issues/4688#issuecomment-477800500)
      - 'traefik.http.routers.some-name.entryPoints=port80'
      - 'traefik.http.routers.some-name.rule=host(`YOUR.DOMAIN.TEST`)'
      - 'traefik.http.middlewares.some-name-redirect.redirectScheme.scheme=https'
      - 'traefik.http.middlewares.some-name-redirect.redirectScheme.permanent=true'
      - 'traefik.http.routers.some-name.middlewares=some-name-redirect'
      # SSL endpoint
      - 'traefik.http.routers.some-name-ssl.entryPoints=port443'
      - 'traefik.http.routers.some-name-ssl.rule=host(`YOUR.DOMAIN.TEST`)'
      - 'traefik.http.routers.some-name-ssl.tls=true'
      - 'traefik.http.routers.some-name-ssl.tls.certResolver=le-ssl'
      - 'traefik.http.routers.some-name-ssl.service=some-name-ssl'
      - 'traefik.http.services.some-name-ssl.loadBalancer.server.port=3000'
    image: grafana/grafana:9.2.0 # or probably any other version
    volumes:
      - grafana-data:/var/lib/grafana
    environment:
      - GF_SERVER_ROOT_URL=https://YOUR.DOMAIN.TEST
      - GF_SERVER_DOMAIN=YOUR.DOMAIN.TEST
      - GF_USERS_ALLOW_SIGN_UP=false
      - GF_SECURITY_ADMIN_USER=SECURE_USERNAME
      - GF_SECURITY_ADMIN_PASSWORD=SECURE_PASS

  traefik:
    image: traefik:v2.9.1
    ports:
      - '80:80'
      - '443:443'
      # expose port below only if you need access to the Traefik API
      #- "8080:8080"
    command:
      #- "--log.level=DEBUG"
      #- "--api=true"
      - '--providers.docker=true'

      - '--entryPoints.port443.address=:443'
      - '--entryPoints.port80.address=:80'

      - '--certificatesResolvers.le-ssl.acme.tlsChallenge=true'
      - '--certificatesResolvers.le-ssl.acme.email=YOUR_EMAIL_ADDRESS'
      - '--certificatesResolvers.le-ssl.acme.storage=/letsencrypt/acme.json'
    volumes:
      - traefik-data:/letsencrypt/
      - /var/run/docker.sock:/var/run/docker.sock
  influx:
    image: influxdb:1.8 # or any other recent version
    labels:
      # SSL endpoint
      - 'traefik.http.routers.some-name-influx-ssl.entryPoints=port8086'
      - 'traefik.http.routers.some-name-influx-ssl.rule=host(`YOUR.DOMAIN.TEST`)'
      - 'traefik.http.routers.some-name-influx-ssl.tls=true'
      - 'traefik.http.routers.some-name-influx-ssl.tls.certResolver=le-ssl'
      - 'traefik.http.routers.some-name-influx-ssl.service=some-name-influx-ssl'
      - 'traefik.http.services.some-name-influx-ssl.loadBalancer.server.port=8086'
    restart: always
    volumes:
      - influx-data:/var/lib/influxdb
    environment:
      - INFLUXDB_DB=SOME_DB_NAME # set any other to create database on initialization
      - INFLUXDB_HTTP_ENABLED=true
      - INFLUXDB_HTTP_AUTH_ENABLED=true

      - INFLUXDB_ADMIN_USER=SECURE_USERNAME
      - INFLUXDB_ADMIN_PASSWORD=SECURE_PASS

volumes:
  traefik-data:
  grafana-data:
  influx-data:

I tried several options in the Grafana InfluxQL data sources and got exactly the same errors as @wimdehul with all of them. Even downgraded to Grafana 9.1.8 save problems.

Logging into the influx container and starting the influx cmd works fine. Only with the command “show databases” I had to enter the command “auth” before and enter my credentials from the docker-compose Influx section. That worked. I also tried with http and https in the Grafana URL. With localhost or docker-compose servicename (influx) but also with the container IP address. All did not work unfortunately.

Can you guys help please?

Cheers
CodeCook