]> arthur.barton.de Git - netdata.git/commitdiff
make MySQL compatible with python2
authorpaulfantom <paulfantom@gmail.com>
Mon, 20 Jun 2016 12:03:06 +0000 (14:03 +0200)
committerpaulfantom <paulfantom@gmail.com>
Mon, 20 Jun 2016 12:03:06 +0000 (14:03 +0200)
plugins.d/python.d.plugin
python.d/mysql.chart.py

index a714dbda1defbed1b55fdef4c803b19e3d8ab304..6d04023b74679211292306c3748c0711579c095a 100755 (executable)
@@ -12,7 +12,7 @@ import time
 MODULES_DIR = os.getenv('NETDATA_PLUGINS_DIR',
                         os.path.abspath(__file__).strip("python.d.plugin.py").replace("plugins.d", "python.d"))
 CONFIG_DIR = os.getenv('NETDATA_CONFIG_DIR', "/etc/netdata/")
-INTERVAL = os.getenv('NETDATA_UPDATE_EVERY', 1)
+INTERVAL = os.getenv('NETDATA_UPDATE_EVERY', None)
 # directories should end with '/'
 if MODULES_DIR[-1] != "/":
     MODULES_DIR += "/"
index e9df071e0a425300bf9ab2722fa017f83b1e3ab5..e7be32fa7fa7cb192fad31ab48d4531bf74844a5 100644 (file)
@@ -398,9 +398,9 @@ class Service(BaseService):
             except RuntimeError:
                 return None
         try:
-            with self.connection.cursor() as cursor:
-                cursor.execute(QUERY)
-                raw_data = cursor.fetchall()
+            cursor = self.connection.cursor()
+            cursor.execute(QUERY)
+            raw_data = cursor.fetchall()
         except Exception as e:
             self.error(NAME + ": cannot execute query.", e)
             self.connection.close()
@@ -433,6 +433,8 @@ class Service(BaseService):
 
         idx = 0
         data = self._get_data()
+        if data is None:
+            return False
         for name in ORDER:
             header = "CHART mysql_" + \
                      str(self.name) + "." + \