@cryptotaxi247 / netdata-1 / commits / 925d347e9

override disk autodetection

paulfantom committed Aug 3, 2016 at 17:57 UTC 925d347e98cf0e7665694fb4c4a4aebc367dcf19
2 files changed +15 -1
conf.d/python.d/hddtemp.conf
+7
@@ -60,6 +60,13 @@
60 # port: PORT # the port to connect to
61 #
62
63 +# By default this module will try to autodetect number of disks.
64 +# However this can be overridden by setting variable `disk_count` to
65 +# desired number of disks. Example for two disks:
66 +#
67 +# disk_count: 2
68 +#
69 +
70 # ----------------------------------------------------------------------
71 # AUTO-DETECTION JOBS
72 # only one of them will run (they have the same name)
python.d/hddtemp.chart.py
+8 -1
@@ -65,7 +65,6 @@ class Service(SocketService):
65 Get data from TCP/IP socket
66 :return: dict
67 """
68 - self.disk_count = self._get_disk_count()
68 try:
69 raw = self._get_raw_data().split("|")[:-1]
70 except AttributeError:
@@ -96,6 +95,14 @@ class Service(SocketService):
95 except (KeyError, TypeError) as e:
96 self.info("No excluded disks")
97 self.debug(str(e))
98 +
99 + try:
100 + self.disk_count = int(self.configuration['disk_count'])
101 + except (KeyError, TypeError) as e:
102 + self.info("Autodetecting number of disks")
103 + self.disk_count = self._get_disk_count()
104 + self.debug(str(e))
105 +
106 data = self._get_data()
107 if data is None:
108 return False