Created
September 29, 2016 23:30
-
-
Save sacreman/a03a8dfc16b5f18a16b9b0bb04164afc to your computer and use it in GitHub Desktop.
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 python | |
import sys | |
from dlcli import api | |
''' | |
Returns a sum of the number of agents that have returned the base.count metric in the last minute. | |
You will need to update the TAG, org, account and key variables in the settings below. | |
''' | |
# Settings | |
TAG = 'mytag' | |
settings = { | |
'url': 'https://app.dataloop.io/api/v1', | |
'org': 'myorg', | |
'account': 'myaccount', | |
'key': 'myapikey', | |
} | |
try: | |
count = 0 | |
for series in api.series.get_tag_series(tag=TAG, metric='base.count', resolution='30', period='60', **settings): | |
count += int(series['points'][0]['avg']) | |
print "OK | count=%d;;;;" % count | |
sys.exit(0) | |
except Exception, e: | |
print "FAIL! %s" % e | |
sys.exit(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment