Enable SNMP on vSphere ESXi 4.1

In the vSphere client you have a option to monitor your hardware status. This is of course  a very nice feature but only if you have your vSphere client open the whole day. When you have a management server like Nagios you want to use SNMP for monitoring your vSphere enviroment.

By default SNMP modules are provided by the installation but there not enabled. You can enable SNMP by doing the following steps:

  1. Configure the community string, target and port
    vicfg-snmp –server [ip of vSphere host] -c [community string] -p [port, default 161] -t [destinationhost]@[port, default 161]/[community string] example: vicfg-snmp –server 192.168.1.1 -c public -p 161 -t 192.168.1.10@161/public
  2. Enable SNMP
    vicfg-snmp –server [ip of vSphere host] -E
    example: vicfg-snmp –server 192.168.1.1 -E
  3. Verify your settings
    vicfg-snmp –server [ip of vSphere host] -s
    example: vicfg-snmp –server 192.168.1.1 -s
  4. Test your settings
    vicfg-snmp –server [ip of vSphere host] -T
    example: vicfg-snmp –server 192.158.1.1 -T

Al off these setting are written in /etc/vmware/snmp.xml. Below is a example file.

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

If you want to provide these setting during your kickstart install put the following line into your ks.cfg file.

echo “<config><snmpSettings><enable>true</enable><communities>public</communities><port>161</port><targets>192.168.1.10@161/public</targets></snmpSettings></config>” > /etc/vmware/snmp.xml

Make sure you have a reboot at the end of the script or put a services.sh restart command in your ks.cfg file

If your are looking for the ESXi SNMP mib file, look here.

About Michael
Michael Wilmsen is a VMware training/consultant (no specific order) with more than 15 years in the IT industry. Main focus is VMware vSphere, Horizon View and Site Recovery Manager with a deepdive to performance. Michael is VCDX 210, VCAP 4/5 certified, has been rewarded with the vExpert title from 2011, is a PernixPro, Nutanix Tech Champion and a Nutanix Platform Professional.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

You must be logged in to post a comment.