Skip to content

Expose generic-worker status + pool ID via snmpd extend (Mac)#1217

Open
markcor wants to merge 2 commits into
masterfrom
RELOPS-snmp-gw-pool-id-mac
Open

Expose generic-worker status + pool ID via snmpd extend (Mac)#1217
markcor wants to merge 2 commits into
masterfrom
RELOPS-snmp-gw-pool-id-mac

Conversation

@markcor
Copy link
Copy Markdown
Contributor

@markcor markcor commented May 15, 2026

Summary

Adds macOS support for the same SNMP-based marlin checks already implemented for Linux in #1216:

  • gw_status — whether generic-worker is running on the worker
  • worker_pool_id — the worker's pool ID (workerType) read from /etc/generic-worker.config

Install pattern (follows existing macOS conventions)

This PR introduces packages::net_snmp which uses the existing packages::macos_package_from_s3 defined type — the same pattern used for OpenSSL, Java, Node.js, Chrome, generic-worker, etc. on macOS workers. Operators upload net-snmp-${version}.pkg to the standard S3 bucket; Puppet's pkgdmg provider installs it.

Files

  • modules/packages/manifests/net_snmp.pp (new) — wraps packages::macos_package_from_s3 for the net-snmp-${version}.pkg artifact
  • modules/macos_snmpd/ (new module, mirrors linux_snmpd):
    • manifests/init.pprequire packages::net_snmp, drops snmpd.conf + scripts + LaunchDaemon
    • files/snmp_check_gw.sh — identical to the Linux version (Mac and Linux share /etc/generic-worker.config layout and run the same generic-worker binary)
    • files/snmp_worker_pool_id.sh — identical to Linux
    • templates/snmpd.conf.epp — same extend lines as Linux
    • templates/launchdaemon.plist.epp/Library/LaunchDaemons/net.net-snmp.snmpd.plist runs snmpd from $snmpd_path (default /usr/sbin/snmpd; override if the S3 .pkg installs elsewhere)

Same hiera knobs as linux_snmpd

  • snmpd::enabled (default true)
  • snmpd::ro_community (required; secret)

Out of scope for this PR

  1. Building the net-snmp-${version}.pkg artifact and uploading it to the packages S3 bucket — this needs an ops handoff to whoever maintains the macOS .pkg pipeline.
  2. Wiring macos_snmpd into a role/profile — recommended location is a shared mac base profile, but I want a test run on one machine before broad rollout. Operators can include it on a single host first to confirm the .pkg install path matches $snmpd_path.

Companion PRs

  • Linux: Expose generic-worker status + pool ID via snmpd extend (Linux) #1216 — same scripts/config for Linux via the existing linux_snmpd module
  • marlin: mozilla-it/marlin#17 — already includes the Mac side (service definitions in services-mac.j2, ~416 host blocks in fxci-macos.j2 sourced from the inventory.d YAMLs, shared snmp_worker_pool_id_check.sh wrapper that writes to InfluxDB)

Test plan

  • Land Expose generic-worker status + pool ID via snmpd extend (Linux) #1216 first; verify Linux side works end-to-end
  • Build & upload net-snmp-${version}.pkg to S3
  • Add include macos_snmpd to one test mac's role
  • On the test mac: confirm snmpd is running and listening on udp/161
  • From marlin1: snmpget -v2c -c <community> -O qv <mac-host> 'NET-SNMP-EXTEND-MIB::nsExtendOutputFull.\"gw_status\"' returns OK - generic-worker running
  • Confirm worker_pool_id query returns OK - worker_pool_id=<pool>
  • In IcingaWeb2 (once marlin#17 is also merged): Mac Generic Worker + Mac Worker Pool ID services appear OK on the test host
  • Flux query against marlin-icinga2 returns a host_pool record for the test mac
  • Once verified, broaden via shared macOS base profile
markcor added 2 commits May 15, 2026 13:20
Adds macOS support for the same SNMP-based marlin checks already
implemented for Linux in #1216:
  - generic-worker process status
  - worker pool ID (workerType from /etc/generic-worker.config)

Changes:

* New `packages::net_snmp` class — installs net-snmp on macOS via the
  standard `packages::macos_package_from_s3` pattern. Operators upload
  the `net-snmp-${version}.pkg` artifact to the existing packages S3
  bucket; Puppet's `pkgdmg` provider installs it.

* New `macos_snmpd` module mirroring `linux_snmpd`:
  - declares `require packages::net_snmp`
  - drops `/etc/snmp/snmpd.conf` with the same `extend` directives
    (gw_status and worker_pool_id) as the Linux module
  - deploys identical scripts to /usr/local/bin/ (Mac and Linux share
    /etc/generic-worker.config layout and run the same generic-worker
    binary, so the scripts are byte-for-byte identical)
  - sets up a LaunchDaemon (/Library/LaunchDaemons/net.net-snmp.snmpd.plist)
    that runs `snmpd` from a configurable `$snmpd_path` (default
    `/usr/sbin/snmpd`; override if the S3 .pkg installs elsewhere)
  - same hiera knobs as linux_snmpd: `snmpd.enabled` and
    `snmpd.ro_community`

* `macos_snmpd` is not yet wired into any role; that should follow once
  the .pkg artifact lands in S3 and the install path is confirmed on a
  test mac. Recommended: include it from a shared mac base profile.

Companion: marlin PR mozilla-it/marlin#17 already includes the Mac side
(service definitions in services-mac.j2, host blocks in fxci-macos.j2,
shared snmp_worker_pool_id_check.sh wrapper that writes to InfluxDB).
Mirrors the fix in the Linux PR (#1216)
after @aerickson found that /etc/generic-worker.config is generated
just-in-time per task and isn't reliably present at snmpd poll time.

Mac's worker_runner module writes /opt/worker/worker-runner-config.yaml
(see modules/worker_runner/manifests/init.pp: $data_dir defaults to
/opt/worker and $worker_runner_conf = "${data_dir}/worker-runner-config.yaml").
Read workerPoolID from that file instead, and strip the "<provisionerId>/"
prefix to expose just the pool name (matches Windows/host_pool semantics).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant