Skip to content

Instantly share code, notes, and snippets.

@hvelarde
Created December 18, 2017 21:55
"ok" probe for zc.monitor
import pkg_resources
import logging
logger = logging.getLogger('zc.monitor')
try:
pkg_resources.get_distribution('zc.monitor')
except pkg_resources.DistributionNotFound:
logger.info('Monitor server is not available')
else:
def ok(connection):
"""Return the string 'OK'."""
connection.write('OK\n')
import zc.monitor
zc.monitor.register(ok)
logger.info('"OK" command for monitor server registered')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment