Commits

Frederic De Groef  committed e6e8fec

updated gehol status check cron job : test for the gateway AND the scientia backend

  • Participants
  • Parent commits 7f9fd5f
  • Tags v0.2.5.2

Comments (0)

Files changed (1)

File check_status.py

 from google.appengine.ext import webapp
 from status import set_status_down
 
+
+def check_server(host):
+    headers = {"Content-type": "application/x-www-form-urlencoded",
+               "Accept": "text/plain"}
+
+    conn = httplib.HTTPConnection(host)
+    conn.request("GET", '/', headers = headers)
+    response = conn.getresponse()
+    return True
+
+
+def check_gateway():
+    host = "164.15.72.157"    
+    logging.info("Testing GeHoL gateway : %s " % host)
+    return check_server(host)
+
+def check_scientia_backend():
+    host = "164.15.72.157:8080"    
+    logging.info("Testing Scientia backend : %s " % host)
+    return check_server(host)
+
+
+
 class UpdateGeholStatus(webapp.RequestHandler):
     def get(self):
         logging.info("Launching UpdateGeholStatus cron job")
 
 
     def update_gehol_status(self):
-        host = "164.15.72.157:8080"
-        headers = {"Content-type": "application/x-www-form-urlencoded",
-                   "Accept": "text/plain"}
         try:
-            conn = httplib.HTTPConnection(host)
-            conn.request("GET", '/', headers = headers)
-            response = conn.getresponse()
+            check_gateway()
+            check_scientia_backend()
             set_status_down(False)
         except Exception,e:
             set_status_down(True)