Skip to content

Instantly share code, notes, and snippets.

@migurski
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save migurski/9029667 to your computer and use it in GitHub Desktop.
Save migurski/9029667 to your computer and use it in GitHub Desktop.
Engine Light status endpoint script for www.codeforamerica.org
#!/usr/bin/env python
from json import dumps
from time import time
try:
lib_state = open('/var/run/library-state.txt').read().strip()
if lib_state != 'OK':
app_state = 'Library: ' + lib_state
else:
app_state = 'ok'
except Exception, e:
app_state = 'App: ' + str(e)
print 'Content-Type: application/json\n'
print dumps({
"status": app_state,
"updated": int(time()),
"dependencies": ["Github", "Travis-CI", "Amazon RDS"],
"resources": []
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment