ytyou / ticktock

TickTockDB is an OpenTSDB-like time series database, with much better performance.
GNU General Public License v3.0
72 stars 8 forks source link

Connecting TicktockDB to Grafana not working #65

Open juggledad opened 6 months ago

juggledad commented 6 months ago

I have ticktock running on a Raspberry Pi 2 model B v1.1 and it has been running great for several weeks. NOTE: this is not a docker image. I'm using Node-RED to collect data from some sensors (bme280's) in three different locations. In NR I can create graphs of the data with no problem.

Now I want to use Grafana to connect to the DB. I installed Grafana and logged into Grafana I then selected the Connections option from the hamburger menu and selected OpenTSDB as the Data source Next I open the OpenTSDB Data source and set the HTTP URL to http://192.168.1.192:6182 (192.168.1.192 is the IP of the RPI) I click 'Save and Test' and it shows 'Data source is working' I click the 'Explore view' option (at bottom of the screen)

When I click on the 'Metric name' option it shows 'No options found'

Any suggestions?

ylin30 commented 6 months ago

image

Do you mean this? It works here. TT supports OpenTSDB API (/api/suggest) which enables this feature in Grafana. Have you added any metrics to TT already? You can try this curl cmd to see if any response:

curl -s -v 'http://192.168.1.192:6182/api/suggest?type=metrics&q=&max=100'
juggledad commented 6 months ago

Yes I have metrics

pmw@ticktockpi:~ $ curl -s -v 'http://192.168.1.192:6182/api/suggest?type=metrics&q=&max=100'

And in node-red I can create graphs using the node-red nodes so I decided to try Grafana. Screenshot 2024-01-11 at 2 43 28 PM

so I made the connection but when I try to use it I get this: Screenshot 2024-01-11 at 2 43 08 PM

ylin30 commented 6 months ago

hm...What version of Grafana are you using? Mine is v9.3.2 (21c1d14e91).

Can u also inspect the network traffic from Grafana to TT? If you use Chrome as your browser, do this:

  1. Right click on the grafana webpage, select "Inspect" from the pop-up manu; image

  2. Select the 'network' tab in the left panel

  3. Click the dropdown button in Metric name text box

  4. You should see if Grafana sends /api/suggest to TT and responses. image

Other browsers should be similar. You can google it.

juggledad commented 6 months ago

pmw@ticktockpi:~ $ /usr/share/grafana/bin/grafana -v grafana version 10.2.3

This is the most interesting thing I found Screenshot 2024-01-12 at 5 36 41 AM Screenshot 2024-01-12 at 5 36 50 AM

juggledad commented 6 months ago

Update: I downgraded to Grafana v9.3.2 and I am now seeing the metrics

ylin30 commented 6 months ago

pmw@ticktockpi:~ $ /usr/share/grafana/bin/grafana -v

grafana version 10.2.3

This is the most interesting thing I found

Screenshot 2024-01-12 at 5 36 41 AM

Screenshot 2024-01-12 at 5 36 50 AM

Note the q=cpu parameter. This causes the empty response since you didn't have metrics with cpu* prefix. I tend to think it's a bug In grafana v10.

juggledad commented 6 months ago

Well at least you know about this if someone else upgrades to v10 of Grafana.

ylin30 commented 6 months ago

yah! Thanks for the reporting. I add this info in FAQ.