Enable and configure SNMP on VMware ESXi 5

Here we are, VMware ESXi 5 is installed on the Z68 motherboard. One of the first thing to do is enable SNMP to be able to actually get remote information on what happens to the beast :) Later on, we’ll be able to get pretty graphs to show how the virtual infrastructure lives.

Here’s how I did enable and configure SNMP on my ESXi. This is the free instance, without any vCenter.

First thing to do is install the VMware vSphere CLI ; I installed mine in some Windows virtual instance (VMware-vSphere-CLI-5.0.0-422456.exe). Once installed, start a VMware vSphere CLI and issue the following commands:

C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-snmp.pl --server esxi -c C0MMUN1TY Enter username: root Enter password: xxxx Changing community list to: C0MMUN1TY... Complete. C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-snmp.pl --server esxi --enable Enter username: root Enter password: xxxx Enabling agent... Complete. C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>

You may want to pass the credentials on the command line. I just forgot to do so :)

Now, the system can be queried from your LAN:

# snmpwalk -v 2c -c C0MMUN1TY esxi system SNMPv2-MIB::sysDescr.0 = STRING: VMware ESX 5.0.0 build-469512 VMware, Inc. x86_64 SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.6876.4.1 SNMPv2-MIB::sysUpTime.0 = Timeticks: (6874825) 19:05:48.25 SNMPv2-MIB::sysContact.0 = STRING: not set SNMPv2-MIB::sysName.0 = STRING: esxi.tumfatig.net SNMPv2-MIB::sysLocation.0 = STRING: not set SNMPv2-MIB::sysServices.0 = INTEGER: 72 SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00 (...)

But there is more! Try the following command:

# snmpwalk -v 2c -c C0MMUN1TY -On esxi . . = STRING: "running" . = STRING: "notRunning" . = STRING: "notRunning" . = STRING: "notRunning"

Now, grab the VMware vSphere SNMP MIB Modules (VMware-esx-mibs-1.0.1-368563.zip) and install it. Then run the following command:

# snmpwalk -v 2c -c C0MMUN1TY -M +. -m ALL esxi . VMWARE-VMINFO-MIB::vmwVmGuestState.1 = STRING: running VMWARE-VMINFO-MIB::vmwVmGuestState.2 = STRING: notRunning VMWARE-VMINFO-MIB::vmwVmGuestState.3 = STRING: notRunning VMWARE-VMINFO-MIB::vmwVmGuestState.4 = STRING: notRunning

Tada! This is quite simple. But there is more to get using the Perl SDK ; and maybe the vCenter… Got to figure this out… later on ;-)

BTW, it is also possible to enable SNMP from the ESXi shell. It just needs a bit of editing and services restart:

# vi /etc/vmware/snmp.xml <config><snmpSettings><enable>true</enable><communities>C0MMUN1TY</communities><targets></targets></snmpSettings></config> # services.sh restart

Author: Joel Carnat

@work Technical Architect and SysAdmin ; @home OpenBSD and FOSS, Karate, Kobudō, Jōdō, Bodyweight workout, Photography & Music

One thought on “Enable and configure SNMP on VMware ESXi 5”

Leave a Reply

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.