]> arthur.barton.de Git - netdata.git/commitdiff
better error messages
authorpaulfantom <paulfantom@gmail.com>
Sat, 2 Jul 2016 21:01:07 +0000 (23:01 +0200)
committerpaulfantom <paulfantom@gmail.com>
Sat, 2 Jul 2016 21:01:07 +0000 (23:01 +0200)
python.d/mysql.chart.py

index 162879fe51deb563c3d21dba19f0261c3a9efe23..982d2513507a64f7fe0114d999e538b9f3bb92f3 100644 (file)
@@ -2,12 +2,9 @@
 # Description: MySQL netdata python.d plugin
 # Author: Pawel Krupa (paulfantom)
 
-import os
 from base import SimpleService
 import msg
 
-NAME = os.path.basename(__file__).replace(".chart.py", "")
-
 # import 3rd party library to handle MySQL communication
 try:
     import MySQLdb
@@ -355,7 +352,7 @@ class Service(SimpleService):
                                               port=self.configuration['port'],
                                               connect_timeout=self.update_every)
         except Exception as e:
-            self.error(NAME + " has problem connecting to server:", e)
+            self.error("problem connecting to server:", e)
             raise RuntimeError
 
     def _format_data(self):
@@ -373,7 +370,7 @@ class Service(SimpleService):
             cursor.execute(QUERY)
             raw_data = cursor.fetchall()
         except Exception as e:
-            self.error(NAME + ": cannot execute query.", e)
+            self.error("cannot execute query.", e)
             self.connection.close()
             self.connection = None
             return None