How to Enable SNMP on a Raspberry Pi (snmpd Setup)

Here’s how to enable SNMP on a Raspberry Pi so your monitoring system can poll it.

1. Install snmpd

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install snmpd -y
sudo apt-get install snmp -y

2. Edit snmpd.conf

To get it running, edit the configuration file:

sudo nano /etc/snmp/snmpd.conf

First, comment out this line so the agent doesn’t listen only on localhost:

#agentAddress  udp:127.0.0.1:161

Below the line #agentAddress udp:161,udp6:[::1]:161, add:

agentAddress udp:161

Then, below the line rocommunity public localhost, add a read-only community for your network (replace the subnet with your own):

rocommunity public 190.0.10.0/24

3. Restart the Service

sudo service snmpd restart

Related: enabling SNMP on VMware ESXi 6.5.

How to Enable SNMP on VMware ESXi 6.5 with esxcli

To enable SNMP on a VMware ESXi 6.5 host, connect to it with your favorite SSH client (I use PuTTY) and run the following commands:

esxcli system snmp set --communities public
esxcli system snmp set --enable true
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
/etc/init.d/snmpd restart

What each step does:

  • Sets the SNMP community string (replace public with your own).
  • Enables the SNMP agent.
  • Allows all IPs through the ESXi firewall’s SNMP ruleset, then enables that ruleset.
  • Restarts the SNMP service so the changes take effect.

If you copy these commands, make sure the options begin with two hyphens (--), not a single dash. Related: enabling SNMP on a Raspberry Pi.