Esxi Snmp

From wiki karavi
Jump to navigation Jump to search

Run the command in the console (terminal) and check the SNMP status on the ESXi host:

esxcli system snmp get

SNMP is disabled by default. The output for disabled SNMP on ESXi is shown on the screenshot. Most of the parameters are empty and or not configured. Set SNMP parameters for an SNMP agent on the ESXi host. The SNMP agent is used to send notifications (SNMP traps and informs) to a monitoring server and receive GET, GETNEXT, and GETBULK requests.

Set the community name (“public” is the community name set by default). The community name in this example is “nakivo”.

esxcli system snmp set --communities ntk

Set the SNMP target. The SNMP target is a server on which monitoring software is installed to handle SNMP traps and collect monitoring information. In my example, the SNMP target is the machine running Ubuntu Linux (192.168.101.209). UDP 161 is the default port used for SNMP and this port is defined in my ESXi SNMP configuration:

esxcli system snmp set --targets=192.168.101.209@161/ntk

Specify a location, for example, the geographical location, address, datacenter, or a room where the server is located:

esxcli system snmp set --syslocation "Server room"

Specify contact information. The system administrator’s email address can be defined for this parameter:

esxcli system snmp set --syscontact michaelbose@nakivo.com

Enable SNMP on ESXi:

esxcli system snmp set --enable true

reset all config:

esxcli system snmp set --reset

Check the SNMP status on the ESXi host again:

esxcli system snmp get

Now you can see that the parameters are configured.


Test current SNMP configuration.

esxcli system snmp test



ESXi Firewall Configuration for SNMP Traffic There are two ways to allow SNMP traffic in the ESXi host firewall. You can allow SMNP requests to be received from any device on the network:

esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
esxcli network firewall ruleset set --ruleset-id snmp --enabled true

Or you can allow inbound traffic from an IP address of your monitoring server or an IP subnet where your SNMP targets are located:

esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 192.168.100.0/24
esxcli network firewall ruleset set --ruleset-id snmp --enabled true



Fast run

esxcli system snmp get
esxcli system snmp set --communities public
esxcli system snmp set --port 161
esxcli system snmp set --targets="zabbix.ntkhost.com@161/public"
esxcli system snmp set --enable true
esxcli system snmp get
esxcli system snmp test
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
esxcli network firewall ruleset set --ruleset-id snmp --enabled true