Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph: Export data as JSON & CSV #861

Closed
abravorus opened this issue Sep 24, 2014 · 34 comments
Closed

Graph: Export data as JSON & CSV #861

abravorus opened this issue Sep 24, 2014 · 34 comments

Comments

@abravorus
Copy link

Hello,

Would be great to add the possibility to get graph data in JSON and/or CSV format for the each graph panel. For example, via the new item(s) in Edit->Advanced sub-menu. Or by special button/icon in the legend area of the plot?
It's possible to do now for Graphite indirectly and in several steps - switch to Graphite PNG, get an URL of the image generated, change format parameter in the URL to format=json or format=raw.

And many thanks for the very useful tool!

Alexandr

@torkelo
Copy link
Member

torkelo commented Sep 24, 2014

Good suggestion, will try incorporate this in the new panel menu (still WIP),

panel_menu

#770 (comment)
http://play.grafana.org/master/#/dashboard/db/grafana-play-home

@bbinet
Copy link
Contributor

bbinet commented Oct 21, 2014

+1, this would be great if we could export raw data as csv or json format!

@djamelfel
Copy link

+1, i'm looking forward your solution

@gauthd
Copy link

gauthd commented Nov 5, 2014

+1, it would be great !

@toni-moreno
Copy link
Contributor

I agree on the new feature but not in the place where it should be placed.

IMHO access to raw data should be located over graphs ( a link perhaps) and not in the editor control.

Perhaps in the future grafana will let us work with different roles :
"Dasboard viewers " vs "dashboard designers"

Viewers will be able to access/see data ( ploted ,cvs, raw ) but won't be able to change dashboard design. They won't access to the "edit" menu.

@bbinet
Copy link
Contributor

bbinet commented Nov 14, 2014

@torkelo: any chance this feature will be included in grafana next version v1.9?

@torkelo
Copy link
Member

torkelo commented Nov 14, 2014

@bbinet it depends. Simply viewing the data as json would be pretty simple. Viewing the data exactly as returned from InfluxDB/Graphite is more complicated as that is not saved (it is directly transformed into a internal format).

@bbinet
Copy link
Contributor

bbinet commented Nov 14, 2014

@torkelo personnally I'm interested to get the graph data only (not the raw data returned from InfluxDB/Graphite), my preference would go to the csv format because I want to import this data into a spreadsheet program for further analysis.

torkelo added a commit that referenced this issue Nov 14, 2014
@torkelo torkelo changed the title Suggestion: Graph panel->Edit->Advanced->Data JSON Graph: Export data as JSON & CSV Nov 14, 2014
@torkelo
Copy link
Member

torkelo commented Nov 14, 2014

Added Export to CSV feature.
image

Is JSON also needed or is CSV enough?

@torkelo torkelo closed this as completed Nov 14, 2014
@torkelo torkelo added this to the 1.9.0 milestone Nov 14, 2014
@abravorus
Copy link
Author

Torkel, thanks a lot!

Alexandr

On Fri, Nov 14, 2014 at 2:13 PM, Torkel Ödegaard notifications@github.com
wrote:

Added Export to CSV feature.
[image: image]
https://cloud.githubusercontent.com/assets/10999/5044960/0135c90c-6bf7-11e4-87b1-f4ad8f52f210.png

Is JSON also needed or is CSV enough?


Reply to this email directly or view it on GitHub
#861 (comment).

@bbinet
Copy link
Contributor

bbinet commented Nov 14, 2014

@torkelo thanks a ton!
On my side, CSV format is enough, but I maybe others need JSON format?

@sabat
Copy link

sabat commented Apr 21, 2015

+1 sorely needed feature

@torkelo
Copy link
Member

torkelo commented Apr 21, 2015

@sabat CVS is not enough, you want json as well?

@mhite
Copy link

mhite commented Oct 21, 2015

JSON would be great. It would also be interesting to only export the metrics that are currently active in the graph, ie. not in a visually disabled state.

@AlienOnEarth
Copy link

+1 for this feature. Export as CSV or JSON would be a great addition!

@rosscdh
Copy link

rosscdh commented Dec 4, 2015

+1

@leoatavalancha
Copy link

+1 CSV export would be great in data tables. Right now this feature only works with charts.

@hanej
Copy link

hanej commented Jan 22, 2016

+1

@shujamughal
Copy link

Hi,
Can you please add Export to CSV feature in data tables also?

Thanks
Shuja

@torkelo
Copy link
Member

torkelo commented May 6, 2016

@shujamughal I think this is already implemented in master

@zaibfridi
Copy link

zaibfridi commented Jun 17, 2016

@shujamughal @leoatavalancha @mhite @sabat @bbinet @torkelo can we export the CSV or json from terminal ?? cli ??
can you please refer me any api which help me to extract the only graph data ?
thanking in advance.

@flisky
Copy link

flisky commented Nov 14, 2016

FYI, here is a gist exporting dashboards into json format.

@IzekChen
Copy link

@zaibfridi Did you find any solution to download from terminal or cli?
When I get the csv file from browser that is a blob url.
I don't know how to use linux to get blob url file.

@sinhadotabhinav
Copy link

Is there a script i can use to export this raw data for all the panels in a dashboard to a csv format or any other format? I want to send my data to a common server through a script.
I know there is an export data to csv, but i want to do it through a script.

Please let me know your views

@daniellee
Copy link
Contributor

@asinha093 take a look at the Wizzy tool for exporting dashboard json.

@philomatic
Copy link

philomatic commented Jun 26, 2017

Exporting data from Grafana UI is a great feature!

However, could there be an option to export the raw influxdb data?
Without aggregation like "mean" or. sth. else?

I know this can be achieved through the influxdb cli, but exporting directly from ui is more end-user friendly :)

@torkelo
Copy link
Member

torkelo commented Jun 26, 2017

@philomatic I am sure there is some export feature in InfluxDB (or you can query the raw data to export it)

@philomatic
Copy link

yes, of course, however:

I know this can be achieved through the influxdb cli, but exporting directly from ui is more end-user friendly :)

best regards

@ZainabSayyed
Copy link

Hi,
Is there any API which can help to export each of panel into csv?

Thanks
Zee.

@daniellee
Copy link
Contributor

@ZainabSayyed unfortunately there is not. If you want to do that you will have to it with a tool like PhantomJS or Selenium. There is a feature request for this: #8171

@petemyron
Copy link

This isn't exactly what you're looking for since it's not in the UI, or per panel, but maybe this will help someone else trying to get data out of Grafana. I eventually got this to work for getting the graphed data "exported" in json: query the datasource directly (well, proxied). This is what happens when the graph refreshes with ajax.

Here's a relatively complex, nested query and how to curl it. The query looks like this (it gets messy with url encoding): SELECT mean("weightedAverage") FROM (SELECT "avg" AS "weightedAverage" FROM "thing" WHERE "Operation" = 'offers' AND time > now() - 1h) WHERE time > now() - 1h GROUP BY time(1h) fill(null)

https://[grafana]/api/datasources/proxy/1/query?db=[database]&q=SELECT%20mean(%22weightedAverage%22)%20FROM%20(SELECT%20%22avg%22%20AS%20%22weightedAverage%22%20FROM%20%22thing%22%20WHERE%20%22Operation%22%20%3D%20%27offers%27%20AND%20time%20%3E%20now()%20-%201h)%20WHERE%20time%20%3E%20now()%20-%201h%20GROUP%20BY%20time(1h)%20fill(null)[&epoch=ms]

This outputs the data in json format:

{"results":[{"statement_id":0,"series":[{"name":"thing","columns":["time","mean"],"values":[["2017-08-08T16:00:00Z",29.630639730639732],["2017-08-08T17:00:00Z",26.182254196642685]]}]}]}

@dmitryuk
Copy link

https://github.com/RoboFinance/grafana-table-reports

@hayaah
Copy link

hayaah commented Mar 25, 2020

This worked for me regarding alerts graphs

  1. fetch alert data using this endpoint
    /api/alerts/:id
  2. send targets query to this endpoint
    POST /api/datasources/proxy/1/render
    body: (form-data)
    target: ${target from the previous step}
    format: json
    you can also send
    maxDataPoints, from, until

@vtolstov
Copy link

thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests