]> arthur.barton.de Git - netdata.git/commitdiff
override disk autodetection
authorpaulfantom <paulfantom@gmail.com>
Wed, 3 Aug 2016 15:57:02 +0000 (17:57 +0200)
committerpaulfantom <paulfantom@gmail.com>
Wed, 3 Aug 2016 15:57:02 +0000 (17:57 +0200)
conf.d/python.d/hddtemp.conf
python.d/hddtemp.chart.py

index 34790e7c6027753531ee5875bca6517463e2af59..adc9a9f1ed1a9407612da55e1009f2c6be6eafe2 100644 (file)
 #     port: PORT             # the port to connect to
 #
 
+# By default this module will try to autodetect number of disks.
+# However this can be overridden by setting variable `disk_count` to
+# desired number of disks. Example for two disks:
+#
+# disk_count: 2
+#
+
 # ----------------------------------------------------------------------
 # AUTO-DETECTION JOBS
 # only one of them will run (they have the same name)
index ebbe1cea9b0b4a7e3aae7baed15ce70125465c16..beef64161645ff47363f3f4109ace960fe4e3514 100644 (file)
@@ -65,7 +65,6 @@ class Service(SocketService):
         Get data from TCP/IP socket
         :return: dict
         """
-        self.disk_count = self._get_disk_count()
         try:
             raw = self._get_raw_data().split("|")[:-1]
         except AttributeError:
@@ -96,6 +95,14 @@ class Service(SocketService):
         except (KeyError, TypeError) as e:
             self.info("No excluded disks")
             self.debug(str(e))
+
+        try:
+            self.disk_count = int(self.configuration['disk_count'])
+        except (KeyError, TypeError) as e:
+            self.info("Autodetecting number of disks")
+            self.disk_count = self._get_disk_count()
+            self.debug(str(e))
+
         data = self._get_data()
         if data is None:
             return False