1.Navigate to the directory where vicfg-snmp.pl is stored. By default, vicfg-snmp.pl is located in:
C:\Program Files\VMware\VMware vSphere CLI\bin
2.Run this command: Cd C:\Program Files\VMware\VMware vSphere CLI\bin\
vicfg-snmp.pl --server hostname --username username --password password --show
Note: Run the vicfg-snmp.pl --help command for a full list of options.
3.Specify the communities and trap targets with this command:
vicfg-snmp.pl --server hostname --username username --password password -t hostname@port -c community
Note: In ESX 3.5, you may need to use vicfg-snmp.pl --server hostname --username username --password password -t hostname@port/community.
Example: To send SNMP traps from the host host.example.com to port 162 on target.example.com, using the public community, use this command:
vicfg-snmp.pl --server host.example.com --username root --password password -t target.example.com@162 -c public
For ESXi 5.0:
vicfg-snmp.pl --server host.example.com --username root --password password -t target.example.com@162/community
Note: To prevent clear text display of the user password, remove the --password password portion. You are then prompted to enter the password, and the entry is hidden.
4.To enable the SNMP service, run this command:
vicfg-snmp.pl --server hostname --username username --password password --enable
Note: To verify SNMP settings, run this command:
vicfg-snmp.pl --server hostname --username username --password password --show
5.(Optional) To send a test trap to verify that the agent is configured correctly, run this command:
vicfg-snmp.pl --server hostname --username username --password password --test
The test trap generated is a warmStart trap.