Logo
My Journal
Blog

Timeline

Blog

Datadog Dashboard [Ex/Im]port Script

I had a need recently to copy a developed dashboard between orgs within Datadog and ran across this Github Gist post that I’ve wrapped into a shell utility:

#!/bin/bash 
api_key='REPLACEME' 
app_key='REPLACEME' 
dash_id=$2 
if [[ $1 == "import" ]]; then
     curl -X POST -H "Content-type: application/json" -d @${dash_id}.json "https://app.datadoghq.com/api/v1/dash?api_key=${api_key}&application_key=${app_key}" 
else
     curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" | jq '.dash' > ${dash_id}.json 
fi

Leave A Comment