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.

Given Services are not enabled on the port group

When trying to apply a host profile to a vSphere host you can receive a error:

Given Services are not enabled on the port group

After some investigation and googling around I found this kb articel on vmware.com.
This KB articile discribes that the error only occurs when you have 2 vmk’s on a single portgroup (in my case one form management and one for vMotion) on a Distributed Switch.
The solution is to use seperate distributed portgroups voor de vmk’s or disable compliance check for these vmk’s.

In order to disable compliance check:

  1. Edit the profile of the services and navigate to Host virtual NIC folder > profile > Services for the virtual NIC policy, where is in the format : : .
  2. In the right pane, go to Compliance details and deselect the checkbox which lists the validation rule.
  3. Click OK to save the profile.
  4. Repeat this procedure for each service profile