1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

raid2: add support for LSI MPT Fusion SAS 3.0 RAID

This commit is contained in:
Kim B. Heino 2022-08-10 11:17:08 +03:00 committed by Kenyon Ralph
parent 836ec47f1f
commit eea45ab34b

View file

@ -8,7 +8,7 @@ raid2 - monitor software and hardware RAID and scrub status
=head1 APPLICABLE SYSTEMS =head1 APPLICABLE SYSTEMS
Linux systems with mdraid, btrfs, cciss or megasasctl RAID. Linux systems with mdraid, btrfs, cciss, mpt3sas or megasasctl RAID.
=head1 CONFIGURATION =head1 CONFIGURATION
@ -111,11 +111,10 @@ def find_mdstat():
"""Parse /proc/mdstat.""" """Parse /proc/mdstat."""
# Read file # Read file
try: try:
fhn = open('/proc/mdstat') with open('/proc/mdstat', encoding='utf-8') as fhn:
except IOError: lines = fhn.readlines()
except OSError:
return [] return []
lines = fhn.readlines()
fhn.close()
# Parse it # Parse it
devices = [] devices = []
@ -138,11 +137,10 @@ def find_btrfs():
"""Parse /proc/mounts and btrfs scrub status. Ignore csum errors.""" """Parse /proc/mounts and btrfs scrub status. Ignore csum errors."""
# Read file # Read file
try: try:
fhn = open('/proc/mounts') with open('/proc/mounts', encoding='utf-8') as fhn:
except IOError: lines = fhn.readlines()
except OSError:
return [] return []
lines = fhn.readlines()
fhn.close()
# Parse it # Parse it
devmap = {} devmap = {}
@ -172,10 +170,24 @@ def find_btrfs():
return devices return devices
def find_mpt3sas():
"""Read LSI MPT Fusion RAID status from /sys files."""
statefiles = sorted(glob.glob('/sys/class/raid_devices/*/state'))
if not statefiles:
return []
status = 1
for statefile in statefiles:
with open(statefile, encoding='utf-8') as fhn:
if 'active' not in fhn.read():
status = 0
break
return [('mpt3sas', status, 'LSI MPT Fusion SAS 3.0')]
def find_devices(): def find_devices():
"""Return list of found device tuples.""" """Return list of found device tuples."""
devices = find_cciss() + find_megasasctl() + find_mdstat() + find_btrfs() return (find_mdstat() + find_btrfs() + find_cciss() + find_mpt3sas() +
return devices find_megasasctl())
def config(devices): def config(devices):