firmware pattern matching
This commit is contained in:
@ -109,20 +109,20 @@ class SystemHealthMonitor:
|
|||||||
}
|
}
|
||||||
MANUFACTURER_SMART_PROFILES = {
|
MANUFACTURER_SMART_PROFILES = {
|
||||||
'Ridata': {
|
'Ridata': {
|
||||||
'aliases': ['Ridata', 'Ritek', 'RIDATA', 'RITEK', 'SSD 512GB'], # Add the generic model
|
'aliases': ['Ridata', 'Ritek', 'RIDATA', 'RITEK', 'SSD 512GB'], # Keep the generic model
|
||||||
'firmware_patterns': ['HT3618B7', 'HT36'], # Add firmware pattern matching
|
'firmware_patterns': ['HT3618B7', 'HT36'], # Add exact firmware match first
|
||||||
'wear_leveling_behavior': 'countup',
|
'wear_leveling_behavior': 'countup',
|
||||||
'wear_leveling_baseline': 0,
|
'wear_leveling_baseline': 0,
|
||||||
'wear_leveling_thresholds': {
|
'wear_leveling_thresholds': {
|
||||||
'warning': 500000, # Much higher threshold for countup behavior
|
'warning': 1000000, # Increase threshold significantly
|
||||||
'critical': 1000000 # Very high threshold
|
'critical': 2000000 # Very high threshold for countup behavior
|
||||||
},
|
},
|
||||||
'attributes': {
|
'attributes': {
|
||||||
'Wear_Leveling_Count': {
|
'Wear_Leveling_Count': {
|
||||||
'behavior': 'countup',
|
'behavior': 'countup',
|
||||||
'baseline': 0,
|
'baseline': 0,
|
||||||
'warning_threshold': 500000,
|
'warning_threshold': 1000000, # Much higher threshold
|
||||||
'critical_threshold': 1000000,
|
'critical_threshold': 2000000, # Very high threshold
|
||||||
'description': 'Total wear leveling operations performed (countup from 0)',
|
'description': 'Total wear leveling operations performed (countup from 0)',
|
||||||
'ignore_on_new_drive': True # Don't alert on new drives
|
'ignore_on_new_drive': True # Don't alert on new drives
|
||||||
}
|
}
|
||||||
@ -1110,23 +1110,25 @@ class SystemHealthMonitor:
|
|||||||
"""
|
"""
|
||||||
Get manufacturer-specific SMART profile based on drive model/manufacturer/firmware.
|
Get manufacturer-specific SMART profile based on drive model/manufacturer/firmware.
|
||||||
"""
|
"""
|
||||||
|
logger.debug(f"Looking for profile - Model: '{model}', Manufacturer: '{manufacturer}', Firmware: '{firmware}'")
|
||||||
|
|
||||||
# Check each manufacturer profile
|
# Check each manufacturer profile
|
||||||
for mfg, profile in self.MANUFACTURER_SMART_PROFILES.items():
|
for mfg, profile in self.MANUFACTURER_SMART_PROFILES.items():
|
||||||
# Check firmware patterns first (most specific for OEM drives)
|
# Check firmware patterns first (most specific for OEM drives like RiData)
|
||||||
if firmware and 'firmware_patterns' in profile:
|
if firmware and 'firmware_patterns' in profile:
|
||||||
for pattern in profile['firmware_patterns']:
|
for pattern in profile['firmware_patterns']:
|
||||||
if pattern in firmware:
|
if firmware.startswith(pattern) or pattern in firmware:
|
||||||
logger.debug(f"Matched manufacturer profile: {mfg} for firmware: {firmware}")
|
logger.debug(f"Matched manufacturer profile: {mfg} for firmware pattern '{pattern}' in '{firmware}'")
|
||||||
return profile
|
return profile
|
||||||
|
|
||||||
# Check model/manufacturer aliases
|
# Check model/manufacturer aliases
|
||||||
for alias in profile['aliases']:
|
for alias in profile['aliases']:
|
||||||
if alias.lower() in model.lower() or (manufacturer and alias.lower() in manufacturer.lower()):
|
if alias.lower() in model.lower() or (manufacturer and alias.lower() in manufacturer.lower()):
|
||||||
logger.debug(f"Matched manufacturer profile: {mfg} for model: {model}")
|
logger.debug(f"Matched manufacturer profile: {mfg} for model alias '{alias}' in '{model}'")
|
||||||
return profile
|
return profile
|
||||||
|
|
||||||
# Return generic profile if no match
|
# Return generic profile if no match
|
||||||
logger.debug(f"No specific profile found for {model}, using Generic profile")
|
logger.debug(f"No specific profile found for Model: '{model}', Firmware: '{firmware}', using Generic profile")
|
||||||
return self.MANUFACTURER_SMART_PROFILES['Generic']
|
return self.MANUFACTURER_SMART_PROFILES['Generic']
|
||||||
|
|
||||||
def _is_new_drive(self, power_on_hours: int) -> bool:
|
def _is_new_drive(self, power_on_hours: int) -> bool:
|
||||||
@ -1162,12 +1164,17 @@ class SystemHealthMonitor:
|
|||||||
smart_health['issues'].append("Unable to read device information")
|
smart_health['issues'].append("Unable to read device information")
|
||||||
return smart_health
|
return smart_health
|
||||||
|
|
||||||
|
logger.debug(f"Drive details for {device}: {drive_details}")
|
||||||
|
|
||||||
manufacturer_profile = self._get_manufacturer_profile(
|
manufacturer_profile = self._get_manufacturer_profile(
|
||||||
drive_details.get('model', ''),
|
drive_details.get('model', ''),
|
||||||
drive_details.get('manufacturer', '')
|
drive_details.get('manufacturer', ''),
|
||||||
|
drive_details.get('firmware', '') # Add firmware to the call
|
||||||
)
|
)
|
||||||
smart_health['manufacturer_profile'] = manufacturer_profile
|
smart_health['manufacturer_profile'] = manufacturer_profile
|
||||||
|
|
||||||
|
logger.debug(f"Selected manufacturer profile for {device}: {manufacturer_profile.get('aliases', ['Unknown'])[0] if manufacturer_profile else 'None'}")
|
||||||
|
|
||||||
# Get firmware information
|
# Get firmware information
|
||||||
firmware_info = self._check_disk_firmware(device)
|
firmware_info = self._check_disk_firmware(device)
|
||||||
if firmware_info['is_problematic']:
|
if firmware_info['is_problematic']:
|
||||||
|
|||||||
Reference in New Issue
Block a user