diff options
Diffstat (limited to 'jobs')
-rwxr-xr-x | jobs/HTTPServerChecker.py | 11 | ||||
-rwxr-xr-x | jobs/TCPServerChecker.py | 2 |
2 files changed, 8 insertions, 5 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):
diff --git a/jobs/TCPServerChecker.py b/jobs/TCPServerChecker.py index 78ae1ac..4b5460c 100755 --- a/jobs/TCPServerChecker.py +++ b/jobs/TCPServerChecker.py @@ -31,7 +31,7 @@ class TCPServerChecker(JobSpawner.JobSpawner): def execute(self):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.settimeout(5)
+ s.settimeout(10)
s.connect((self.ip, self.port))
s.close()
return True
|