Skip to content

Instantly share code, notes, and snippets.

@adimania
Created November 30, 2016 10:18
Show Gist options
  • Save adimania/29ec3dcad54fd4c3f28188e213b14d65 to your computer and use it in GitHub Desktop.
Save adimania/29ec3dcad54fd4c3f28188e213b14d65 to your computer and use it in GitHub Desktop.
Zap for Datadog
api_key = <api_key>
application_key = <app_key>
monitors = requests.get("https://app.datadoghq.com/api/v1/monitor?api_key=%s&application_key=%s" % (api_key, application_key)).json()
bad_monitor = {'name':[]}
for monitor in monitors:
if monitor['overall_state'] == u'OK':
bad_monitor['name'].append(monitor['name'])
if bad_monitor['name']:
return [bad_monitor]
else:
return []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment