Grafana Dashboard - No Data

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

Can you help me with this problem?

  1. What changed “a few weeks” ago?

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.

  1. What URL have you told Grafana to use to connect to InfluxDB?

  2. What is the full name of the machine where InfluxDB is running
    (eg:server.example.com)?

  3. 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
  1. 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.

Antony.

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 URL I have https://grafana.DOMAIN.com:PORT

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

Well, in your first reply you said the URL was https://grafana.DOMAIN.com

Now you say that Grafana cannot connect to graph.server.com

Which is the correct name for the machine?

And, since both Grafana and InfluxDB are running on the same server, why are
you bothering with TLS at all?

Why not just connect to http://localhost:8086 ?

Antony.

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?

I have now also changed the HTTP url to localhost

My mistake, of course I meant the same domain.

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 :slight_smile:

Antony.

1 Like

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! :slight_smile:

[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

Hi, I followed your instructions and changed to localhost:8086.

Did you do as you said “I will now deactivate TLS everywhere. Where do I have
to do all this? In Grafana.ini and in influxdb.conf?”

[2022-05-14 17:49:03 +0200] warning/InfluxdbWriter: TLS handshake with host
failed.

So, try these three commands and see whether they show anything useful:

grep -ri https /etc/grafana /etc/influxdb
grep -ri tls /etc/grafana /etc/influxdb
grep -ri ssl /etc/grafana /etc/influxdb

(Yes, I know they could be combined into a single command, but I don’t want to
make things too obscure with grep or bash syntax for now.)

Antony.

I found out this information

grep -ri https /etc/grafana /etc/influxdb

grep -ri tls /etc/grafana /etc/influxdb

grep -ri ssl /etc/grafana /etc/influxdb

Okay, in that case I need to bow out and defer to someone who can see
screenshots, and then advise you further.

Best wishes,

Antony.

1 Like

Hey @Pooh ,
after further trying and debugging I was able to find the following log entries. Can you look over there again and comment on it?

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/test$
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/test$
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"

Well, I see that you’re still using httpS even with localhost.

You can get this to work, but I don’t think it’s the simplest approach.

I’m not quite sure why the log file contains browser errors (although you
didn’t say which log file this is that you’ve wuoted from).

Unfortunately the following truncated error was probably going to be the
useful one:

msg="Failed to load resource: the server responded w$

…what did the server respond with, I wonder?

Antony.

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.

Thank you for your support!!!

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.

Antony.

Thank you for your tips! I will try to implement them :slight_smile: