Enable SNMP on ESX

Has to be done from the cli, config is stored in here:

/etc/vmware/snmp.xml file

esxcli system snmp get                              See the current config

1. By default the service is stopped, can start in GUI or CLI
/etc/init.d/snmpd start

2. Set the parameters.
esxcli system snmp set –communities [community]
esxcli system snmp set –enable true
esxcli system snmp set -t x.x.x.x@162/[community]

3. Allow through the firewall if is enabled.
esxcli network firewall ruleset set –ruleset-id snmp –allowed-all true
esxcli network firewall ruleset set –ruleset-id snmp –enabled true

Alternatively you can change the fw rule to only allow a specific subnet or host for SNMP
esxcli network firewall ruleset set –ruleset-id snmp –allowed-all false
esxcli network firewall ruleset allowedip add –ruleset-id snmp –ip-address [ip/mask]
esxcli network firewall ruleset set –ruleset-id snmp –enabled true

4. Restart the service for the changes to take effect. Once you do this it will disable snmp so need to enable again
/etc/init.d/snmpd restart
esxcli system snmp set –enable true

Test

-Test the config and tun TCPdump on ESX host
esxcli system snmp test
esxcli network ip connection                                See a list of interfaces
tcpdump-uw -i vmk0 port 161

-Run snmpwalk and tcpdump on the SNMP server
snmpwalk -c [community] -v 2c 1x.x.x.c
tcpdump -i any port 161

Leave a comment