Datadog Dashboard [Ex/Im]port Script

Print Friendly, PDF & Email

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 Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.