aboutsummaryrefslogtreecommitdiff
path: root/jobs/HTTPServerChecker.py
diff options
context:
space:
mode:
authorTom Ritter <tom@ritter.vg>2016-12-28 14:22:11 -0500
committerTom Ritter <tom@ritter.vg>2016-12-28 14:22:11 -0500
commit18aabef729c950dbed52163908ffeeb48e0e56a9 (patch)
treee4526246ccaf8c5f72d0870e1231d0337d03d0ef /jobs/HTTPServerChecker.py
parentbbd009871af97d942365317b0ce577f19c95637d (diff)
Check for 200 status code and set server timeout to 10
Diffstat (limited to 'jobs/HTTPServerChecker.py')
-rwxr-xr-xjobs/HTTPServerChecker.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/jobs/HTTPServerChecker.py b/jobs/HTTPServerChecker.py
index e590486..9336588 100755
--- a/jobs/HTTPServerChecker.py
+++ b/jobs/HTTPServerChecker.py
@@ -28,12 +28,15 @@ class HTTPServerChecker(JobSpawner.JobSpawner):
return self.failureNotificationFrequency
def execute(self):
try:
- requests.get(self.url)
- return True
+ i = requests.get(self.url)
+ if i.status_code != 200:
+ self.failuremsg = "Error hitting server " + self.url + " (Code: " + str(i.status_code) + ")"
+ else:
+ return True
except:
self.failuremsg = "Could not hit server " + self.url
- logging.warn(self.failuremsg)
- return False
+ logging.warn(self.failuremsg)
+ return False
def onFailure(self):
return self.sendEmail(self.failuremsg, "")
def onStateChangeSuccess(self):