Enabling SNMP on a Raspberry Pi

snmpv2c rpi

For SNMPv3 installation, see post SNMPv3 on Raspberry.

The Simple Network Management Protocol or SNMP is used for monitoring the state, hardware, software of a device. SNMP is so simple to enable, yet provides tons of information about the device.

To enable SNMP on a Raspberry Pi or any Linux in general, the SNMP services need to be installed first.

To install SNMP

sudo apt install -y snmpd snmp

The SNMP configuration need to be modify and to do this the SNMP instance need to be stopped first.

sudo systemctl stop snmpd 

Edit the file /etc/snmp/snmpd.conf and change the following

# These three lines are the default
agentAddress  udp:127.0.0.1:161 
 rocommunity public  default    -V systemonly 
 rocommunity6 public  default   -V systemonly

# I changed to these lines
#agentAddress  udp:127.0.0.1:161 
agentAddress  udp:10.0.11.161:161 # this is the wlan0 interface's ip address
 rocommunity SuPerSecr3t  default    -V systemonly 
 #rocommunity6 public  default   -V systemonly

At this time, I don’t use IPv6, so I commented it out. I only enabled SNMP on the wlan0 interface on this Raspberry Pi.

To test the SNMP, snmpwalk needs to be run

snmpwalk -v 2c -c SuPerSecr3t 10.0.11.161

For SNMPv3 check out the next week post.

Cheers!

Subscribe
Notify of
guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Lee
Lee
4 years ago

Thank you!

E3fi1
3 years ago

Sehr geehrter Herr Ludwig, vielen Dank für diese Empfehlung

Gus
Gus
2 years ago

Forgot to mention restarting the service 🙂

sudo systemctl start snmpd
Zorg
Zorg
10 months ago

Thanks for this info.
Restarting the service fails for me because /etc/init.d/snmpd specifies user and group of Debian-snmp, but this user does not have perms for port 161 (i.e. < 1024). I can change the port to (say 1161) in /etc/snmp/snmpd.conf but that means changing lots of other apps (and some don’t allow a different port to be specified).
Any suggestions on what to do?

(Ubuntu 23:10)

4
0
Would love your thoughts, please comment.x
()
x