Enable SNMP on ESXi


https://www.vionblog.com/esxi-6-5-snmp-configuration/





enable SNMP
esxcli system snmp set --communities public
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

discover /32
discover any SNMP server manually
[librenms@localhost ~]$ /opt/librenms/snmp-scan.py -v -r 172.30.95.70/32
Scanning IPs:
Scanned 172.30.95.70 Added device 172.30.95.70 (39)

Scanned 1 IPs: 0 known devices, added 1 devices, failed to add 0 devices
Runtime: 3.15 seconds
[librenms@localhost ~]$ 

esxcli snmp get
[root@localhost:~] esxcli system snmp get
   Authentication:
   Communities: public
   Enable: true
   Engineid: 00000063000000a100000000
   Hwsrc: indications
   Largestorage: true
   Loglevel: info
   Notraps:
   Port: 161
   Privacy:
   Remoteusers:
   Syscontact:
   Syslocation:
   Targets:
   Users:
   V3targets:
[root@localhost:~]


set ESXi hostname
[root@localhost:~] esxcli system hostname set -H esxi9271
[root@esxi9271:~]
[root@esxi9271:~] esxcli system hostname set -f esxi9271.juniperlondonlab.net

[root@esxi9271:~] esxcli system hostname get
   Domain Name: juniperlondonlab.net
   Fully Qualified Domain Name: esxi9271.juniperlondonlab.net
   Host Name: esxi9271
[root@esxi9271:~]


issue with SNMP on ESXi
[root@esxi9271:~] ~/etc/init.d/snmpd restart
root: snmpd Running from interactive shell, running command: esxcli system snmp set -e false.
root: snmpd setting up resource reservations.
root: snmpd opening firewall port(s) for notifications.
root: snmpd watchdog for snmpd started.

[root@esxi9271:~] ~/etc/init.d/snmpd stop
root: snmpd Terminating snmpd process and removing ramdisk.
[root@esxi9271:~] ~/etc/init.d/snmpd start
root: snmpd, administrative restart detected, enabling agent.
root: snmpd setting up resource reservations.
root: snmpd opening firewall port(s) for notifications.
root: snmpd watchdog for snmpd started.

[root@esxi9271:~] exit
Connection to 172.30.92.71 closed.

[librenms@localhost ~]$ /opt/librenms/snmp-scan.py -v -r 172.30.92.71/32
Scanning IPs:
Scanned 172.30.92.71 Added device 172.30.92.71 (41)

Scanned 1 IPs: 0 known devices, added 1 devices, failed to add 0 devices
Runtime: 3.88 seconds
[librenms@localhost ~]$