2011
Nov 19

Net-SNMP v5.7 Issues

The last time I upgraded Net-SNMP it wasn’t reporting the hrSystemProcesses OID. I wrote about that here. This time around I’ve upgraded to v5.7 and discovered two issues so far.

I was able to reproduce both of these issues on OpenBSD/i386 5.0.

UPDATE 2011-11-29: Net-SNMP 5.7.1 + fixes has been pushed to the OpenBSD 5.0-stable ports collection as well as -current ports. OpenBSD users should sync their ports tree and rebuild ports/net/net-snmp to alleviate the issues below.

#1 – Values returned by hrStorageUsed are incorrect

The first is with respect to the values returned via hrStorageUsed in the HOST-RESOURCES-MIB. The numbers are way off. For example, prior to the upgrade a disk that reported hrStorageUsed of 1873784 units (3.8GB) now reports 23920757 units (49GB). The Net-SNMP git repo shows there’s been some changes since v5.6.1 in the code that gathers disk stats. Looks like a bug was introduced somewhere.

Solution: Use Net-SNMP v5.7.1. The hrStorageUsed values in v5.7.1 are consistent with the values returned from v5.6.x. OpenBSD users, the net/net-snmp port in CVS HEAD is already updated to 5.7.1. Sync up and go.

#2 – Segfault when querying hrStorageTable

The second issue is a segfault in snmpd when querying the hrStorageTable. The segfault is happening on the memcpy() call(s) in netsnmp_fsys_arch_load(). The segfault is inconsistent. Sometimes you can get a handful of good queries and responses before it happens. Other times it happens on the first query. I don’t know why the segfault is happening, but I know that replacing memcpy() with strncpy() eliminates it. This is pretty hackish but I’m not skilled enough to debug this any further.

Solution: Apply the patch here. On OpenBSD you should be able to save the patch into ports/net/net-snmp/patches/ and rebuild the port. You will need this on Net-SNMP v5.7 and 5.7.1.

Am I the only one?

Are other Net-SNMP users seeing these issues? Does anyone even use Net-SNMP anymore (particularly on OpenBSD)? Please leave a comment and let me know.

I’m crossing my fingers that I won’t have to write another patch file the next time I upgrade Net-SNMP.

7 Comments

  1. By Foxy on November 23, 2011 at 4:17am MST |

    I confirm these bugs on OpenBSD 5.0/i386 with net-snmp-5.7p1 package (SNMP monitoring for my OpenBSD firewall @home) :(

    I will test Net-SNMP v5.7.1 and apply patch/recompile package ASAP. Thanks for analyze and debug of these issues.

    • By Joel Knight on November 23, 2011 at 7:19am MST |

      Thanks for commenting. Please follow up with the results of your testing.

  2. By Foxy on November 27, 2011 at 4:13am MST |

    i recompiled net-snmp v.5.7.1 package on OpenBSD 5.0/i386 and apply patch for hrStorageTable.

    The both issues described are fixed :)

    fox@embryo:~$ snmpwalk -v2c -c public 172.16.2.50 hrStorage
    HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 261628 KBytes
    HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1
    HOST-RESOURCES-MIB::hrStorageIndex.2 = INTEGER: 2
    HOST-RESOURCES-MIB::hrStorageIndex.10 = INTEGER: 10
    HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31
    HOST-RESOURCES-MIB::hrStorageIndex.32 = INTEGER: 32
    HOST-RESOURCES-MIB::hrStorageIndex.33 = INTEGER: 33
    HOST-RESOURCES-MIB::hrStorageIndex.34 = INTEGER: 34
    HOST-RESOURCES-MIB::hrStorageIndex.35 = INTEGER: 35
    HOST-RESOURCES-MIB::hrStorageType.1 = OID: HOST-RESOURCES-TYPES::hrStorageRam
    HOST-RESOURCES-MIB::hrStorageType.2 = OID: HOST-RESOURCES-TYPES::hrStorageRam
    HOST-RESOURCES-MIB::hrStorageType.10 = OID: HOST-RESOURCES-TYPES::hrStorageVirtualMemory
    HOST-RESOURCES-MIB::hrStorageType.31 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
    HOST-RESOURCES-MIB::hrStorageType.32 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
    HOST-RESOURCES-MIB::hrStorageType.33 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
    HOST-RESOURCES-MIB::hrStorageType.34 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
    HOST-RESOURCES-MIB::hrStorageType.35 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
    HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory
    HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: Real memory
    HOST-RESOURCES-MIB::hrStorageDescr.10 = STRING: Swap space
    HOST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /
    HOST-RESOURCES-MIB::hrStorageDescr.32 = STRING: /home
    HOST-RESOURCES-MIB::hrStorageDescr.33 = STRING: /tmp
    HOST-RESOURCES-MIB::hrStorageDescr.34 = STRING: /usr
    HOST-RESOURCES-MIB::hrStorageDescr.35 = STRING: /var
    HOST-RESOURCES-MIB::hrStorageAllocationUnits.1 = INTEGER: 4096 Bytes
    HOST-RESOURCES-MIB::hrStorageAllocationUnits.2 = INTEGER: 4096 Bytes
    HOST-RESOURCES-MIB::hrStorageAllocationUnits.10 = INTEGER: 4096 Bytes
    HOST-RESOURCES-MIB::hrStorageAllocationUnits.31 = INTEGER: 2048 Bytes
    HOST-RESOURCES-MIB::hrStorageAllocationUnits.32 = INTEGER: 2048 Bytes
    HOST-RESOURCES-MIB::hrStorageAllocationUnits.33 = INTEGER: 2048 Bytes
    HOST-RESOURCES-MIB::hrStorageAllocationUnits.34 = INTEGER: 2048 Bytes
    HOST-RESOURCES-MIB::hrStorageAllocationUnits.35 = INTEGER: 2048 Bytes
    HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 65407
    HOST-RESOURCES-MIB::hrStorageSize.2 = INTEGER: 65406
    HOST-RESOURCES-MIB::hrStorageSize.10 = INTEGER: 132535
    HOST-RESOURCES-MIB::hrStorageSize.31 = INTEGER: 252919
    HOST-RESOURCES-MIB::hrStorageSize.32 = INTEGER: 1564183
    HOST-RESOURCES-MIB::hrStorageSize.33 = INTEGER: 251943
    HOST-RESOURCES-MIB::hrStorageSize.34 = INTEGER: 1544103
    HOST-RESOURCES-MIB::hrStorageSize.35 = INTEGER: 248983
    (…)

    => no segfault !

    My firewall SNMP monitoring is functionnal now with the updated Net-SNMP daemon.

    Thanks for your work.

  3. By samt on January 4, 2012 at 5:47pm MST |

    Just getting into snmp on OpenBSD and appreciate your continuing documentation work.

    Thanks

    • By Joel Knight on January 4, 2012 at 8:52pm MST |

      You are welcome!

  4. By insan on February 7, 2012 at 3:22pm MST |

    Hi Joel,
    Do you had any experience configuring OpenBSD snmpd.conf to get external data? I’m trying to get unbound statistic on a OpenBSD server, graphing it into cacti, and I’m trying to avoid installing net-snmp on my unbound server.

    Thanks.

    • By Joel Knight on February 7, 2012 at 5:21pm MST |

      Hi, I tried once to forward from snmpd to net-snmp but it didn’t work. I can’t remember any of the details but remember giving up and just running net-snmp directly. Sorry that’s not very helpful.