Configuration of net-mgmt/net-snmp on FreeBSD

I have several posts about net-mgmt/net-snmp – this is the latest. I wrote it back in June and it’s been sitting in drafts ever since.

If you read the previous post, you’ll understand why I wrote a new one.

In this post:

  • FreeBSD 14.1
  • net-snmp-5.9.4_6,1

This is the configuration I start with.

[dvl@r720-02-nginx01:~] $ cat /usr/local/etc/snmpd.conf
agentAddress  udp:127.163.0.80:161,tcp:127.163.0.80:161

sysLocation    BSD Cabal HQ
sysContact     dan@langille.org

extend nginx            /usr/local/etc/snmp/nginx-python3.py
extend phpfpmsp         /usr/local/etc/snmp/phpfpm-sp

When adding auth, always stop the daemon first:

[r720-02-nginx01:~] % sudo service snmpd stop                
Stopping snmpd.
Waiting for PIDS: 15487.

I use these variables to make it easier.

[dvl@r720-02-nginx01:~] $ export AUTHPASS='foofoofoo'
[dvl@r720-02-nginx01:~] $ export PRIVPASS='barbarbar'

This creates the necessary information. The output is informational only; no additional action is required.

[dvl@r720-02-nginx01:~] $ sudo net-snmp-config --create-snmpv3-user -ro -x AES -a SHA -A $AUTHPASS \
                          -X $PRIVPASS roDVL
adding the following line to /var/net-snmp/snmpd.conf:
   createUser roDVL SHA "foofoofoo" AES "barbarbar"
adding the following line to /usr/local/share/snmp/snmpd.conf:
   rouser roDVL

Start it back up:

[12:11 samdrucker dvl ~] % sudo service snmpd start                                                                          
Starting snmpd.
[12:11 samdrucker dvl ~] % 

Test:

[12:10 besser dvl ~] % snmpwalk -v3 -l authPriv -u roDVL -a SHA -A $AUTHPASS -x AES -X $PRIVPASS \
                       127.163.0.80 HOST-RESOURCES-MIB::hrSystemNumUsers
HOST-RESOURCES-MIB::hrSystemNumUsers.0 = Gauge32: 1

Done! Thank you for coming to my TED talk.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top