From dcf3bc3fbc934871084b99c527c3c3dc611993bb Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Thu, 15 Aug 2013 01:50:26 +0200 Subject: [PATCH 1/2] just some threshold fixes --- lib/core/job.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/core/job.py b/lib/core/job.py index 39873ba..bf4a474 100644 --- a/lib/core/job.py +++ b/lib/core/job.py @@ -33,11 +33,13 @@ class Job: def handle_threshold(self, serviceThreshold, executionSucessful): if executionSucessful: - pass + if self.jobThreshold > 0: + self.jobThreshold -= 1 else: self.jobThreshold += 1 if self.jobThreshold >= serviceThreshold: + self.log.d("ARGGHHH!!") self.handle_alarm(self.jobThreshold-serviceThreshold) def handle_alarm(self, threholdOffset): From 06e29776b22e53e2421055e62b6a8e3da38d61d1 Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Thu, 15 Aug 2013 02:03:12 +0200 Subject: [PATCH 2/2] finalized the tcpconnect service. should be ready for takeoff now.... ;) --- lib/services/tcpconnect.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/services/tcpconnect.py b/lib/services/tcpconnect.py index 971bab2..4a329c3 100644 --- a/lib/services/tcpconnect.py +++ b/lib/services/tcpconnect.py @@ -11,7 +11,6 @@ from lib.services.service import Service class TcpconnectService(Service): def __init__(self, **kwargs): - #Service.__init__(self, **kwargs) super(TcpconnectService, self).__init__(**kwargs) args = self.get_arguments() @@ -28,19 +27,24 @@ class TcpconnectService(Service): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) except socket.error, msg: jobInfo.set_errorcode(1) - jobInfo.set_message("Could not create socket to host: " + jobInfo.get_host() + " to port: " + str(self.port) + " (" + str(msg) + ")") + jobInfo.set_message("Could not create socket to host: " + jobInfo.get_host() + " to port: " + + str(self.port) + " (" + str(msg) + ")") try: sock.connect((jobInfo.get_host(), self.port)) except socket.error, msg: jobInfo.set_errorcode(2) - jobInfo.set_message("Could not establish connection to host: " + jobInfo.get_host() + " to port: " + str(self.port) + " (" + str(msg) + ")") + jobInfo.set_message("Could not establish connection to host: " + jobInfo.get_host() + " to port: " + + str(self.port) + " (" + str(msg) + ")") if jobInfo.get_errorcode() == -1: jobInfo.set_execution_successful(True) jobInfo.set_errorcode(0) - jobInfo.set_message("Connection successful established to host: " + jobInfo.get_host() + " to port: " + str(self.port)) + jobInfo.set_message("Connection successful established to host: " + jobInfo.get_host() + " to port: " + + str(self.port)) + sock.close() + def create(kwargs): return TcpconnectService(**kwargs) \ No newline at end of file