Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jun 2024 19:18:33 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        Budi Janto <budijanto@studiokaraoke.co.id>
Cc:        Dan Langille <dan@langille.org>, pkg@freebsd.org
Subject:   Re: NULL result with net-snmp-5.9.4_1,1
Message-ID:  <Zlz9yVL5WUeBXjUn@nuc>
In-Reply-To: <e50a2e6e-0e3b-4406-93c5-24e95a969fb0@studiokaraoke.co.id>
References:  <908894bb-9be8-455b-8fee-e7164d2451e9@studiokaraoke.co.id> <f4d2e9e6-8c71-4a18-bab4-595adc2a834e@app.fastmail.com> <ZltCFitoO9znmsPg@framework> <e50a2e6e-0e3b-4406-93c5-24e95a969fb0@studiokaraoke.co.id>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jun 02, 2024 at 02:36:44PM +0700, Budi Janto wrote:
> On 6/1/24 22:45, Mark Johnston wrote:
> > I believe that in net-snmp-5.9.4_1,1, snmpd is running as the "snmpd"
> > user rather than as root.  Can you confirm this?  net-snmp-5.9.4_2,1
> > reverts back to running as root.  Does that fix the problem for you?
> 
> Sure,
> 
> # ps axu | grep snmpd
> root     1756    0.0  0.0   34688   13512  -  S    Sat07       1:15.54
> /usr/local/sbin/snmpd -p /var/run/net_snmpd.pid -c /usr/local/etc/snmpd.conf
> root    79855    0.0  0.0   12876    2432  0  S+   14:29       0:00.00 grep
> snmpd

I guess this is with net-snmp-5.9.4_2,1?

> # grep snmp-cpu-temperature.sh /usr/local/etc/snmpd.conf
> extend  cpu-temperature /root/x/snmp-cpu-temperature.sh
> 
> > What is in your snmp-cpu-temperature.sh script?  Does it need to run as
> > root?  (I'd be a bit surprised if so.)
> 
> Yes, running with root privilege.
> 
> # cat /root/x/snmp-cpu-temperature.sh
> #!/usr/bin/env sh
> 
> for index in $(jot - 0 11)
> do
>     sysctl -n dev.cpu.$index.temperature | awk '{gsub("C",""); print}'
> done

This script does not need to run as root.  If you change snmpd.conf to:

  extend  cpu-temperature sh /root/x/snmp-cpu-temperature.sh

and set snmpd_sugid="YES" in rc.conf (to make snmpd drop privileges) and
restart snmpd, are you able to see the temperatures again?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Zlz9yVL5WUeBXjUn>