发现VMware vSphere CLI的功能实在强大,学习中。。。
To configure the communities do the following:
vicfg-snmp.pl –server <hostname> –username <username> –password <password> -c <com1>.
Replace <com1> with the community name you wish to set. Each time you specify a community with this
command, the setings you specify overwrite the previous configuration. To specify multiple communities,
separate the community names with a comma.
For example, to set the communities public and internal on the host host.example.com, you might type
vicfg-snmp.pl –server host.example.com –username user –password password -c public,
internal.
vicfg-snmp.pl –server <hostname> –username <username> –password <password> -c <com1>.
Replace <com1> with the community name you wish to set. Each time you specify a community with this
command, the setings you specify overwrite the previous configuration. To specify multiple communities,
separate the community names with a comma.
For example, to set the communities public and internal on the host host.example.com, you might type
vicfg-snmp.pl –server host.example.com –username user –password password -c public, internal.
To configure the SNMP agent traps do:
vicfg-snmp.pl –server <hostname> –username <username> –password <password> -t <target
address>@<port>/<community>.
Replace <target address>, <port>, and <community> with the address of the target system, the port number
to send the traps to, and the community name, respectively. 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.
For example, to send SNMP traps from the host host.example.com to port 162 on target.example.com using
the public community, type
vicfg-snmp.pl –server host.example.com –username user –password password -t
target.example.com@162/public.
Enable the SNMP agent by typing
vicfg-snmp.pl –server <hostname> –username <username> –password <password> –enable.
Send a test trap to verify that the agent is configured correctly by typing
vicfg-snmp.pl –server <hostname> –username <username> –password <password> –test.
The agent sends a warmStart trap to the configured target.
To configure the SNMP agent for polling do:
vicfg-snmp.pl –server <hostname> –username <username> –password <password> -p <port>.
Replace <port> with the port for the embedded SNMP agent to use for listening for polling requests.
If the SNMP agent is not enabled, enable it by typing
vicfg-snmp.pl –server <hostname> –username <username> –password <password> –enable.
And there you have it SNMP on ESX4i.
本人执行以上命令后,结果如下:
Enabled : 1
UDP port : 161
Communities :
public
Notification targets :
192.168.9.3@162/public