fix(openbsd): declare the CPU unknown in the SNMP health profile
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Failing after 4s
driver / test (3.12) (pull_request) Successful in 55s
driver / types (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 57s
driver / lowest (pull_request) Successful in 29s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m10s
CI / driver (pull_request) Failing after 2m27s
driver / publish (pull_request) Skipped
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Failing after 4s
driver / test (3.12) (pull_request) Successful in 55s
driver / types (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 57s
driver / lowest (pull_request) Successful in 29s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m10s
CI / driver (pull_request) Failing after 2m27s
driver / publish (pull_request) Skipped
net-snmp on OpenBSD answers ssCpuIdle with 0 on an idle host (and hrProcessorLoad with 100), so a reading of the standard OID shows every OpenBSD host at 100 % CPU. The profile now marks the CPU unknown, and the application reports no figure instead of a wrong one. Memory, swap and load stay on the standard reading. Closes #7
This commit is contained in:
1 parent
ce4a677756
commit
86cdde03bf
4 files changed
+25
-2
No files matched your search
@@ -26,6 +26,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
3.12 venv no longer has.
|
||||
|
||||
### Fixed
|
||||
- An OpenBSD host no longer reads as 100 % busy (#7). net-snmp on OpenBSD answers
|
||||
`ssCpuIdle` with 0 on an idle machine, so `OpenBSDDriver` declares the CPU unknown
|
||||
in its `SNMP_HEALTH_PROFILE` (`{"cpu": {"unknown": True}}`), and the application
|
||||
reports no CPU figure. Memory, swap and load are read as before. Requires the
|
||||
napalm-device-types release with `SnmpValueSpec.unknown`.
|
||||
- FreeBSD and OpenBSD hosts are in the role `bsd`, one key for both (#10). They
|
||||
inherited `OSDriver`'s `linux`, so an application that shows or branches on the
|
||||
role treated them as Linux hosts. An application that keys on `linux` for every
|
||||
|
||||
@@ -83,7 +83,8 @@ on Linux (v2c, community `public`, every address), so the agent answers
|
||||
UCD-SNMP-MIB for netOrk's health metrics. Memory, swap and load are right on
|
||||
both systems. CPU: FreeBSD reports `ssCpuIdle` about a minute after the
|
||||
agent starts; on OpenBSD net-snmp's CPU figures are wrong (0 % idle on an idle
|
||||
machine, also in `hrProcessorLoad`).
|
||||
machine, also in `hrProcessorLoad`), so `OpenBSDDriver`'s `SNMP_HEALTH_PROFILE`
|
||||
marks the CPU unknown and the application reports none.
|
||||
|
||||
## Connection arguments
|
||||
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from napalm_device_types import FingerprintRule
|
||||
from typing import ClassVar
|
||||
|
||||
from napalm_device_types import FingerprintRule, SnmpHealthProfile
|
||||
|
||||
from napalm_bsd import parse
|
||||
from napalm_bsd.base import BASE_SYSTEM, BsdDriver
|
||||
@@ -16,6 +18,9 @@ class OpenBSDDriver(BsdDriver):
|
||||
DRIVER_NAME = "openbsd"
|
||||
# OpenBSD's SSH banner names no OS; its sysDescr does ("OpenBSD host 7.9 GENERIC.MP#449").
|
||||
SNMP_FINGERPRINT = [FingerprintRule("openbsd", weight=5.0)]
|
||||
# net-snmp maps OpenBSD's CPU states wrongly: ssCpuIdle is 0 on an idle host, and
|
||||
# hrProcessorLoad 100. No figure beats one that says the host is always busy (#7).
|
||||
SNMP_HEALTH_PROFILE: ClassVar[SnmpHealthProfile] = {"cpu": {"unknown": True}}
|
||||
|
||||
OS_VERSION_COMMAND = "uname -sr"
|
||||
# The kernel's build, e.g. GENERIC.MP#449; the release is in uname -r.
|
||||
|
||||
@@ -465,6 +465,18 @@ class TestServices:
|
||||
assert driver.calls == []
|
||||
|
||||
|
||||
class TestSnmpHealthProfile:
|
||||
"""Where netOrk's SNMP poll reads each health value (#7)."""
|
||||
|
||||
def test_openbsd_cpu_is_unknown(self):
|
||||
"""net-snmp on OpenBSD answers 0 % idle on an idle host: no value beats 100 %."""
|
||||
assert OpenBSDDriver.SNMP_HEALTH_PROFILE == {"cpu": {"unknown": True}}
|
||||
|
||||
def test_freebsd_is_read_the_standard_way(self):
|
||||
"""FreeBSD's ssCpuIdle is right, as are memory, swap and load on both."""
|
||||
assert not getattr(FreeBSDDriver, "SNMP_HEALTH_PROFILE", None)
|
||||
|
||||
|
||||
class TestSnmp:
|
||||
"""net-snmp from packages, as decided in NetOrk/netork#800: UCD-SNMP-MIB,
|
||||
the same health metrics as on Linux. Set up through napalm-device-types'
|
||||
|
||||
Reference in new issue
Block a user