Skip to content

Instantly share code, notes, and snippets.

Last active November 5, 2020 12:14
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pmbauer/4de4871a38246ee9ee77 to your computer and use it in GitHub Desktop.
create a datadog time board from a screen board
#!/usr/bin/env bash
# dd_api_key=
# dd_app_key=
# screen_id=
curl -sX GET "${screen_id}?api_key=${dd_api_key}&application_key=${dd_app_key}" \
| jq '{
title: .board_title,
description: .board_title,
template_variables: .template_variables,
graphs: [.widgets[] | {title: .title_text, definition: .tile_def}]
}' \
| curl -sX POST -H "Content-type: application/json" -d @- \
Copy link

this works great! thank you!

notes to others:

  • the GET call gives you a complete representation of a given screenboard. that's something i was looking for in the UI but couldn't find.
  • the POST will fail if any of the widgets in your screenboard aren't allowed to be on a timeboard (a possibly incomplete list of widget types: notes, alert graph, alert value, iframe, check status). i've gotten around this by making a clone of the screenboard, deleting the bad widgets, and then running the script on the clone

Copy link

Here is how to do it to the opposite direction:

Copy link

taylorsmcclure commented Apr 15, 2020

This worked great, although the DD API gave me an error due to my query tables. Which is strange, because time boards support query tables...

{"errors": ["Error parsing query: viz type query_table is incorrect"]}                                                                                                                                                                                     

I simply deleted the query tables and it ended up working.

Copy link

You can also copy and paste individual graphs/metrics -- might be a bummer if you have a lot but was a good fit for my use case

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