fix: stop false-positive [hardware] tickets in a redundant Ceph fleet
Lint / Python (flake8) (push) Successful in 38s
Security / Python Security (bandit) (push) Successful in 39s
Test / Python Tests (pytest) (push) Successful in 51s
Lint / Notify on failure (push) Has been skipped
Lint / Python (flake8) (pull_request) Successful in 1m22s
Security / Python Security (bandit) (pull_request) Successful in 36s
Test / Python Tests (pytest) (pull_request) Successful in 44s
Lint / Notify on failure (pull_request) Has been skipped

Two monitoring-logic fixes so hwmonDaemon stops raising spurious hardware
tickets on a Ceph-backed cluster with PBS backups:

- _check_system_drive_indicators: count dmesg Buffer I/O / block errors
  per-line and skip non-physical / network-backed devices (Ceph RBD, dm-,
  loop). RBD Buffer I/O errors are storage-connectivity events (e.g. a Ceph
  mon-session blip), not local drive faults, so they must not raise a
  CRITICAL drive alert. Consistent with the existing _is_physical_disk
  exclusion. (Fired a false "CRITICAL: Buffer I/O errors (75 occurrences)"
  ticket where all 75 were on rbd devices.)

- _get_attribute_thresholds: drop the Power_On_Hours warning/critical
  threshold. Drive age alone is not a failure; with 2-3x Ceph redundancy
  and PBS backups we run drives to hard-failure rather than replace on age.
  The value is still recorded (history/description/new-drive logic) but no
  longer generates a ticket. Real failure-predictors (reallocated/pending/
  uncorrectable/CRC, self-test, trends) are unchanged.

Adds 7 regression tests (TestSystemDriveIndicators, TestAttributeThresholds).
All 98 tests pass; flake8 clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 15:20:49 -04:00
co-authored by Claude Opus 4.8
parent d9de2dde82
commit 2c6b8c1294
2 changed files with 99 additions and 5 deletions
+18 -4
View File
@@ -1296,10 +1296,20 @@ class SystemHealthMonitor:
(r'nvme\d+.*I/O error', 'NVMe I/O errors')
]
# Kernel-log references to non-physical / network-backed block devices.
# Errors on these are NOT local hardware faults: e.g. "Buffer I/O error on
# dev rbdN" is caused by Ceph connectivity blips, not a failing drive. Ceph
# RBD is likewise excluded from physical-disk monitoring (see _is_physical_disk).
non_physical_dev = re.compile(r'\b(?:rbd\d+|dm-\d+|loop\d+)\b', re.IGNORECASE)
for pattern, description in error_patterns:
matches = re.findall(pattern, result.stdout, re.IGNORECASE)
if matches:
count = len(matches)
compiled = re.compile(pattern, re.IGNORECASE)
# Count matching lines, skipping those for non-physical devices.
count = sum(
1 for line in result.stdout.splitlines()
if compiled.search(line) and not non_physical_dev.search(line)
)
if count:
if count >= 5:
system_health['status'] = 'CRITICAL'
system_health['issues'].append(f"CRITICAL: {description} in system logs ({count} occurrences)")
@@ -2610,7 +2620,11 @@ class SystemHealthMonitor:
'Reported_Uncorrect': {'warning': 1, 'critical': 10},
'Spin_Retry_Count': {'warning': 1, 'critical': 5},
'Power_Cycle_Count': {'warning': 5000, 'critical': 10000},
'Power_On_Hours': {'warning': 61320, 'critical': 70080},
# Power_On_Hours (drive age) intentionally has NO threshold: age alone is not a
# failure and we run drives to hard-failure rather than replace on age. With Ceph
# (2-3x redundancy) + PBS backups, a dead drive just drops an OSD and self-heals.
# The value is still recorded (attributes/history/description); only real
# failure-predictors (reallocated/pending/uncorrectable/CRC, self-test) raise tickets.
'Temperature_Celsius': {'warning': 65, 'critical': 75},
'Available_Spare': {'warning': 30, 'critical': 10},
'Program_Fail_Count': {'warning': 10, 'critical': 20},