I sure will, sorry ! I should have asked before why I was not getting some snmp counters values Instead of trying to fix something that was not broken but just not working as I supposed Nice knowing snmpd_metrics is in base And many thanks for your kind tips And for this new incredible release
-----Message d'origine----- De : [email protected] <[email protected]> De la part de Martijn van Duren Envoyé : mercredi 20 mai 2026 09:26 À : Panagiotis Atmatzidis <[email protected]> Cc : [email protected] Objet : Re: snmpd_metrics 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) 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] > > -- > Panagiotis (atmosx) Atmatzidis > >

