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

Add service check for gunicorn #1163

Merged
merged 4 commits into from
Dec 10, 2014
Merged

Add service check for gunicorn #1163

merged 4 commits into from
Dec 10, 2014

Conversation

amankapur
Copy link

Alerts critical if no process with given name is found or if no workers are present (idle or running).
OK if workers are running or idle.

Description for UI: https://github.com/DataDog/dogweb/pull/5844

if working == 0 and idle == 0:
self.service_check(self.SVC_NAME, AgentCheck.CRITICAL, tags=['app:'+ proc_name])
else:
self.service_check(self.SVC_NAME, AgentCheck.OK, tags=['app:'+ proc_name])
Copy link
Member

Choose a reason for hiding this comment

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

Can we add a message with additional context to differentiate theses from the other service check later on? e.g.: "Found # idle and # working workers"? The one below could be something like "Found no master process with name ..."


msg = "%s working and %s idle workers for %s" % (working, idle, proc_name)

if working == 0 and idle == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

why not clean this up a bit?

status = CRIT if working == 0 and idle == 0 else OK
 self.service_check(self.SVC_NAME, status, tags=['app:'+ proc_name], message=msg)

it makes the intent clearer. always submit a value, just with a different status and less duplicated code.

@LeoCavaille LeoCavaille self-assigned this Dec 10, 2014
LeoCavaille added a commit that referenced this pull request Dec 10, 2014
Add service check for gunicorn
@LeoCavaille LeoCavaille merged commit 1bb16af into master Dec 10, 2014
@LeoCavaille LeoCavaille deleted the gunicorn-svc branch December 10, 2014 14:58
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