feat: set up SNMP with net-snmp
CI / test (3.10) (pull_request) Successful in 30s
CI / test (3.11) (pull_request) Successful in 32s
CI / test (3.12) (pull_request) Successful in 36s
CI / test (3.10) (push) Successful in 45s
CI / test (3.11) (push) Successful in 30s
CI / test (3.12) (push) Successful in 29s

run_device_action("fix_snmp") and get_snmp_config for both drivers, as
decided in NetOrk/netork#800: net-snmp from packages rather than the base
daemons, because it answers UCD-SNMP-MIB, which netOrk's health metrics
read.

- fix_snmp installs net-snmp, writes the configuration netOrk uses on
  Linux (v2c, community "public", agentAddress udp:161) through stdin as
  root, enables and restarts the agent (FreeBSD `service snmpd`, OpenBSD
  `rcctl ... netsnmpd`, as `snmpd` is OpenBSD's own daemon) and asks it
  for sysDescr. It stops at the first step that fails and says why.
- get_snmp_config reports a running net-snmp's community and port.
- FreeBSD's install_package bootstraps pkg on a classic system that never
  had it instead of waiting for an answer that never comes.

Checked live: FreeBSD from a bare system, OpenBSD again over an existing
setup. Memory, swap and load answer on both; FreeBSD's ssCpuIdle about a
minute after start; OpenBSD's CPU figures from net-snmp are wrong (#800).
This commit is contained in:
2026-10-08 10:05:09 +02:00
parent 7bf028ef4d
commit aef58ca161
6 changed files with 190 additions and 4 deletions
+7 -1
View File
@@ -36,6 +36,7 @@ over SSH, built on [napalm-device-types](https://git.netork.io/NAPALM/napalm-dev
| `get_packages`, `install_package`, `uninstall_package` | ✓ | ✓ | `pkg query` / `pkg install`, `pkg delete`; `pkg_info` / `pkg_add -I`, `pkg_delete` |
| `get_available_updates` | ✓ | ✓ | `pkg upgrade -n` + `pkg audit` (VuXML); `pkg_add -u -n -v` + `syspatch -c` |
| `get_services`, `manage_service` | ✓ | ✓ | `service -e` + `service … status` / `service … <action>`; `rcctl ls on` + `rcctl check` / `rcctl <action>` |
| `run_device_action("fix_snmp")`, `get_snmp_config` | ✓ | ✓ | net-snmp from packages: `/usr/local/etc/snmp/snmpd.conf` + `service snmpd`; `/etc/snmp/snmpd.conf` + `rcctl … netsnmpd` |
`get_listening_sockets` has the shape of napalm-device-types'
`ListeningSocketsMixin` (whose `ss`/cgroup reading is Linux's) and its rule:
@@ -61,7 +62,12 @@ needs no extra entry.
root-only pidfiles hide a daemon from anyone else, and without root when sudo
refuses; OpenBSD's `rcctl check` needs no root. Actions run as root.
SNMP (#800) follows.
**SNMP** is net-snmp from packages (NetOrk/netork#800), configured as netOrk does
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`).
## Connection arguments