]> arthur.barton.de Git - netdata.git/commitdiff
Fix issues from testing mysql.chart.py + change method name
authorpaulfantom <paulfantom@gmail.com>
Sat, 2 Jul 2016 18:05:34 +0000 (20:05 +0200)
committerpaulfantom <paulfantom@gmail.com>
Sat, 2 Jul 2016 18:05:34 +0000 (20:05 +0200)
python.d/apache.chart.py
python.d/apache_cache.chart.py
python.d/mysql.chart.py
python.d/nginx.chart.py
python.d/phpfpm.chart.py
python.d/python_modules/base.py

index f6262a540b633379bbf8d7bd7f2366bcc3601306..53058388e5983128221f0ee3fa64e1efe9a35b96 100644 (file)
@@ -86,7 +86,7 @@ class Service(UrlService):
                            "ConnsAsyncClosing": 'closing',
                            "ConnsAsyncWriting": 'writing'}
 
-    def _formatted_data(self):
+    def _format_data(self):
         """
         Format data received from http request
         :return: dict
index bf04b339fa72eb092f7c55a7d14a6b2a9abffeb7..69da50c1f514124449130f973c03e1bc2230f4a3 100644 (file)
@@ -28,7 +28,7 @@ class Service(LogService):
         self.order = ORDER
         self.definitions = CHARTS
 
-    def _formatted_data(self):
+    def _format_data(self):
         """
         Parse new log lines
         :return: dict
index 4cd9b6d413370bf7b0b833d5e1c90305a02e2845..162879fe51deb563c3d21dba19f0261c3a9efe23 100644 (file)
@@ -153,8 +153,8 @@ CHARTS = {
             ["Innodb_data_written", "write", "incremental", -1, 1024]
         ]},
     'innodb_io_ops': {
-        'lines': [None, 'mysql InnoDB I/O Operations', 'operations/s', 'innodb', 'mysql.innodb_io_ops', 'line'],
-        'options': [
+        'options': [None, 'mysql InnoDB I/O Operations', 'operations/s', 'innodb', 'mysql.innodb_io_ops', 'line'],
+        'lines': [
             ["Innodb_data_reads", "reads"],
             ["Innodb_data_writes", "writes", "incremental", -1, 1],
             ["Innodb_data_fsyncs", "fsyncs"]
@@ -358,7 +358,7 @@ class Service(SimpleService):
             self.error(NAME + " has problem connecting to server:", e)
             raise RuntimeError
 
-    def _get_data(self):
+    def _format_data(self):
         """
         Get raw data from MySQL server
         :return: dict
@@ -380,9 +380,6 @@ class Service(SimpleService):
 
         return dict(raw_data)
 
-    def _formatted_data(self):
-        return self._get_data()
-
     def check(self):
         """
         Check if service is able to connect to server
@@ -394,64 +391,3 @@ class Service(SimpleService):
         except RuntimeError:
             self.connection = None
             return False
-
-    # def create(self):
-    #     """
-    #     Create graphs
-    #     :return: boolean
-    #     """
-    #     for name in ORDER:
-    #         self.defs[name] = []
-    #         for line in CHARTS[name][1]:
-    #             self.defs[name].append(line[0])
-    #
-    #     idx = 0
-    #     data = self._get_data()
-    #     if data is None:
-    #         return False
-    #     for name in ORDER:
-    #         header = "CHART mysql_" + \
-    #                  str(self.name) + "." + \
-    #                  name + " " + \
-    #                  CHARTS[name][0] + " " + \
-    #                  str(self.priority + idx) + " " + \
-    #                  str(self.update_every)
-    #         content = ""
-    #         # check if server has this data point
-    #         for line in CHARTS[name][1]:
-    #             if line[0] in data:
-    #                 content += "DIMENSION " + line[0] + " " + line[1] + "\n"
-    #         if len(content) > 0:
-    #             print(header)
-    #             print(content)
-    #             idx += 1
-    #
-    #     if idx == 0:
-    #         return False
-    #     return True
-    #
-    # def update(self, interval):
-    #     """
-    #     Update data on graphs
-    #     :param interval: int
-    #     :return: boolean
-    #     """
-    #     data = self._get_data()
-    #     if data is None:
-    #         return False
-    #     try:
-    #         data['Thread cache misses'] = int(int(data['Threads_created']) * 10000 / int(data['Connections']))
-    #     except Exception:
-    #         pass
-    #     for chart, dimensions in self.defs.items():
-    #         header = "BEGIN mysql_" + str(self.name) + "." + chart + " " + str(interval) + '\n'
-    #         lines = ""
-    #         for d in dimensions:
-    #             try:
-    #                 lines += "SET " + d + " = " + data[d] + '\n'
-    #             except KeyError:
-    #                 pass
-    #         if len(lines) > 0:
-    #             print(header + lines + "END")
-    #
-    #     return True
index 94d78d5ade6579ee0924166cdb845dd581e9b364..8fcac7d181410d9b17028c2eff3e7b68a009d3f0 100644 (file)
@@ -55,7 +55,7 @@ class Service(UrlService):
         self.order = ORDER
         self.definitions = CHARTS
 
-    def _formatted_data(self):
+    def _format_data(self):
         """
         Format data received from http request
         :return: dict
index 00f6336175a0fff2e53fbef77bec1a2a558f1102..938c0edf5a16365319934736008fc28c2d1642c2 100755 (executable)
@@ -56,7 +56,7 @@ class Service(UrlService):
                            "max children reached": 'reached',
                            "slow requests": 'slow'}
 
-    def _formatted_data(self):
+    def _format_data(self):
         """
         Format data received from http request
         :return: dict
index c05dca8440dcd19e16836fda1c86abfe8747840c..e868ffc3a9e4ba2fc0beec7c8104e185a72626e9 100644 (file)
@@ -310,7 +310,7 @@ class SimpleService(BaseService):
         """
         return ""
 
-    def _formatted_data(self):
+    def _format_data(self):
         """
         Format data received from http request
         :return: dict
@@ -328,7 +328,7 @@ class SimpleService(BaseService):
         Create charts
         :return: boolean
         """
-        data = self._formatted_data()
+        data = self._format_data()
         if data is None:
             return False
 
@@ -351,7 +351,7 @@ class SimpleService(BaseService):
         :param interval: int
         :return: boolean
         """
-        data = self._formatted_data()
+        data = self._format_data()
         if data is None:
             return False
 
@@ -412,7 +412,7 @@ class UrlService(SimpleService):
         except (KeyError, TypeError):
             pass
 
-        if self._formatted_data() is not None:
+        if self._format_data() is not None:
             return True
         else:
             return False