@cryptotaxi247 / netdata-1 / commits / 9ca9d491d

Add some extra error logging to the spigotmc module. (#4148)

* Add some extra error logging to the spigotmc module. This should hopeffully make it easier to debug things when it fails to connect to the configured system. * Added improved error handling to spigotmc module. This will catch and report errors parsing the command output, instead of propogating them and crashing the module.

Austin S. Hemmelgarn committed Sep 20, 2018 at 19:01 UTC 9ca9d491d67f1fecc8e8f455d4de8df2a73a371a
1 file changed +10 -2
python.d/spigotmc.chart.py
+10 -2
@@ -52,7 +52,9 @@ class Service(SimpleService):
52 return False
53 try:
54 self.connect()
55 - except (mcrcon.MCRconException, socket.error):
55 + except (mcrcon.MCRconException, socket.error) as err:
56 + self.error('Error connecting.')
57 + self.error(repr(err))
58 return False
59 return True
60
@@ -67,7 +69,9 @@ class Service(SimpleService):
69 pass
70 self.console.connect(self.host, self.port, self.password)
71 self.alive = True
70 - except (mcrcon.MCRconException, socket.error):
72 + except (mcrcon.MCRconException, socket.error) as err:
73 + self.error('Error connecting.')
74 + self.error(repr(err))
75 return False
76 return True
77
@@ -96,6 +100,8 @@ class Service(SimpleService):
100 self.error('Connection is dead.')
101 self.alive = False
102 return None
103 + except (TypeError, LookupError):
104 + self.error('Unable to process TPS values.')
105 try:
106 raw = self.console.command('list')
107 # The above command returns a string that looks like this:
@@ -108,4 +114,6 @@ class Service(SimpleService):
114 self.error('Connection is dead.')
115 self.alive = False
116 return None
117 + except (TypeError, LookupError):
118 + self.error('Unable to process user counts.')
119 return data