-
Notifications
You must be signed in to change notification settings - Fork 814
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
Marathon and Mesos svc #1205
Conversation
@@ -11,7 +11,17 @@ | |||
import simplejson as json | |||
import requests | |||
|
|||
def get_request_json(req): | |||
# Condition for request v1.x backward compatibility |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
One question: can the Marathon API return the list of applications without running instances? |
@@ -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) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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.
@amankapur Can you fix the latest comments, and rebase your branch as it can't be merged currently ? |
Conflicts: checks.d/marathon.py
@@ -10,6 +10,9 @@ | |||
import requests | |||
|
|||
class Marathon(AgentCheck): | |||
|
|||
check_name = "marathon.can_connect" |
There was a problem hiding this comment.
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.
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.