You can use ESXCLI to configure the SNMP agent for polling.
Specify one of the options listed in Connection Options for vCLI Host Management Commands in place of <conn_options>
.
Procedure
- 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.
- (Optional) Specify a port for listening for polling requests.
vicfg-snmp <conn_options> -p <port>
- (Optional) If the SNMP agent is not enabled, enable it.
vicfg-snmp <conn_options> --enable
- Run
vicfg-snmp --test
to validate the configuration.
vicfg-snmp <conn_options> --test
Example: Running Commands in Sequence
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