Enabling SNMP in ESXi 4.1 using the Remote CLI

cdc63-6a00e551c39e1c88340168ea399c7e970c-pi

Based on the fact that ESX 4.1 is the last major release of ESX, I decided that I would make myself familiar with managing ESXi hosts.  Since I monitor all my hosts via Zenoss, I figured that I needed to get snmp up and running first.

So I first when out and installed the remote cli for ESX on my ubuntu desktop.  The rcli can be downloaded here. The remote cli allows you to run command administrative commands against ESX/ESXi systems. Its availbile for Windows or Linux.

Configuring on ESXi 4.1, Licensed

First configure your community string, target, and port:

vicfg-snmp –server <ESXi_ip> -c <communityname> -p 161 -t <destination_host>@161/<community name>

Then enable it using the command below:

vicfg-snmp –server <ESXi_ip> -E

Next verify your settings:

vicfg-snmp –server <ESXi_ip> -s

Now test your settings:

vicfg-snmp –server <ESXi_ip> -T

These settings are written out to /etc/vmware/snmp.xml. Sample file below.

/etc/vmware # cat snmp.xml
<config>
<snmpSettings>
<communities>pubic</communities>
<enable>true</enable>
<port>161</port>
<targets>10.1.xx.xx@161 public</targets>
</snmpSettings>

Configuring on ESXi 4.0, Free/Foundation

I had a couple of ESXi 4.0 free hosts to configure, but my attempts to configure them using the cli failed as the snmp settings via cli were read only. So the first thing that you need to do is enable the unsupported console. Instructions can be found here.

Once you are able to ssh to the ESXi box, you need to edit the following file by hand, /etc/vmware/snmp.xml. Use the sample file above as a template and modify your ip, port, and string as needed. I use vi to edit mine.

Then run the command below

services.sh restart

You can then verify your settings using the remote cli by running the command below against your esxi box.

vicfg-snmp –server <ESXi_ip> -T

6 thoughts on “Enabling SNMP in ESXi 4.1 using the Remote CLI

  1. Thats wierd. It worked for me. Published the post after I ran the commands on my box. I will be configuring a few boxes in the future and will see if I have any issues.

    Like

  2. Just tried it again and it worked
    vicfg-snmp –server server.named -T
    Enter username: root
    Enter password:
    Sending test nofication(trap) to all configured targets…
    Complete. Check with each target to see if trap was received.

    Like

  3. Regarding Restricted Version error received when trying to turn on the SNMP agent — that occurs on ESXi systems which are licensed using free edition — the SNMP agent is not supposed to be enabled. See: http://www.virtuallyghetto.com/2011/06/dreaded-faultrestrictedversionsummary.html
    VMware vSphere™ SNMP MIB Modules
    http://communities.vmware.com/community/developer/forums/managementapi
    Included is a file called VMWARE-AGENTCAP-MIB which details
    which mib modules are supported by what ESXi version. Polling sysORTable also reports the mib modules supported.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s