fix: correct zero-safe pathconf checks and connectivity prefix match
- Use `is not None` for pathconf values so 0 is not silently dropped - Broaden connectivity prefix check to catch bare "connectivity" key Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,7 @@ class FilesystemInfoPlugin(InfoPlugin):
|
|||||||
try:
|
try:
|
||||||
# Maximum filename length
|
# Maximum filename length
|
||||||
max_name = os.pathconf(partition.mountpoint, 'PC_NAME_MAX')
|
max_name = os.pathconf(partition.mountpoint, 'PC_NAME_MAX')
|
||||||
if max_name:
|
if max_name is not None:
|
||||||
fs_info['maxfile'] = max_name
|
fs_info['maxfile'] = max_name
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
pass
|
pass
|
||||||
@@ -135,7 +135,7 @@ class FilesystemInfoPlugin(InfoPlugin):
|
|||||||
try:
|
try:
|
||||||
# Maximum path length
|
# Maximum path length
|
||||||
max_path = os.pathconf(partition.mountpoint, 'PC_PATH_MAX')
|
max_path = os.pathconf(partition.mountpoint, 'PC_PATH_MAX')
|
||||||
if max_path:
|
if max_path is not None:
|
||||||
fs_info['maxpath'] = max_path
|
fs_info['maxpath'] = max_path
|
||||||
except (OSError, ValueError):
|
except (OSError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -1556,7 +1556,7 @@ class ThresholdChecker:
|
|||||||
for mp in host.alert_states:
|
for mp in host.alert_states:
|
||||||
# connectivity.* and rtt are managed by the connection state
|
# connectivity.* and rtt are managed by the connection state
|
||||||
# machine, not by threshold config — never purge them.
|
# machine, not by threshold config — never purge them.
|
||||||
if mp == "rtt" or mp.startswith("connectivity."):
|
if mp == "rtt" or mp.startswith("connectivity"):
|
||||||
continue
|
continue
|
||||||
if self._find_threshold(configured, mp)[0] is not None:
|
if self._find_threshold(configured, mp)[0] is not None:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user