Managing ESXi SNMP Agents with vicfg-snmp
Simple Network Management Protocol (SNMP) allows management programs to monitor and control networked devices. vCenter Server and ESXi systems include different SNMP agents.
vCenter Server SNMP agent. The SNMP agent included with vCenter Server can send traps when the vCenter Server system is started or when an alarm is triggered on vCenter Server. The vCenter Server SNMP agent functions only as a trap emitter and does not support other SNMP operations (for example, GET).
You can manage the vCenter Server agent with the vSphere Client, but not with the vCLI command.
Host-based embedded SNMP agent. ESXi 4.0 and later includes an SNMP agent embedded in the host daemon (hostd) that can send traps and receive polling requests such as GET requests.
You can manage SNMP on ESXi hosts with the vicfg-snmp vCLI command, but not with the vSphere Client or with the ESXCLI command.
Net-SNMP-based agent. Versions of ESX released before ESX/ESXi 4.0 include a Net-SNMP-based agent. You can continue to use this Net-SNMP-based agent in ESX 4.x with MIBs supplied by your hardware vendor and other third-party management applications. However, to use the VMware MIB files, you must use the host-based embedded SNMP agent.
To use the NET-SNMP based agent and host-based embedded SNMP agent at the same time, make one of the agents listen on a nondefault port. By default, both agents use the same port.
The host-based embedded SNMP agent is disabled by default. Configuring and enabling the agent requires that you perform the following tasks:
1
2
Configuring SNMP Communities
Before you enable the ESXi embedded SNMP agent, you must configure at least one community for the agent.
An SNMP community defines a group of devices and management systems. Only devices and management systems that are members of the same community can exchange SNMP messages. A device or management system can be a member of multiple communities.
To configure SNMP communities, run vicfg-snmp -c, specifying a comma-separated list of communities. For example:
vicfg-snmp <conn_options> -c public, internal
Each time you specify a community with this command, the settings that you specify overwrite the previous configuration.
Configuring the SNMP Agent to Send Traps
You can use the SNMP agent embedded in ESXi to send virtual machine and environmental traps to management systems. To configure the agent to send traps, you must specify a target (receiver) address, the community, and an optional port. If you do not specify a port, the SNMP agent sends traps to UDP port 162 on the target management system by default.
To configure a trap destination
1
vicfg-snmp <conn_options> --show
 
Current SNMP agent settings:
Enabled: 1
UDP port: 161
Communities: public
Notification targets:
2
Run vicfg-snmp --target with the target address, port number, and community.
vicfg-snmp <conn_options> -t target.example.com@163/public
Each time you specify a target with this command, the settings you specify overwrite all previously specified settings. To specify multiple targets, separate them with a comma.
You can change the port that the SNMP agent sends data to on the target using the --targets option. That port is UDP 162 by default.
3
vicfg-snmp <conn_options> --enable
4
vicfg-snmp <conn_options> --test
The agent sends a warmStart trap to the configured target.
Configuring the SNMP Agent for Polling
If you configure the ESXi embedded SNMP agent for polling, it can listen for and respond to requests such as GET requests from SNMP management client systems.
By default, the embedded SNMP agent listens on UDP port 161 for polling requests from management systems. You can use the vicfg-snmp command to configure an alternative port. To avoid conflicts with other services, use a UDP port that is not defined in /etc/services.
To configure the SNMP agent for polling
1
Run vicfg-snmp --target with the target address, port number, and community.
vicfg-snmp <conn_options> -c public -t target.example.com@163/public
Each time you specify a target with this command, the settings you specify overwrite all previously specified settings. To specify multiple targets, separate them with a comma.
You can change the port that the SNMP agent sends data to on the target by using the --targets option. That port is UDP 162 by default.
2
vicfg-snmp <conn_options> -p <port>
3
vicfg-snmp <conn_options> --enable
4
Run vicfg-snmp - -test to validate the configuration.
The following example shows how the commands are run in sequence.
vicfg-snmp <conn_options> –c public –t example.com@162/private - -enable
# next validate your config by doing these things:
vicfg-snmp <conn_options> -–test
walk –v1 –c public esx-host