Grafana + InfluxDB Error: Bad Gateway

Hey everyone,
I have not been able to write graphs for a while. My Grafana gives the error Error: Bad Gateway. I am working with InfluxDB 1. In the logs I could find the following message:

[2022-05-15 12:34:38 +0200] warning/InfluxdbWriter: TLS handshake with host 'grafana.domain.com' failed.
[2022-05-15 12:34:38 +0200] warning/InfluxdbWriter: Flush failed, cannot connect to InfluxDB: Error: handshake: wrong version number

logger=context traceID=00000000000000000000000000000000 userId=2 orgId=1 uname= t=2022-05-15T10:44:27.86+0200 lvl=info msg="Request Completed" method=GET pa$
logger=data-proxy-log userId=2 orgId=1 uname= path=/api/datasources/proxy/1/query remote_addr=[::1] referer="https://localhost:3000/d-solo/000000005/icinga2$
logger=context traceID=00000000000000000000000000000000 userId=2 orgId=1 uname= t=2022-05-15T10:44:28.01+0200 lvl=eror msg="Request Completed" method=POST p$
$nded with a status of 502 (Bad Gateway)" url="https://localhost:3000/api/datasources/proxy/1/query?db=test&epoch=ms"
logger=plugin.grafana-image-renderer t=2022-05-15T10:44:28.02+0200 lvl=eror msg="Browser console error" column=26144 msg=JSHandle@object url=https://localho$
logger=plugin.grafana-image-renderer t=2022-05-15T10:44:28.03+0200 lvl=eror msg="Browser uncaught exception" error="Error: Object"
logger=data-proxy-log userId=2 orgId=1 uname= path=/api/datasources/proxy/1/query remote_addr=[::1] referer="https://localhost:3000/d-solo/000000005/icinga2$
logger=context traceID=00000000000000000000000000000000 userId=2 orgId=1 uname= t=2022-05-15T10:44:28.06+0200 lvl=eror msg="Request Completed" method=POST p$
logger=plugin.grafana-image-renderer t=2022-05-15T10:44:28.06+0200 lvl=eror msg="Browser console error" msg="Failed to load resource: the server responded w$
logger=plugin.grafana-image-renderer t=2022-05-15T10:44:28.06+0200 lvl=eror msg="Browser console error" msg=JSHandle@object url=https://localhost:3000/publi$
logger=plugin.grafana-image-renderer t=2022-05-15T10:44:28.08+0200 lvl=eror msg="Browser uncaught exception" error="Error: Object"

Can you help me?

Hi @ShowMeYourSkil1

Welcome to the forum :tada:

As far as I can tell, this looks like a Grafana/InfluxDB issue rather than a k6 one? Could you please give me more context about your setup and workflow? Also it looks like you’ve already asked that question on the Influx support forum, and I believe you would probably get more accurate support there :crossed_fingers:

When running InfluxDB using systemd (Ubuntu, Debian, CentOS), you might encounter errors in the InfluxDB logs (via journalctl -u influxdb) like:

error msg=“Unable to open series file”
run: open server: open tsdb store: mkdir /var/lib/influxdb/data/_internal/_series/00: permission denied
When InfluxDB is installed with systemd, an influxdb user and group is automatically created. If the user runs an influxd process directly from their login shell, it can generate new series files not accessible by the influxdb user. In this case, when systemd starts the InfluxDB service (via sudo systemctl start influxdb), the InfluxDB process will exit because it cannot access the leftover files owned by the root user.

To resolve this issue, set all files in the InfluxDB directories to be owned by the influxdb user and group. Run the following command:

sudo chown -R influxdb:influxdb /var/lib/influxdb/*
Alternatively, if the data is not important, reset the database by removing all files:

sudo rm -rf /var/lib/influxdb/

Regards,
Rachel Gomez