SSH to host (SSH should be enabled)

Set SNMP community string

esxcli system snmp set -r

esxcli system snmp set –communities YOUR_COMMUNITY_STRING

Enable SNMP Service

esxcli system snmp set –enable true

Firewall Rules

esxcli network firewall ruleset set –ruleset-id snmp –allowed-all false
esxcli network firewall ruleset allowedip add –ruleset-id snmp –ip-address 192.168.0.0/24
esxcli network firewall ruleset set –ruleset-id snmp –enabled true

 

Restart Service

/etc/init.d/snmpd restart

or from ESXi – Vsphere GUI

Σε εκδόσεις ESXi 6.x

esxcli system snmp set -r
esxcli system snmp set -c YOUR_STRING
esxcli system snmp set -p 161
esxcli system snmp set -L “City, State, Country”
esxcli system snmp set -C noc@example.com
esxcli system snmp set -e yes

Σε εκδόσεις ESXi 5.5

esxcli system snmp set –communities YOUR_STRING
esxcli system snmp set –enable true
esxcli network firewall ruleset set –ruleset-id snmp –allowed-all true
esxcli network firewall ruleset set –ruleset-id snmp –enabled true
/etc/init.d/snmpd restart

Σε εκδόσεις ESXi 5.0

vicfg-snmp.pl –server hostname –username your_username –password your_password -c YOUR_STRING
vicfg-snmp.pl –server hostname –username your_username –password your_password -p 161
vicfg-snmp.pl –server hostname –username your_username –password your_password –enable