Skip to content

Instantly share code, notes, and snippets.

@jordangarrison
Created May 28, 2020 16:57
Show Gist options
  • Select an option

  • Save jordangarrison/860c9c66934c1ce2cf01e6fe3561ca2d to your computer and use it in GitHub Desktop.

Select an option

Save jordangarrison/860c9c66934c1ce2cf01e6fe3561ca2d to your computer and use it in GitHub Desktop.
BitBar quick link into datadog dashboards
#!/usr/bin/env PYTHONIOENCODING=UTF-8 /path/to/your/python3/bin/python
from datadog import initialize, api
# For EU the api_host value is different
options = {
'api_key': '<DD_API_KEY>',
'app_key': '<DD_APP_KEY>',
'api_host': 'https://api.datadoghq.com'
}
initialize(**options)
print(":dog:")
print("---")
print("Dashboards")
dashboard_lists = api.DashboardList.get_all()['dashboard_lists']
for dashboard_list in dashboard_lists:
dashboard_list_name = dashboard_list["name"]
dashboard_list_id = dashboard_list["id"]
print(f"{dashboard_list_name}")
dashboard_items = api.dashboard_list_v2.DashboardListV2.get_items(dashboard_list_id)
for dashboard in dashboard_items["dashboards"]:
dashboard_name = dashboard["title"]
dashboard_href = f"https://app.datadoghq.com{dashboard['url']}"
print(f"--{dashboard_name} | href={dashboard_href}")
print("---")
print("Refresh... | refresh=true")
@jordangarrison
Copy link
Copy Markdown
Author

For BitBar by Matt Ryer please visit GetBitBar

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