Wednesday, 22 September 2010

Configuring SNMP on ESXi 4.1 via the vSphere CLI 4.1

1) Download the vSphere CLI 4.1 and install

2) From the VMware vSphere CLI command line, type:

vicfg-snmp.pl --server ESXIHOSTIP -c COMMUNITYNAME -p 161 -t DESTINATIONHOSTIP@161/COMMUNITYNAME

Example with output:

C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-snmp.pl --server 172.16.4.101 -c anSNMPnm -p 161 -t 172.23.117.72@161/public


Enter username: root
Enter password:


Changing udp port to 161...
Complete.
Changing community list to: anSNMPnm...
Complete.
Changing notification(trap) targets list to: 172.23.117.72@161/public...
Complete.

3) Enable from the command line type:

vicfg-snmp.pl –server ESXIHOSTIP -E

Example with output:

C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-snmp.pl --server 172.16.4.101 -E


Enter username: root
Enter password:


Enabling agent...
Complete.

4) Verify your settings, type:

vicfg-snmp.pl –server ESXIHOSTIP -s

Example with output:

C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-snmp.pl --server 172.16.4.101 -s


Enter username: root
Enter password:


Current SNMP agent settings:
Enabled : 1
UDP port : 161
Communities :
anSNMPnm
Notification targets :
172.23.117.72@161/public

5) Test your settings, type:

vicfg-snmp.pl –server ESXIHOSTIP -T

Example with output:

C:\Program Files (x86)\VMware\VMware vSphere CLI\bin>vicfg-snmp.pl --server 172.16.4.101 -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.

Note: These settings are written to /etc/vmware/snmp.xml


Update - March 2011

Related post on how to monitor ESXi host hardware with HPSIM (this does not need SNMP enabled):
http://cosonok.blogspot.com/2011/03/monitoring-hp-vmware-esxi-hosts-with-hp.html

1 comment:

  1. Thanks for the clean and simple blog post. Got the job done.

    ReplyDelete