Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Virtualization / VMware / How to Enable and Configure SNMP on VMWare ESXi Host

March 15, 2024

How to Enable and Configure SNMP on VMWare ESXi Host

You can use the standard SNMP protocol to monitor the health of VMWare ESXi hosts. This article shows you how to enable and configure the SNMP agent on VMWare ESXi 8.0 hosts and add them to your existing monitoring system (this guide applies to all versions of ESXi, including 6.7 and 7.0).

The built-in SNMP agent in ESXi can be configured from the esxcli command line or with the VMware PowerCLI PowerShell module, but not from the vSphere Client GUI.

Contents:
  • Enable and Configure SNMP Server on VMware ESXi
  • ESXi Firewall Configuration for SNMP Traffic
  • Set SNMP Settings on VMware ESXi Host with PowerShell
  • Configure SNMPv3 on VMWare ESXi

Enable and Configure SNMP Server on VMware ESXi

Open the ESXi Host client web interface and start the SNMP Serer service (snmpd): ESXi Host Client -> Manage -> Services -> SNMP Server (the service is stopped by default).

Enable SNMP server on VMWare ESXi host

Enable SSH on the ESXi host and connect to it using any SSH client.

Lists the current setting of the SNMP agent:

esxcli system snmp get

esxcli system snmp get

SNMP is not configured: all parameters are empty and the agent is disabled.

Authentication:
Communities:
Enable: false
Engineid:
Hwsrc: indications
Largestorage: true
Loglevel: info
Notraps:
Port: 161
Privacy:
Remoteusers:
Syscontact:
Syslocation:
Targets:
Users:
V3targets:

Set your monitoring server IP address (SNMP target), port (161 UDP by default), and SNMP community name (usually, public):

esxcli system snmp set --targets=192.168.99.99@161/public

If you want to allow access to more than one monitoring host, enter them separated by commas:

esxcli system snmp set --targets=192.168.99.99@161/public,192.168.14.14@161/public

Set the SNMP community name:

esxcli system snmp set --communities YOUR_COMMUNITY_STRING

You can also specify the device location:

esxcli system snmp set --syslocation "Allee 16, Mun, DE"

Set contact information:

esxcli system snmp set --syscontact [email protected]
Then enable SNMP service on the ESXi host:

esxcli system snmp set --enable true

To test the SNMP configuration:

esxcli system snmp test

configure snmp on vmware esxi host from cli:

Restart the SNMP agent to apply the new settings:

/etc/init.d/snmpd restart

/etc/init.d/snmpd restart

To reset all SNMP settings, use the following command:

esxcli system snmp set –r

To disable SNMP:

esxcli system snmp set --disable true

If you have a VMWare Enterprise Plus license, you can configure the SNMP option on ESXi hosts through Host Profiles (Policies and Profiles -> Host Profiles -> your_profile_name-> Other SNMP Agent Configuration).

Configure the following SNMP agent options here:

  • Enable or Disable agent: check the option
  • IP/UDP Port: 161
  • SNMP Community String: public
  • Notification Receiver: specify your monitoring host address in the format 192.168.1.100@161/public

Set SNMP agent settings via ESXi host profile

ESXi Firewall Configuration for SNMP Traffic

There are two ways to allow SNMP traffic in the ESXi host firewall. You can allow SMNP requests to be received from any device on the network:

esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
esxcli network firewall ruleset set --ruleset-id snmp --enabled true

Or you can allow inbound traffic from an IP address of your monitoring server or an IP subnet where your SNMP targets are located:

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

You are now ready to monitor your ESXi hosts.

Set SNMP Settings on VMware ESXi Host with PowerShell

If you need to quickly enable SNMP settings on multiple ESXi hosts, you can use the PowerShell script:

$ESXi = 'mun-esxi01'
$Community = 'Public'
$Target = '192.168.99.99'
$Port = '161'
# Connect to an ESXi host
Connect-VIServer -Server $sESXiHost
# Clear current SNMP settings
Get-VMHostSnmp | Set-VMHostSnmp -ReadonlyCommunity @()
# Set SNMP parameters
Get-VMHostSnmp | Set-VMHostSnmp -Enabled:$true -AddTarget -TargetCommunity $Community -TargetHost $Target -TargetPort $Port -ReadOnlyCommunity $Community
# List the current SNMP parameters
$Cmd= Get-EsxCli -VMHost $ESXiHost
$Cmd.System.Snmp.Get()

Configure SNMPv3 on VMWare ESXi

In the previous section, we looked at how to enable and configure SNMP agents v1 and v2 on ESXi hosts. The more modern and secure version of SNMP v3 is supported starting with VMware ESXi 5.1.

Enable support for authentication and encryption protocols for SNMP:

esxcli system snmp set -a MD5 -x AES128

Generate SNMP authentication and encryption password hashes (replace authpass1 and privhash1 with the password you want):

esxcli system snmp hash --auth-hash authpass1 --priv-hash privhash1 --raw-secret

esxcli generate hash for snmp v3

Copy the value of the resulting hashes (authhash1 and privhash1) into the following command to create an SNMP user (snmpuser):

esxcli system snmp set -e yes -C [email protected] -u snmpuser/authhash1_value/privhash1_value/priv

Then specify the SNMP target address:

esxcli system snmp set --v3targets 192.168.99.99@161/snmpuser/priv/trap

You can check the SNMP configuration remotely using the Linux snmpwalk tool:

snmpwalk -v3 -u snmpuser -l AuthPriv -a SHA -A authpass1 -x AES-X privhash1 192.168.1.120

snmpwalk: check snmp v3 connection to esxi

You are now ready to add an ESXi host to your monitoring app. For example, the Zabbix network monitoring solution provides out-of-the-box VMware ESXi monitoring via API (predefined template) without using SNMP.

You can download and import the Zabbix template for ESXi with SNMP support here (https://www.zabbix.com/integrations/vmware#3rd_party).

Then add a new ESXi host in Zabbix and configure the SNMPv3 connection settings.

add esxi snmp monitoring on zabbix

2 comments
3
Facebook Twitter Google + Pinterest
VirtualizationVMware
previous post
Using SSL/TLS Certificates for Remote Desktop (RDP)
next post
How to Remove Built-in Apps, Features & Editions from a Windows 10 Install Image (WIM file)

Related Reading

Adding External USB Storage Drive to VMware ESXi

December 18, 2024

Adding a Sound Card to a Virtual Machine...

March 15, 2024

Disable Auto Suspend of VM on VMWare Workstation/Player

August 26, 2021

Match Windows Disks to VMWare VMDK Files

March 12, 2024

How to Stop an Unresponsive (Stuck) Virtual Machine...

March 15, 2024

VMWare Error: Unable to Access a File Since...

March 15, 2024

Reduce Virtual Machine Disk Size (VMDK) on VMWare...

March 22, 2024

Unable to Unmount/Delete VMFS Datastore: The Resource Is...

March 12, 2024

2 comments

EJUNCA March 17, 2021 - 11:18 pm

Thank you so much! It works perfectly at WhatsUpGold
Best regards

Reply
Eduardo Torres May 19, 2021 - 4:31 pm

Muchas

gracias

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Reduce Virtual Machine Disk Size (VMDK) on VMWare ESXi
  • Match Windows Disks to VMWare VMDK Files
  • Invalid State of a Virtual Machine on VMWare ESXi
  • Adding External USB Storage Drive to VMware ESXi
  • KVM: How to Expand or Shrink a Virtual Machine Disk Size?
  • USB Device Passthrough (Redirect) to Hyper-V Virtual Machine
  • Adding a Sound Card to a Virtual Machine on VMWare ESXi
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top