diff options
author | Austin S. Hemmelgarn <ahferroin7@gmail.com> | 2018-09-20 19:01:03 -0400 |
---|---|---|
committer | Costa Tsaousis <costa@tsaousis.gr> | 2018-09-21 02:01:03 +0300 |
commit | 9ca9d491d67f1fecc8e8f455d4de8df2a73a371a (patch) | |
tree | 3a3cccf16106c1c3dc248e216b4b31f238ea0850 /python.d | |
parent | 5886a646ed2406889129721d8c27608fa6811a62 (diff) |
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.
Diffstat (limited to 'python.d')
-rw-r--r-- | python.d/spigotmc.chart.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/python.d/spigotmc.chart.py b/python.d/spigotmc.chart.py index f03e5bf38f..1fc0a13470 100644 --- a/python.d/spigotmc.chart.py +++ b/python.d/spigotmc.chart.py @@ -52,7 +52,9 @@ class Service(SimpleService): return False try: self.connect() - except (mcrcon.MCRconException, socket.error): + except (mcrcon.MCRconException, socket.error) as err: + self.error('Error connecting.') + self.error(repr(err)) return False return True @@ -67,7 +69,9 @@ class Service(SimpleService): pass self.console.connect(self.host, self.port, self.password) self.alive = True - except (mcrcon.MCRconException, socket.error): + except (mcrcon.MCRconException, socket.error) as err: + self.error('Error connecting.') + self.error(repr(err)) return False return True @@ -96,6 +100,8 @@ class Service(SimpleService): self.error('Connection is dead.') self.alive = False return None + except (TypeError, LookupError): + self.error('Unable to process TPS values.') try: raw = self.console.command('list') # The above command returns a string that looks like this: @@ -108,4 +114,6 @@ class Service(SimpleService): self.error('Connection is dead.') self.alive = False return None + except (TypeError, LookupError): + self.error('Unable to process user counts.') return data |