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

made cleanup_chronos_jobs send OK on sensu #191

Merged
merged 3 commits into from
Jan 28, 2016
Merged

made cleanup_chronos_jobs send OK on sensu #191

merged 3 commits into from
Jan 28, 2016

Conversation

mjksmith
Copy link
Contributor

When instances are removed from a chronos-*.yaml cleanup_chronos_jobs now sends an OK status to sensu.

import service_configuration_lib

from paasta_tools import chronos_tools
from paasta_tools.check_chronos_jobs import send_event_to_sensu
Copy link
Contributor

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)
Copy link
Contributor

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)

@solarkennedy
Copy link
Contributor

fix+ship

mjksmith added a commit that referenced this pull request Jan 28, 2016
made cleanup_chronos_jobs send OK on sensu
@mjksmith mjksmith merged commit 77277c5 into master Jan 28, 2016
@mjksmith mjksmith deleted the PAASTA-1307 branch January 28, 2016 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants