Enable and Configure SNMP on VMWare ESXi Host

If you want to monitor the state of your VMWare ESXi servers in your monitoring system, you must configure SNMP agent on your hosts. In this article we’ll show how to enable and configure SNMP in VMWare ESXi 6.7 (the guide is applicable for ESXi 5.5 and newer).

In ESXi, there is a built-in SNMP agent that can send and receive SNMP requests and traps. You can enable and configure an SNMP agent on ESXi hosts in several ways: using vCLI, PowerCLI (but not through the vSphere client GUI).

Enable SSH access on the ESXi host and connect to it using any ssh client To check the current SNMP settings, run this command:

esxcli system snmp get

SNMP is not configured: all parameters are empty, and the agent is disabled.

Configuring SNMP Agent Parameters in ESXi

Specify the monitoring server IP address (SNMP target), port (by default, 161 UDP) and SNMP community name (usually, public):

esxcli system snmp set --targets=192.168.99.99@161/public

Or you can set the community name as follows:

esxcli system snmp set --communities YOUR_COMMUNITY_STRING

Additionally, you can specify the location:

esxcli system snmp set --syslocation "Allee 16, Mun, DE"

Contact information:

esxcli system snmp set --syscontact [email protected]

Then enable SNMP service on the ESXi host:

esxcli system snmp set --enable true

To test the SNMP configuration:

esxcli system snmp test

To apply the settings, restart the SNMP agent using this command:

/etc/init.d/snmpd restart

To reset current settings, use the following command:

esxcli system snmp set –r

To disable SNMP:

esxcli system snmp set --disable true

VMWare ESXi SNMPv3 Configuration

We have discussed how to enable and configure an SNMP agent v1 and v2 on ESXi hosts above. Starting from ESXi 5.1, a more modern protocol version is used: SNMP v3. Use the following commands to configure more secure SNMPv3.

Set authentication and encryption protocols:

esxcli system snmp set -a MD5 -x AES128

Generate hashes for the authentication and encryption passwords (replace authpass and privhash with your password):

esxcli system snmp hash --auth-hash authpass --priv-hash privhash --raw-secret

Using the hashes (authhash and privhash), add a user:

esxcli system snmp set -e yes -C [email protected] -u snmpuser/authhash/privhash/priv

Then specify the SNMP target address:

esxcli system snmp set –v3targets 192.168.99.99@161/user/priv/trap

Leave a Reply

Your email address will not be published. Required fields are marked *