Solved net-snmp reports No Such Object available on this agent at this OID

dvl@

Developer
I'm having trouble with net-snmp-5.9.1_3,1 on FreeBSD 13.2

I can't get it to display memory usage within librenms-23.7.0,1

I've been trying to track it down and found this:

Code:
[20:14 besser dan ~] % snmpwalk -v3 -l authPriv -u [auth stuff redacted] 10.55.0.74 hrMemorySize.0
HOST-RESOURCES-MIB::hrMemorySize.0 = No Such Object available on this agent at this OID

I am sure this is at the root of the problem.

On the client in question, this is snmpd:

Code:
[20:15 knew dan ~] % ps auwwx | grep snmpd
root       85376   0.0  0.0  39184  24492  -  S    Mon21        1:59.79 /usr/local/sbin/snmpd -p /var/run/net_snmpd.pid -c /usr/local/etc/snmpd.conf -a -r

Code:
[21:01 knew dan ~] % grep snmp /etc/rc.conf
snmpd_enable="YES"
snmpd_flags="-a -r"
snmpd_conffile="/usr/local/etc/snmpd.conf"

Code:
[20:15 knew dan ~] % cat /usr/local/etc/snmpd.conf
agentAddress  udp:10.55.0.74:161,tcp:10.55.0.74:161

sysLocation    Over there
sysContact     dan@langille.org

extend ntp-client       /usr/local/etc/snmp/ntp-client.sh
extend smart            /usr/local/etc/snmp/smart
extend zfs              /usr/local/etc/snmp/zfs-freebsd

Any ideas as to where to check next?
 
/usr/local/etc/snmpd.conf
This seems to be wrong path, to double check run it as (with service stopped): /usr/local/sbin/snmpd -f -Lo. Works for me with /usr/local/etc/snmp/snmpd.conf as config path.

EDIT: sorry, missed the -c in your ps output.
 
Does it work if you (temporarily) lower the required authorization level, e.g. using rocommunity public and do a snmpwalk -v2c -c public?
 
This seems to be wrong path, to double check run it as (with service stopped): /usr/local/sbin/snmpd -f -Lo. Works for me with /usr/local/etc/snmp/snmpd.conf as config path.

EDIT: sorry, missed the -c in your ps output.
See also:

Code:
[21:01 knew dan ~] % grep snmp /etc/rc.conf
snmpd_enable="YES"
snmpd_flags="-a -r"
snmpd_conffile="/usr/local/etc/snmpd.conf"

I'll add this to the OP.
 
Does it work if you (temporarily) lower the required authorization level, e.g. using rocommunity public and do a snmpwalk -v2c -c public?
Not without further work (I'm guessing):
Code:
[21:07 besser dan ~] % snmpwalk -v2c -c public 10.55.0.74 hrMemorySize.0                     
Timeout: No Response from 10.55.0.74

I also tried:

Code:
[21:13 besser dan ~] % snmpwalk -v3 -c public 10.55.0.74 hrMemorySize.0
snmpwalk: No securityName specified (Sub-id not found: (top) -> hrMemorySize)
[21:10 besser dan ~] % snmpwalk -v3 -c authOnlyUser 10.55.0.74 hrMemorySize.0
snmpwalk: No securityName specified (Sub-id not found: (top) -> hrMemorySize)
[21:12 besser dan ~] % snmpwalk -v1 -c public 10.55.0.74 hrMemorySize.0
Timeout: No Response from 10.55.0.74
 
Not without further work (I'm guessing):
Code:
[21:07 besser dan ~] % snmpwalk -v2c -c public 10.55.0.74 hrMemorySize.0                   
Timeout: No Response from 10.55.0.74

I also tried:

Code:
[21:13 besser dan ~] % snmpwalk -v3 -c public 10.55.0.74 hrMemorySize.0
snmpwalk: No securityName specified (Sub-id not found: (top) -> hrMemorySize)
[21:10 besser dan ~] % snmpwalk -v3 -c authOnlyUser 10.55.0.74 hrMemorySize.0
snmpwalk: No securityName specified (Sub-id not found: (top) -> hrMemorySize)
[21:12 besser dan ~] % snmpwalk -v1 -c public 10.55.0.74 hrMemorySize.0
Timeout: No Response from 10.55.0.74
Then did the "further work": I added this to /usr/local/etc/snmpd.conf and restarted snmpd

Code:
rocommunity public

and got:

Code:
[21:16 besser dan ~] % snmpwalk -v2c -c public 10.55.0.74 hrMemorySize.0
HOST-RESOURCES-MIB::hrMemorySize.0 = No Such Object available on this agent at this OID
 
Then did the "further work"
Thanks, I just wanted to make sure this isn't the case where access is restricted by v3 users being allowed to access only specified OIDs (and their children).

I see you specified '-r' in the options which allows running snmpd as non-root (which could possibly explain the missing handler for hrMemorySize), but guessing on port 161, you are running it as root, correct?

Just tried installing the latest package (5.9.1_3,1) and this works for me with this minimal configuration:
Code:
syslocation     here
syscontact      yuri@aetern.org

rocommunity     public

Code:
$ snmpwalk -v2c -c public titan hrMemorySize.0
HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 16735280 KBytes

Try running snmpd in foreground with debug set to the HR handler and try accessing the hrMemorySize, may be something in the output could provide any hints?
Code:
# /usr/local/sbin/snmpd -f -Lo -Dhost
registered debug token host, 1
nlist err: neither tcb nor _tcb found.
nlist err: neither udb nor _udb found.
NET-SNMP version 5.9.1
host/hr_storage: var_hrstoreEntry: request HOST-RESOURCES-MIB::hrMemorySize.0 exact=0
host/hr_storage: var_hrstoreEntry: compare HOST-RESOURCES-MIB::hrStorageIndex => -1
host/hr_storage: var_hrstoreEntry: process HOST-RESOURCES-MIB::hrStorageIndex.1 (0x1ab11d9cc1c0)
 
Try:
Code:
snmpwalk -v1 -c public  127.0.0.1 | grep hrMemorySize
Code:
[17:2[CODE]
4 knew dan ~] % snmpwalk -v1 -c public  10.55.0.74 | grep hrMemorySize
[17:25 knew dan ~] %

Which is not unexpected, to me, given:

Code:
HOST-RESOURCES-MIB::hrMemorySize.0 = No Such Object available on this agent at this OID

as found in the output of this reply
 
Thanks, I just wanted to make sure this isn't the case where access is restricted by v3 users being allowed to access only specified OIDs (and their children).

I see you specified '-r' in the options which allows running snmpd as non-root (which could possibly explain the missing handler for hrMemorySize), but guessing on port 161, you are running it as root, correct?

Yes. root can be seen in the output of ps auwwx in this comment.

I created a new FreeBSD 13.2 jail and installed from the FreeBSD repos (I have my own poudriere build server).

My config:

Code:
root@foo:/ # cat /usr/local/etc/snmpd.conf
syslocation     here
syscontact      dan@langille.org

rocommunity     public
root@foo:/ #

First attempt:

Code:
root@foo:/ # /usr/local/sbin/snmpd -f -Lo -Dhost
registered debug token host, 1
mibII/mta_sendmail.c:open_sendmailst: could not guess version of statistics file "/var/log/sendmail.st"
Warning: no access control information configured.
  (Config search path: /usr/local/etc/snmp:/usr/local/share/snmp:/usr/local/lib/snmp:/root/.snmp)
  It's unlikely this agent can serve any useful purpose in this state.
  Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for this agent.
Created directory: /var/net-snmp
NET-SNMP version 5.9.1
^CReceived TERM or STOP signal...  shutting down...

Oh, OK, let's give it an example.

Code:
root@foo:/ # ls -l /usr/local/share/snmp/snmpd.conf
ls: /usr/local/share/snmp/snmpd.conf: No such file or directory
root@foo:/ # cp /usr/local/share/snmp/snmpd.conf.example  /usr/local/share/snmp/snmpd.conf
root@foo:/ # /usr/local/sbin/snmpd -f -Lo -Dhost
registered debug token host, 1
mibII/mta_sendmail.c:open_sendmailst: could not guess version of statistics file "/var/log/sendmail.st"
Turning on AgentX master support.
NET-SNMP version 5.9.1

Better.

Code:
root@foo:/ # sockstat -4
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS     
root     snmpd      48651 7  udp4   10.55.0.22:161        *:*
root     snmpd      48651 8  tcp4   10.55.0.22:199        *:*
root     sendmail   48431 5  tcp4   10.55.0.22:25         *:*
root     syslogd    48393 5  udp4   10.55.0.22:514        *:*
root@foo:/ # snmpwalk -v2c -c public 10.55.0.22 hrMemorySize.0
Timeout: No Response from 10.55.0.22
root@foo:/ # snmpwalk -v2c -c public 10.55.0.22 hrMemorySize.0
HOST-RESOURCES-MIB::hrMemorySize.0 = No more variables left in this MIB View (It is past the end of the MIB tree)
root@foo:/ # snmpwalk -v2c -c public 10.55.0.22 hrMemorySize
HOST-RESOURCES-MIB::hrMemorySize = No more variables left in this MIB View (It is past the end of the MIB tree)
root@foo:/ #

Rather interesting.

Let's try specifying the configuration file:

Code:
root@foo:/ # /usr/local/sbin/snmpd -f -Lo -Dhost -c /usr/local/etc/snmpd.conf
registered debug token host, 1
mibII/mta_sendmail.c:open_sendmailst: could not guess version of statistics file "/var/log/sendmail.st"
Turning on AgentX master support.
NET-SNMP version 5.9.1

Which gives:

Code:
root@foo:/ # snmpwalk -v2c -c public 10.55.0.22 hrMemorySize
HOST-RESOURCES-MIB::hrMemorySize = No more variables left in this MIB View (It is past the end of the MIB tree)

OK, let's try with -C as well (ignore other configuration files):

Code:
root@foo:/ # /usr/local/sbin/snmpd -f -Lo -Dhost -c /usr/local/etc/snmpd.conf -C
registered debug token host, 1
mibII/mta_sendmail.c:open_sendmailst: could not guess version of statistics file "/var/log/sendmail.st"
NET-SNMP version 5.9.1


And here we go:

Code:
root@foo:/ # snmpwalk -v2c -c public 10.55.0.22 hrMemorySize
HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 469611808 KBytes


Which gave this debug output:
Code:
host/hr_storage: var_hrstoreEntry: request HOST-RESOURCES-MIB::hrMemorySize.0 exact=0
host/hr_storage: var_hrstoreEntry: compare HOST-RESOURCES-MIB::hrStorageIndex => -1
host/hr_storage: var_hrstoreEntry: process HOST-RESOURCES-MIB::hrStorageIndex.1 (0x82feeba00)
 
Coming back to this after starting a new post.


So far, it seems that using -C enables the hrMemorySize object.

Why?

I've tried adding -C to snmpd_flags in /etc/rc.conf and restarting snmpd. However, I'm using -v3 in my configuration, and that seems to break that.
 
NOTE: I've moved my testing jail foo from 10.55.0.22 to 10.55.0.57

Moving on from v2c to v3, I did this:

* create the user:

Code:
[22:30 foo root /] # net-snmp-config --create-snmpv3-user -ro -x AES -a SHA -A foobarfoo -X barfoobar roDVL
adding the following line to /var/net-snmp/snmpd.conf:
   createUser roDVL SHA "foobarfoo" AES "barfoobar"
adding the following line to /share/snmp/snmpd.conf:
   rouser roDVL

* start snmpd:

Code:
[22:36 foo root /] # /usr/local/sbin/snmpd -f -Lo -Dhost -c /usr/local/etc/snmpd.conf -a -r
registered debug token host, 1
mibII/mta_sendmail.c:open_sendmailst: could not guess version of statistics file "/var/log/sendmail.st"
Turning on AgentX master support.
NET-SNMP version 5.9.1
Received SNMP packet(s) from callback: 1 on fd 5

* test from LibreNMS host:

Code:
[22:32 besser dan ~] % snmpwalk -v3 -l authPriv -u roDVL -x AES -a SHA -A foobarfoo -X barfoobar 10.55.0.57 hrMemorySize
HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 469625116 KBytes

* output seen on client:

Code:
Received SNMP packet(s) from UDP: [10.55.0.27]:27608->[0.0.0.0]:0
host/hr_storage: var_hrstoreEntry: request HOST-RESOURCES-MIB::hrMemorySize.0 exact=0
host/hr_storage: var_hrstoreEntry: compare HOST-RESOURCES-MIB::hrStorageIndex => -1
host/hr_storage: var_hrstoreEntry: process HOST-RESOURCES-MIB::hrStorageIndex.1 (0x186dcf8c9640)
 
Now I'm getting graphs for memory.

Screen Shot 2023-12-27 at 6.03.43 PM.png


As well as CPU (which was working before this).

Screen Shot 2023-12-27 at 6.03.30 PM.png


Thank you for coming to my TED talk.
 
Current problem to solve: why are hrMemorySize and hrStorageTable not present on some hosts. What misconfiguration is causing that?
 
The jail packages were installed from the FreeBSD repo.

The host packages were installed from a repo on my personal poudriere server.

When net-snmpd from my repo is installed in the jail, it breaks:

Code:
[14:08 besser dan ~] % snmpwalk -v3 -l authPriv -u roDVL -x AES -a SHA -A foobarfoo -X barfoobar 10.55.0.57 hrMemorySize
HOST-RESOURCES-MIB::hrMemorySize = No Such Object available on this agent at this OID

I decided to try that test after I noticed the build-time configuration options between the package in the jail and the package in the host. Specifically, these options (as found in the jail) differ:

Code:
JAIL           : off
SMUX           : on

I'm going to build a new repo (via poudriere) specifically for this jail
 
Looking at the Makefile, it is clear why this happens:
Code:
.if ${PORT_OPTIONS:MJAIL}
NET_SNMP_WITHOUT_MIB_MODULE_LIST+=      host
NET_SNMP_WITHOUT_MIB_MODULE_LIST+=      ucd-snmp/memory
CONFIGURE_ARGS+=                        --without-kmem-usage
.endif

Given I want some hosts with that and some hosts (ie. jails) without that, I think this is a good case for flavors.
 
My patch for building @jail is attached.
 

Attachments

  • patch-net-snmp-jail-flavor.txt
    734 bytes · Views: 40
Back
Top