fix(python.d/smartd_log): handle log rotation (#13460)
Ilya Mashchenko committed
Jul 29, 2022 at 18:59 UTC
cf83bad6c10fd28fdef24b1cee3cff6eaa7f0834
1 file changed
+5
-1
collectors/python.d.plugin/smartd_log/smartd_log.chart.py
+5
-1
@@ -630,6 +630,7 @@ class Service(SimpleService):
630
self.exclude = configuration.get('exclude_disks', str()).split()
631
self.disks = list()
632
self.runs = 0
633
+ self.do_force_rescan = False
634
635
def check(self):
636
return self.scan() > 0
@@ -637,9 +638,10 @@ class Service(SimpleService):
638
def get_data(self):
639
self.runs += 1
640
640
- if self.runs % DEF_RESCAN_INTERVAL == 0:
641
+ if self.do_force_rescan or self.runs % DEF_RESCAN_INTERVAL == 0:
642
self.cleanup()
643
self.scan()
644
+ self.do_force_rescan = False
645
646
data = dict()
647
@@ -654,10 +656,12 @@ class Service(SimpleService):
656
657
if changed is None:
658
disk.alive = False
659
+ self.do_force_rescan = True
660
continue
661
662
if changed and disk.populate_attrs() is None:
663
disk.alive = False
664
+ self.do_force_rescan = True
665
continue
666
667
data.update(disk.data())