Configuring SNMP on vSphere ESX 4.0 and Up

Since SNMP is embedded in the hostd on ESX 4.0 and up, configuration is somewhat different.  We had several hosts that were already configured but ran into some issues when we added a new ESX host to our Data Center.  The below commands are what we ultimately used (along with how we fixed the error).

First – Open ESX Firewall
esxcfg-firewall -e snmpd

Next start configuring SNMP.  Per the vSphere Admin Guides, these commands can be combined, but I broke them out for testing purposes. –server <server>–username <user> –password <pass> -p <port>
<server> – your ESX Server
<user> – a user with root access on your server (probably root in most cases)
<pass> – password for the user you supplied
<port> – if you are running a default SNMP install, this will be 161.  Some documentation will have you change this to other ports, make sure you open those ports on your firewall. –server <server>–username <user> –password <pass> -c <community>
<community> – your SNMP community string –server <server>–username <user> –password <pass> –enable
This turns on SNMP.  You should now be able to walk or model your host. –server <server>–username <user> –password <pass> -t <monitorserver>@<monitorport>/<community>
<monitorserver> – the server you send traps to.  This can be an IP or a host name.
<monitorport> – the port your monitor server listens for traps on. The default is usually 162.
<community> – this is the community string that your monitor server is configured to accept traps from.  It may not be the same as your normal community string.

If on any of the commands you get the error:

Failed : A general system error occurred: Load persistant store failed

This probably means your /etc/vmware/snmp.xml is corrupt or has a bad tag.  To fix this, do the following:

Rename /etc/vmware/snmp.xml to snmp.xml.old (or some other unique name)
mv snmp.xml snmp.xml.old

Now create a new snmp.xml
vi /etc/vmware/snmp.xml

Paste the following into the file.


Be sure that you don’t have any extra line breaks or white spaces before or after the text.

Save the file.

Restart VMware Management
service mgmt-vmware restart

After the service restarts, wait about 5 minutes for everything to come back online and run the commands again.

Posted in System Administration, VMware | Tagged , , | 1 Comment