Hello all,
I use Influxdb together with Grafana. Now Grafana does not write any graphs since a few weeks and only gives the message “no Data”. In the logs I get the following error: warning/InfluxdbWriter: Flush failed, cannot connect to InfluxDB: Error: TLS certificate validation failed: code 62: Hostname mismatch
For example: did you get/create a new certificate, did you change Grafana’s
data source, did you restart either machine (I’m assuming Influx and Grafana
are not running on the same server)?
Look for anything you can think of which happened immediately before the
problem first occurred.
What URL have you told Grafana to use to connect to InfluxDB?
What is the full name of the machine where InfluxDB is running
(eg:server.example.com)?
What type of TLS certificate are you using?
Common options would be:
a) self-signed
b) Let's Encrypt
c) some other external certificate provider
d) signed by a CA you run yourself
What is the name contained in the certificate?
You can find this with the command:
openssl x509 -in certificate.crt -text -noout
You’re looking for the “Subject:” line and the value of the field “CN” (there
may be additional fields, there may not).
If you do not wish to publish here the real name of your server etc., then by
all means obfuscate the information in your reply but be sure to leave it
quite clear whether one thing is the same as another thing, or the two things
are different; for example if you have two server names foo.example.com and bar.example.com but you do not wish to reveal your domain name example.com
then change these to foo.mydomain.test and bar.mydomain.test (for example) but
make sure you always change foo.example.com to foo.mydomain.test so we can see
that you mean the same thing each time.
Hi Antonius, Influx and Grafana are both running on the same database server. The only thing that has changed is that my wildcard certificate has expired. Under /etc/influxdb/ I saw that I have a self-signed certificate and a self-signed private key. I have re-integrated the wildcard certificate under /etc/ssl/*.
As a certificate I have a wildcard certificate on my server. As I see it in the Influx configuration, however, a self-signed certificate is used there.
I am sending you an image with the datasource configuration.
I hope my information helps you and you can help me further. To be honest, I think there is something wrong with the certificates but I don’t know how to fix it.
Hello,
I have now exchanged on the wildcard certificate for Grafana, as this had also expired. Now my Grafana reports the following: InfluxDB Error: Bad Gateway. From the logs I could get the following message:
[2022-05-14 16:34:23 +0200] warning/InfluxdbWriter: Can't connect to InfluxDB on host 'graph.server.com' port '8086'.
[2022-05-14 16:34:23 +0200] warning/InfluxdbWriter: Flush failed, cannot connect to InfluxDB: Error: connect: Connection refused
My mistake, of course I meant the same domain. I will now deactivate TLS everywhere. Where do I have to do all this? In Grafana.ini and in influxdb.conf?
That is why I specifically asked you to ensure that any obfuscation was done in
a consistent manner:
“If you do not wish to publish here the real name of your server etc., then by
all means obfuscate the information in your reply but be sure to leave it
quite clear whether one thing is the same as another thing, or the two things
are different; for example if you have two server names foo.example.com and bar.example.com but you do not wish to reveal your domain name example.com
then change these to foo.mydomain.test and bar.mydomain.test (for example) but
make sure you always change foo.example.com to foo.mydomain.test so we can see
that you mean the same thing each time.”
I will now deactivate TLS everywhere. Where do I have to do all this? In
Grafana.ini and in influxdb.conf?
I believe that is sufficient, yes.
I have now also changed the HTTP url to localhost
Good luck. Don’t make life more complicated than it needs to be
Hi, I followed your instructions and changed to localhost:8086. now, however, a bad request error appears, it still cannot collect any data. Here is an entry from the logs for you.
I’m surprised it’s logging TLS handshake again, as I’ve commented it out.
Thank you for your great support!
[2022-05-14 17:49:03 +0200] warning/InfluxdbWriter: TLS handshake with host failed.
[2022-05-14 17:49:03 +0200] warning/InfluxdbWriter: Flush failed, cannot connect to InfluxDB: Error: handshake: wrong version number
hello, i was actually able to solve the bad request error on my own. Now my Grafana shows only ,No Data". How would you tactically proceed with the troubleshooting?
The Grafana server localhost:3000 should communicate with the InfluxDB localhost:8086.
I would use Grafana to show me the query it creates and the result which is
returned (I think this is still called the Query Inspector).
I would then submit the same query to InfluDB using its command line client and
see whether I get the same data back.
If the result is the same, then the problem is either the query, or the fact
that there is no data.
If the result is different, then I suggest you ask on the Grafana list / forum,
because if you get a reult from InfluxDB but not from Grafana, then the problem
points to Grafana.