From 4cd7dd183a1711d53c0152467324b36995853938 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Fri, 12 Jan 2018 12:33:41 +0100 Subject: [PATCH] edit server and plugin --- boswatch/network/server.py | 2 +- boswatch/plugin/plugin.py | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/boswatch/network/server.py b/boswatch/network/server.py index 0fc5e01..ddab99f 100644 --- a/boswatch/network/server.py +++ b/boswatch/network/server.py @@ -33,7 +33,7 @@ class TCPHandler(socketserver.BaseRequestHandler): Insert a request in the clients[] list and send a [ack]""" data = 1 - cur_thread = threading.current_thread() + cur_thread = threading.current_thread().name req_name = str(cur_thread) + " " + self.client_address[0] try: diff --git a/boswatch/plugin/plugin.py b/boswatch/plugin/plugin.py index cbb4722..4a7cff2 100644 --- a/boswatch/plugin/plugin.py +++ b/boswatch/plugin/plugin.py @@ -102,15 +102,11 @@ class Plugin: def _getStatistics(self): """!Returns statistical information's from last plugin run - @return Count of runs complete - @return time of last complete run - @return time of last setup - @return time of last alarm - @return time of last teardown - @return count of setup errors complete - @return count of alarm errors complete - @return count of teardown errors complete""" - return self._runCount, self._sumTime, self._setupTime, self._alarmTime, self._teardownTime, self._setupErrorCount, self._alarmErrorCount, self._teardownErrorCount + @return Statistics as pyton dict""" + stats = {"runCount": self._runCount, "sumTime": self._sumTime, "cumTime": self._runCount + self._sumTime, + "setupTime": self._setupTime, "alarmTime": self._alarmTime, "teardownTime": self._teardownTime, + "setupErrorCount": self._setupErrorCount, "alarmErrorCount": self._alarmErrorCount, "teardownErrorCount": self._teardownErrorCount} + return stats def onLoad(self): """!Called by import of the plugin