Skip to content

Instantly share code, notes, and snippets.

@bloodearnest
Created May 9, 2016 14:41
Show Gist options
  • Save bloodearnest/69bd09d1213aa0dc2fc288a7a2a3d6f9 to your computer and use it in GitHub Desktop.
Save bloodearnest/69bd09d1213aa0dc2fc288a7a2a3d6f9 to your computer and use it in GitHub Desktop.
def check(self, request):
"""Nagios health check"""
start = {}
def nagios_start(status, headers, exc_info=None):
# save status for inspection
start['status'] = status
start['headers'] = headers
response = self.app(request.environ, nagios_start)
if start['status'].startswith('404'):
# app does not provide /_status/nagios endpoint
return self._ok
else:
# return app's response
return Response(response,
status=start['status'],
headers=start['headers'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment