smartd_log: skip non-CSVs early (#5081)
Kevin Hanselman committed
Dec 30, 2018 at 19:56 UTC
b328fde08905ad8f62cfe9381d5f1fc6d09592dd
1 file changed
+4
-4
collectors/python.d.plugin/smartd_log/smartd_log.chart.py
+4
-4
@@ -650,6 +650,10 @@ class Service(SimpleService):
650
return len(self.disks)
651
652
def create_disk_from_file(self, full_name, current_time):
653
+ if not full_name.endswith(CSV):
654
+ self.debug('skipping {0}: not a csv file'.format(full_name))
655
+ return None
656
+
657
name = os.path.basename(full_name).split('.')[-3]
658
path = os.path.join(self.log_path, full_name)
659
@@ -659,10 +663,6 @@ class Service(SimpleService):
663
if [p for p in self.exclude if p in name]:
664
return None
665
662
- if not full_name.endswith(CSV):
663
- self.debug('skipping {0}: not a csv file'.format(full_name))
664
- return None
665
-
666
if not os.access(path, os.R_OK):
667
self.debug('skipping {0}: not readable'.format(full_name))
668
return None