Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marathon and Mesos svc #1205

Merged
merged 8 commits into from
Dec 31, 2014
Merged

Marathon and Mesos svc #1205

merged 8 commits into from
Dec 31, 2014

Conversation

amankapur
Copy link

For Mesos, simply check master REST url end point, /master/state.json

For Marathon, check on marathon REST endpoint /v2/apps, return status based on app count.

@@ -11,7 +11,17 @@
import simplejson as json
import requests

def get_request_json(req):
# Condition for request v1.x backward compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Agent 5.x we bundle only one version of requests so we probably don't need to care about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@LotharSee
Copy link
Contributor

One question: can the Marathon API return the list of applications without running instances?
If yes, we could use this information to define a per-application service check.

@@ -28,7 +38,8 @@ def check(self, instance):
for app in response['apps']:
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)
if hasattr(app, attr):
self.gauge('marathon.' + attr, app[attr], tags=tags)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we log something in debug if the attribute is not present ? (See comments in that PR: #1228 )

if hasattr(app, attr):
self.gauge('marathon.' + attr, app[attr], tags=tags)
else:
self.warning('Marathon application (id: %s) has no attribute %s' % (app['id'], attr))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that should be self.log.debug as it can be expected in some cases depending on the version of marathon.

@remh
Copy link
Contributor

remh commented Dec 22, 2014

@amankapur Can you fix the latest comments, and rebase your branch as it can't be merged currently ?
Thanks!

@remh remh self-assigned this Dec 22, 2014
@@ -10,6 +10,9 @@
import requests

class Marathon(AgentCheck):

check_name = "marathon.can_connect"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be upper case (https://www.python.org/dev/peps/pep-0008/#constants)
I'll fix it.

@remh remh removed the 2 - Working label Dec 31, 2014
@remh remh added the 3 - Done label Dec 31, 2014
remh added a commit that referenced this pull request Dec 31, 2014
@remh remh merged commit 3303c28 into master Dec 31, 2014
@remh remh deleted the marathon-svc branch January 14, 2015 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants