Created
May 28, 2020 16:57
-
-
Save jordangarrison/860c9c66934c1ce2cf01e6fe3561ca2d to your computer and use it in GitHub Desktop.
BitBar quick link into datadog dashboards
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For BitBar by Matt Ryer please visit GetBitBar