Skip to content

Instantly share code, notes, and snippets.

@lrascao
Created March 31, 2016 16:19
Show Gist options
  • Star 51 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save lrascao/f57312ff33b799c4c0db56b10e80fe26 to your computer and use it in GitHub Desktop.
Save lrascao/f57312ff33b799c4c0db56b10e80fe26 to your computer and use it in GitHub Desktop.
Export/Import datadog dashboards
dash_id=xxxx
api_key=xxx
app_key=xxx
# 1. export
curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json
# 2. edit dash.json
move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level
# 3. import
curl -X POST -H "Content-type: application/json" -d @dash.json "https://app.datadoghq.com/api/v1/dash?api_key=${api_key}&application_key=${app_key}"
@cw-tomita
Copy link

Great tips! This was really helpful.

FYI, I found another way to export / import dashboards.
https://github.com/ouyi/dashjson
Maybe dashjson is easier but some fields could be missing and might need some patches when you have complicated dashboards.
ouyi/dashjson#1

@mleuthold
Copy link

In case you want to export a dashboard, where "graphs", "title" and "description" is already on the first level, use this command:

curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" | jq '.dash' > dash.json

@yaozhiqun
Copy link

@mleuthold 👍

@uvesten
Copy link

uvesten commented Sep 23, 2019

👍

@ashishkarpe
Copy link

I don't have app_key any idea from where can I find this

@ashishkarpe
Copy link

ashishkarpe commented Nov 16, 2022

When I used -d @5052-NonProd.json got following error:

Warning: Couldn't read data from file "5052-NonProd.json ", Warning: this makes an empty POST.

Tried -d ./5052-NonProd.json didn't get any error but dashboard in not imported

@ashishkarpe
Copy link

I got app_key but now trying to find dash_id ie dashboard id

@ashishkarpe
Copy link

Now getting this error while importing ie Step 3 import:

  • Mark bundle as not supporting multiuse < HTTP/1.1 308 Permanent Redirect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment