blob: 67b2fdeb330776fa520dce24a0297fb744a33d02 [file] [log] [blame]
Sapan Bhatia214c64c2015-01-29 21:05:39 +00001from django.http import HttpResponse
2from monitor import driver
3from core.models import *
4import json
5import time
6
7def Observer(request):
8 t = time.time()
9 status_str = open('/tmp/observer_last_run','r').read()
10 d = json.loads(status_str)
11 comp = d['last_run'] + d['last_duration']*2 + 300
12 if comp>t:
13 d['health'] = ':-)'
14 else:
15 d['health'] = ':-X'
16 d['time'] = t
17 d['comp'] = comp
18
19 return HttpResponse(json.dumps(d))