summaryrefslogtreecommitdiffstats
path: root/python.d
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-11-12 14:00:18 +0200
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2016-11-12 14:00:18 +0200
commit56ec680880032bc9e8dcfb32bb163a1e783a6a59 (patch)
tree44d14f5808b1e2c73fe4070e851dc8ce247afa27 /python.d
parentc2c0dcc86422d9073d8866347b912cadc84fddb9 (diff)
more python logging fixes
Diffstat (limited to 'python.d')
-rw-r--r--python.d/python_modules/base.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py
index 14c7ca1140..ca9479794c 100644
--- a/python.d/python_modules/base.py
+++ b/python.d/python_modules/base.py
@@ -357,10 +357,18 @@ class SimpleService(threading.Thread):
:return: boolean
"""
self.debug("Module", str(self.__module__), "doesn't implement check() function. Using default.")
- if self._get_data() is None or len(self._get_data()) == 0:
+ data = self._get_data()
+
+ if data is None:
+ self.debug("failed to receive data during check().")
return False
- else:
- return True
+
+ if len(data) == 0:
+ self.debug("empty data during check().")
+ return False
+
+ self.debug("successfully received data during check(): '" + str(data) + "'")
+ return True
def create(self):
"""
@@ -369,6 +377,7 @@ class SimpleService(threading.Thread):
"""
data = self._get_data()
if data is None:
+ self.debug("failed to receive data during create().")
return False
idx = 0
@@ -392,7 +401,7 @@ class SimpleService(threading.Thread):
"""
data = self._get_data()
if data is None:
- self.debug("_get_data() returned no data")
+ self.debug("failed to receive data during update().")
return False
updated = False
@@ -716,6 +725,7 @@ class SocketService(SimpleService):
self.name = ""
else:
self.name = str(self.name)
+
try:
self.unix_socket = str(self.configuration['socket'])
except (KeyError, TypeError):
@@ -729,10 +739,12 @@ class SocketService(SimpleService):
self.port = int(self.configuration['port'])
except (KeyError, TypeError):
self.debug("No port specified. Using: '" + str(self.port) + "'")
+
try:
self.request = str(self.configuration['request'])
except (KeyError, TypeError):
self.debug("No request specified. Using: '" + str(self.request) + "'")
+
self.request = self.request.encode()
def check(self):