Synchronizer diagnostics
diff --git a/xos/core/models/site.py b/xos/core/models/site.py
index b98c40a..55f4945 100644
--- a/xos/core/models/site.py
+++ b/xos/core/models/site.py
@@ -312,9 +312,15 @@
     tenant_id = StrippedCharField(null=True, blank=True, max_length=200, db_index=True, help_text="Keystone tenant id")
 
     def delete(self, *args, **kwds):
-        pdb.set_trace()
         super(ControllerSite, self).delete(*args, **kwds)
 
     
     class Meta:
         unique_together = ('site', 'controller') 
+
+class Diag(PlCoreBase):
+    name = StrippedCharField(max_length=200, help_text="Name of the synchronizer")
+    
+    @property
+    def enacted(self):
+        return None
diff --git a/xos/core/views/observer.py b/xos/core/views/observer.py
index 3aabc4a..249c09f 100644
--- a/xos/core/views/observer.py
+++ b/xos/core/views/observer.py
@@ -1,16 +1,18 @@
 from django.http import HttpResponse
 from core.models import *
+from xos.config import Config
 import json
 import os
 import time
 
 def Observer(request):
-    if not os.path.exists('/tmp/observer_last_run'):
+    diag = Diag.objects.filter(name=Config().observer_name).first()
+    if not diag:
         return HttpResponse(json.dumps({"health": ":-X", "time": time.time(), "comp": 0}))
 
     t = time.time()
-    status_str = open('/tmp/observer_last_run','r').read()
-    d = json.loads(status_str)
+    
+    d = json.loads(diag.backend_register)
     comp = d['last_run'] + d['last_duration']*2 + 300
     if comp>t:
         d['health'] = ':-)'
diff --git a/xos/synchronizers/base/event_loop.py b/xos/synchronizers/base/event_loop.py
index c1b9cda..f224380 100644
--- a/xos/synchronizers/base/event_loop.py
+++ b/xos/synchronizers/base/event_loop.py
@@ -520,7 +520,15 @@
                         self.save_run_times()
 
                         loop_end = time.time()
-                        open('/tmp/%sobserver_last_run'%self.observer_name,'w').write(json.dumps({'last_run': loop_end, 'last_duration':loop_end - loop_start}))
+
+                        diag = Diag.objects.filter(name=Config().observer_name).first()
+                        if (diag):
+                            br_str = diag.backend_register
+                            br = json.loads(br_str)
+                            br['last_run'] = loop_end
+                            br['last_duration'] = loop_end - loop_start
+                            diag.backend_register = json.dumps(br)
+                            diag.save() 
                 except Exception, e:
                         logger.error('Core error. This seems like a misconfiguration or bug: %r. This error will not be relayed to the user!' % e)
                         logger.log_exc("Exception in observer run loop")