mirror of
https://forgejo.altau.su/lego/lego-monitoring.git
synced 2026-03-10 04:41:10 +00:00
check disk wearout levels
This commit is contained in:
parent
93f5404bc1
commit
92ce59d6a3
9 changed files with 1560 additions and 8 deletions
|
|
@ -1,6 +1,12 @@
|
|||
import json
|
||||
import unittest
|
||||
|
||||
from misc.disks import LVAttr
|
||||
from misc.disks import (
|
||||
LVAttr,
|
||||
WearoutIndicator,
|
||||
WearoutReading,
|
||||
_get_wearout_reading_from_smartctl_output,
|
||||
)
|
||||
|
||||
|
||||
class TestDisks(unittest.TestCase):
|
||||
|
|
@ -22,6 +28,30 @@ class TestDisks(unittest.TestCase):
|
|||
),
|
||||
)
|
||||
|
||||
def test_wearout_reading_nvme_ssd(self):
|
||||
with open("tests/smartctl_nvme_ssd.json") as f:
|
||||
smartctl_output = json.load(f)
|
||||
self.assertEqual(
|
||||
_get_wearout_reading_from_smartctl_output(smartctl_output),
|
||||
WearoutReading(indicator=WearoutIndicator.SPARE_BLOCKS, current_reading=100, threshold_reading=10),
|
||||
)
|
||||
|
||||
def test_wearout_reading_ata_hdd(self):
|
||||
with open("tests/smartctl_ata_hdd.json") as f:
|
||||
smartctl_output = json.load(f)
|
||||
self.assertEqual(
|
||||
_get_wearout_reading_from_smartctl_output(smartctl_output),
|
||||
WearoutReading(indicator=WearoutIndicator.REALLOCATED_SECTORS, current_reading=200, threshold_reading=140),
|
||||
)
|
||||
|
||||
def test_wearout_reading_ata_ssd(self):
|
||||
with open("tests/smartctl_ata_ssd.json") as f:
|
||||
smartctl_output = json.load(f)
|
||||
self.assertEqual(
|
||||
_get_wearout_reading_from_smartctl_output(smartctl_output),
|
||||
WearoutReading(indicator=WearoutIndicator.SPARE_BLOCKS, current_reading=100, threshold_reading=5),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue