Re: NULL result with net-snmp-5.9.4_1,1
- Reply: Budi Janto : "Re: NULL result with net-snmp-5.9.4_1,1"
- In reply to: Budi Janto : "Re: NULL result with net-snmp-5.9.4_1,1"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 02 Jun 2024 23:18:33 UTC
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?