VMware | Enable SNMP

Although SNMP traps can be configured within Windows VMs installed on the VMWare host it can also be configured to report directly from ESXi. This configuration helps monitoring software such as Solarwinds or Spiceworks.

Configure ESXi SNMP via CLI (with Prompts):

Download/Install: VMware vSphere CLI 5.1

@echo off
echo Enter the FQDN of the host:
set /p hostname=
echo Enter the root password:
set /p password=
set user=root
"C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\vicfg-snmp.pl" --server %hostname% --username %user% --password %password% -c ESX -t 200.200.200.200@161/ESX --enable
"C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\vicfg-snmp.pl" --server %hostname% --username %user% --password %password% -show >> c:\ESXi_SNMP.log
pause

This script will output results similar to this…

Configure ESXi SNMP via CLI (NO prompts):

String can also be used without input prompts for quick batch run on multiple servers.

@echo off
set hostname1=UK-ESX01.domain.com
set password1=Password123
set user1=root
set hostname2=UK-ESX02.domain.com
set password2=Password234
set user2=root
 
<span style="font-size: 0.857142857rem; line-height: 1.714285714;">"C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\vicfg-snmp.pl" --server %hostname1% --username %user1% --password %password1% -</span>c ESX -t 200.200.200.200@161/ESX --enable
 
<span style="font-size: 0.857142857rem; line-height: 1.714285714;"><span style="font-size: 0.857142857rem; line-height: 1.714285714;">"C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\vicfg-snmp.pl" --server %hostname2% --username %user2% --password %password2% -</span></span>c ESXSNMP -t 200.200.200.200@161/ESXSNMP --enable

View ESXi SNMP configuration via CLI (with Prompts):

@echo off
echo Enter the FQDN of the host:
set /p hostname=
echo Enter the root password:
set /p password=
set user=root
echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ &gt;&gt; c:\ESXi_SNMP.log
echo %hostname% &gt;&gt; c:\ESXi_SNMP.log
"C:\Program Files (x86)\VMware\VMware vSphere CLI\bin\esxcli.exe" --server %hostname% --username %user% --password %password% software vib list &gt;&gt; c:\ESXi_SNMP.log
pause

See Post: Dell OpenManage | Windows Server & ESXi

References: Installing OpenManage Server Administrator on ESXi4 with OpenManage Essentials

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.