Created
May 9, 2016 14:41
-
-
Save bloodearnest/69bd09d1213aa0dc2fc288a7a2a3d6f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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