Export Grafana data to CSV file from NodeRed Dashboard

I have integrated Grafana chart into NodeRed Dashboard by following the flow here: https://flows.nodered.org/flow/8e96b8630c4edc866aa0459354033c9b/in/u1hmO7pQPVSi
Now I am wondering if we can export the data shown in the Grafana chart to CSV file directly, instead of creating another flow to export data from Influxdb? In Grafana, there is an option to Inspect data and then export the data to CSV file. How can I enable this option in NodeRed Dashboard?

Thanks in advance.

Why wold you do this? If you want the chart in your dashboard add a ui_template node with an iframe pointing to the url of the grafana graph.

I want to limit what users can do. If I just simply give the url to the chart, then many other options such as the GUI for Grafana will also show up.
I am attaching a picture and you will see what I mean. If I just simply give the url, then the stuff circled in red will also show up.

I think you are doing something wrong, is not ok that you got the Grafana options in your NR dashboard.
The result should look like the example flow.
What version of Grafana are you using?

I have noticed that If you choose KIOSK mode when you copy the link from the URL, no controls are displayed when the graph is displayed on Node Red Dashboard. Or at least, non that do any harm!

I was trying to answer zenofmud's question about simply pointing the URL.

The result I got is indeed like the example flow without Grafana options.

What I want is the selected Grafana option such as "Inspect"->"Data"->"Export CSV". The other options don't show in Dashboard.
FYI, here is the real Grafana chart imbedded in my dashboard:

So what you want to know is does Gragfana have an API that will return the current data of a Grafana dashboard...right? If that is so, then I don't know you might try looking thru the Grafana documentation and asking on the Grafana site (though I hear support is not very good)

Exactly :slight_smile: This forum is amazing with quick reply. I guess I have to try my luck with Grafana site.

I do have backup plan to query data from Influx with another flow and then transfer data via http, which I try to avoid to save system resource.

Why would you need to transfer it via http?
I doubt if you need to worry about the system resource used to fetch it from influx, I suspect that is what grafana will do if it is capable of providing a csv file. I doubt if it would go direct from the graph as that will not necessarily have enough information to generate the csv, much more likely it would go back to influx again to get the data.

I am running Node Red, Influx and Grafana on a remote computer. Data analysis is done on a local machine. So the backup plan is to query the influx, save data file on the remote computer, then transfer the data file to my local machine.

If I use Grafana to query influx for 7 days data, it takes several seconds to generate the graph (The longer the days, the longer for it to load). Later on, if I choose "inspect"->"data", the CSV data is instantly available. So it is likely that Grafana does not go back to query the influx again.

In retrospect I think you may well be right, I stand corrected.

As a matter of interest, if you refresh the graph does it still take 7 seconds?

Yes it takes several seconds to refresh 7 days data, and it takes longer time for longer days.

OK, just checking it wasn't the db driver that was caching the result.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.