-
Notifications
You must be signed in to change notification settings - Fork 241
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
made cleanup_chronos_jobs send OK on sensu #191
Conversation
8bbb271
to
42ae5c2
Compare
import service_configuration_lib | ||
|
||
from paasta_tools import chronos_tools | ||
from paasta_tools.check_chronos_jobs import send_event_to_sensu |
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.
Instead of doing this, can you move paasta_tools.check_chronos_jobs.send_event_to_sensu
to paasta_tools.chronos_tools
or even paasta_tools.utils
if it is generic enough?
|
||
def compose_check_name_for_job(service, instance): | ||
"""Compose a sensu check name for a given job""" | ||
return 'check-chronos-jobs.%s%s%s' % (service, INTERNAL_SPACER, instance) |
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.
ah, this isn't the correct place for this.
Here's what I would do:
in chronos_tools.py
and marathon_tools.py
:
def compose_check_name_for_service_instance(check_name, service, instance):
return '%s.%s%s%s' % (check_name, service, INTERNAL_SPACER, instance)
in check_chronos_jobs.py
def send_event(service, instance):
"""check_chronos_jobs specific wrapper for monitoring_tools.send_event_to_sensu"""
check_name = chronos_tools.compose_check_name_for_job('check_chronos_jobs', service, instance)
return monitoring_tools.send_event(check_name, service, instance....)
You can then follow this pattern of copying the check_chronos_tools.send_event
function in other scripts (like in #198)
fix+ship |
made cleanup_chronos_jobs send OK on sensu
When instances are removed from a
chronos-*.yaml
cleanup_chronos_jobs
now sends an OK status to sensu.