Please keep any AI generated answers detached from reality of this list. martijn@
On 5/20/26 09:06, Panagiotis Atmatzidis wrote: > Hi, > >> On 19 May 2026, at 10:07 PM, Steve Shockley <[email protected]> >> wrote: >> >> Hi, I'm using OpenBSD 7.8 and -current, and for a variety of reasons I'm >> using Net-SNMPD instead of the built-in one. Previously I was forwarding >> from net_snmpd using proxy to snmpd listening on localhost. I recently >> discovered snmpd_metrics, which seems to do something similar without >> worrying about which oids to forward. >> >> If I add agentx to the net_snmpd config and run snmpd_metrics -d -v, it >> works great and I can see all the queries. The documentation is a little >> sparse, but I discovered in the initial commit message (end of >> https://cvsweb.openbsd.org/log/src/libexec/snmpd/snmpd_metrics/mib.c,v) that >> it needs to be run as a daemon. >> >> Is a template available for rc.d? I can write one myself, but what user >> should it run as? > > You can check the /etc/rc.d directory. Looking at the tree, something like > this should do (/etc/rc.d/net_snmpd): > > ``` > #!/bin/ksh > # > # <description> > > daemon="/usr/local/sbin/snmpd" > daemon_flags="-u _netsnmp -I -p /var/run/net_snmpd.pid" > # or skip IPv6: daemon_flags="-u _netsnmp -I -ipv6 -p /var/run/net_snmpd.pid" > > . /etc/rc.d/rc.subr > > rc_pre() { > install -d -o _netsnmp -g _snmpd -m 0770 /var/agentx > } > > rc_reload=NO # apparently not supported, use `restart` > > rc_cmd $1 > ``` > > I'd go with a dedicated user e.g. > `_netsnmp': `useradd -s /sbin/nologin -d /nonexistent _netsnmp` > >> I noticed if snmpd_metrics is running and net_snmpd restarts, it prints >> [fd:4]: lost connection: Connection reset by peer >> Failed to connect to snmpd: Permission denied >> Failed to connect to snmpd: Permission denied >> >> and never recovers. Is there a way to make snmpd_metrics "depend" on >> net_snmpd so if net_ restarts it also restarts _metrics? (Or should it be >> able to recover from that?) > > The rc system supports order through the “pkg_scripts” keyword[1], but > not that kind of scenario. So you can do something like: > > >> I noticed if snmpd_metrics is running and net_snmpd restarts, it prints >> [fd:4]: lost connection: Connection reset by peer >> Failed to connect to snmpd: Permission denied >> Failed to connect to snmpd: Permission denied >> >> and never recovers. Is there a way to make snmpd_metrics "depend" on >> net_snmpd so if net_ restarts it also restarts _metrics? (Or should it be >> able to recover from that?) > > > But that's for the boot process only. AFAIK only systemd does take care > the scenario you described. Maybe a cron script with the following > logic: when App1 PID changes, restart App1. > > > Kind regards, > > > [1] https://man.openbsd.org/rc.conf.8 and > > -- > Panagiotis (atmosx) Atmatzidis > >

