@cryptotaxi247 / netdata-1 / commits / c36f1e23a

make MySQL compatible with python2

paulfantom committed Jun 20, 2016 at 14:03 UTC c36f1e23a25479de182de5f0f24bbb8d88b14a9f
2 files changed +6 -4
plugins.d/python.d.plugin
+1 -1
@@ -12,7 +12,7 @@ import time
12 MODULES_DIR = os.getenv('NETDATA_PLUGINS_DIR',
13 os.path.abspath(__file__).strip("python.d.plugin.py").replace("plugins.d", "python.d"))
14 CONFIG_DIR = os.getenv('NETDATA_CONFIG_DIR', "/etc/netdata/")
15 -INTERVAL = os.getenv('NETDATA_UPDATE_EVERY', 1)
15 +INTERVAL = os.getenv('NETDATA_UPDATE_EVERY', None)
16 # directories should end with '/'
17 if MODULES_DIR[-1] != "/":
18 MODULES_DIR += "/"
python.d/mysql.chart.py
+5 -3
@@ -398,9 +398,9 @@ class Service(BaseService):
398 except RuntimeError:
399 return None
400 try:
401 - with self.connection.cursor() as cursor:
402 - cursor.execute(QUERY)
403 - raw_data = cursor.fetchall()
401 + cursor = self.connection.cursor()
402 + cursor.execute(QUERY)
403 + raw_data = cursor.fetchall()
404 except Exception as e:
405 self.error(NAME + ": cannot execute query.", e)
406 self.connection.close()
@@ -433,6 +433,8 @@ class Service(BaseService):
433
434 idx = 0
435 data = self._get_data()
436 + if data is None:
437 + return False
438 for name in ORDER:
439 header = "CHART mysql_" + \
440 str(self.name) + "." + \