Skip to content

Commit

Permalink
add instance tags
Browse files Browse the repository at this point in the history
  • Loading branch information
graemej committed Apr 30, 2014
1 parent aebea2f commit 87623ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions checks.d/marathon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ def check(self, instance):

# Load values from the instance config
url = instance['url']
instance_tags = instance.get('tags', [])
default_timeout = self.init_config.get('default_timeout', 5)
timeout = float(instance.get('timeout', default_timeout))

response = self.get_v2_apps(url, timeout)
if response is not None:
self.gauge('marathon.apps', len(response['apps']), tags=['marathon'])
self.gauge('marathon.apps', len(response['apps']), tags=instance_tags)
for app in response['apps']:
tags = ['marathon', 'app_id:' + app['id'], 'version:' + app['version']]
tags = ['app_id:' + app['id'], 'version:' + app['version']] + instance_tags
for attr in ['taskRateLimit','instances','cpus','mem','tasksStaged','tasksRunning']:
self.gauge('marathon.' + attr, app[attr], tags=tags)
versions_reply = self.get_v2_app_versions(url, app['id'], timeout)
Expand Down

0 comments on commit 87623ac

Please sign in to comment.