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

Supervisord check #1165

Merged
merged 1 commit into from
Mar 18, 2015
Merged

Supervisord check #1165

merged 1 commit into from
Mar 18, 2015

Conversation

isaacdd
Copy link
Contributor

@isaacdd isaacdd commented Oct 20, 2014

No description provided.

@remh
Copy link

remh commented Oct 28, 2014

That looks great!
I doesn't seem like it works with Unix sockets though, does it ?

for proc in processes:
proc_name = proc['name']
tags = ['supervisord',
'server:%s' % server_name,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm worried that this could grow unboundedly. What is going to prevent this?

@remh
Copy link

remh commented Oct 28, 2014

Also could you add some tests for it ?
We will finish the review when we'll be working on the 5.2.0 release.

@isaacdd isaacdd changed the title Initial version of supervisord check. Supervisord check Nov 3, 2014
def _extract_uptime(proc):
desc = proc['description']
if proc['statename'] == 'RUNNING' and 'uptime' in desc:
h, m, s = desc.split('uptime ')[1].split(':')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does not account for days, etc. Needs a re-write.

@remh remh self-assigned this Dec 22, 2014
@isaacdd isaacdd force-pushed the isaac/supervisord_check branch 2 times, most recently from 42477df to fbf523f Compare December 25, 2014 02:53
'STOPPED': AgentCheck.CRITICAL,
'STARTING': AgentCheck.OK,
'RUNNING': AgentCheck.OK,
'BACKOFF': AgentCheck.UNKNOWN,
Copy link

Choose a reason for hiding this comment

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

According to the documentation BACKOFF is a state where:

The process entered the STARTING state but subsequently exited too quickly to move to the RUNNING state.

This should be critical.

# Report service checks and uptime for each process
for proc in processes:
proc_name = proc['name']
tags = ['supervisord',
Copy link

Choose a reason for hiding this comment

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

the "supervisord" tags is not useful here and should probably be removed as it can't be used for grouping and is redundant with the metric name.

@remh
Copy link

remh commented Dec 31, 2014

Looks almost good! Just a few comments to fix and it should be ready to merge.
Thanks @isaacdd !

@remh
Copy link

remh commented Jan 13, 2015

@isaacdd Any update on the comments made ?

@isaacdd isaacdd force-pushed the isaac/supervisord_check branch 3 times, most recently from cfb2327 to d65f203 Compare January 13, 2015 19:54
@remh
Copy link

remh commented Jan 23, 2015

@isaacdd any update on the travis test ?

@isaacdd
Copy link
Contributor Author

isaacdd commented Jan 23, 2015

@remh have not had the chance to tackle it, and I don't think I will be able to tackle anytime soon.

@remh
Copy link

remh commented Jan 23, 2015

Ok changing the milestone then.

if not server_name or not server_name.strip():
raise Exception("Supervisord server name not specified in yaml configuration.")

supervisor = self._connect(instance)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this overwrite the 'supervisor' instantiated at import on line 9?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. It actually does, but it does not cause issues because supervisor (the library) is used only in the _connect method. But worth renaming it a different name to avoid future conflicts.

@remh
Copy link

remh commented Feb 23, 2015

@isaacdd any chance to work on this to add a test ?

@isaacdd isaacdd force-pushed the isaac/supervisord_check branch 2 times, most recently from e9f7f70 to 86f35c2 Compare March 5, 2015 20:20
@isaacdd isaacdd force-pushed the isaac/supervisord_check branch from 86f35c2 to 4b4970f Compare March 17, 2015 23:02

FORMAT_TIME = lambda x: time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(x))

@attr(requires='supervisord')
Copy link

Choose a reason for hiding this comment

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

This shouldn't be part of the checks.d, but part of the test.

@isaacdd isaacdd force-pushed the isaac/supervisord_check branch from 4b4970f to c130c99 Compare March 18, 2015 15:53
This adds a new agent check for supervisord. The check reports whether
supervisord is running or not and  whether one or more processes are
runnnig or not. It also reports prcesses' uptime. The check works over
http inet server and works with sockets. See supervisord.yaml.example
for more details.
@isaacdd isaacdd force-pushed the isaac/supervisord_check branch from c130c99 to 46db43d Compare March 18, 2015 15:55
@LeoCavaille
Copy link
Member

CI passed ! Merging ! Thanks @isaacdd !

LeoCavaille added a commit that referenced this pull request Mar 18, 2015
@LeoCavaille LeoCavaille merged commit fd3ec90 into master Mar 18, 2015
@LeoCavaille LeoCavaille deleted the isaac/supervisord_check branch August 11, 2015 19:02
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.

5 participants