firmware pattern matching
This commit is contained in:
@ -109,22 +109,22 @@ class SystemHealthMonitor:
|
||||
}
|
||||
MANUFACTURER_SMART_PROFILES = {
|
||||
'Ridata': {
|
||||
'aliases': ['Ridata', 'Ritek', 'RIDATA', 'RITEK', 'SSD 512GB'], # Add the generic model
|
||||
'firmware_patterns': ['HT3618B7', 'HT36'], # Add firmware pattern matching
|
||||
'aliases': ['Ridata', 'Ritek', 'RIDATA', 'RITEK', 'SSD 512GB'], # Keep the generic model
|
||||
'firmware_patterns': ['HT3618B7', 'HT36'], # Add exact firmware match first
|
||||
'wear_leveling_behavior': 'countup',
|
||||
'wear_leveling_baseline': 0,
|
||||
'wear_leveling_thresholds': {
|
||||
'warning': 500000, # Much higher threshold for countup behavior
|
||||
'critical': 1000000 # Very high threshold
|
||||
'warning': 1000000, # Increase threshold significantly
|
||||
'critical': 2000000 # Very high threshold for countup behavior
|
||||
},
|
||||
'attributes': {
|
||||
'Wear_Leveling_Count': {
|
||||
'behavior': 'countup',
|
||||
'baseline': 0,
|
||||
'warning_threshold': 500000,
|
||||
'critical_threshold': 1000000,
|
||||
'warning_threshold': 1000000, # Much higher threshold
|
||||
'critical_threshold': 2000000, # Very high threshold
|
||||
'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.
|
||||
"""
|
||||
logger.debug(f"Looking for profile - Model: '{model}', Manufacturer: '{manufacturer}', Firmware: '{firmware}'")
|
||||
|
||||
# Check each manufacturer profile
|
||||
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:
|
||||
for pattern in profile['firmware_patterns']:
|
||||
if pattern in firmware:
|
||||
logger.debug(f"Matched manufacturer profile: {mfg} for firmware: {firmware}")
|
||||
if firmware.startswith(pattern) or pattern in firmware:
|
||||
logger.debug(f"Matched manufacturer profile: {mfg} for firmware pattern '{pattern}' in '{firmware}'")
|
||||
return profile
|
||||
|
||||
# Check model/manufacturer aliases
|
||||
for alias in profile['aliases']:
|
||||
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 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']
|
||||
|
||||
def _is_new_drive(self, power_on_hours: int) -> bool:
|
||||
@ -1162,11 +1164,16 @@ class SystemHealthMonitor:
|
||||
smart_health['issues'].append("Unable to read device information")
|
||||
return smart_health
|
||||
|
||||
logger.debug(f"Drive details for {device}: {drive_details}")
|
||||
|
||||
manufacturer_profile = self._get_manufacturer_profile(
|
||||
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
|
||||
|
||||
logger.debug(f"Selected manufacturer profile for {device}: {manufacturer_profile.get('aliases', ['Unknown'])[0] if manufacturer_profile else 'None'}")
|
||||
|
||||
# Get firmware information
|
||||
firmware_info = self._check_disk_firmware(device)
|
||||
|
||||
Reference in New Issue
Block a user