Wondering how to configure SNMP VMWare ESXi 5.5? Take a peek at this blog.
Here at Bobcares, we have seen several such VMWare related errors as part of our Server Management Services for web hosts and online service providers.
Today we will take a look at the configuration process of SNMP VMWare.
SNMP Server in VMWare ESXi
From the vSphere web interface, we can make sure that the “SNMP server” service is running.
We change its startup settings or stop/start the service.
First, we go to ESXi host >> Configure >> Services >> SNMP Server. The service is stopped by default. We start it.
Configuring SNMP Agent Parameters in ESXi
In order to monitor the state of VMWare ESXi servers in the monitoring system, we must configure the SNMP agents on hosts.
Now let’s take a look at how our Support Engineers configure SNMP Agent parameters.
First, we specify the monitoring server IP address (SNMP target). Then the port (by default, 161 UDP) and SNMP community name (usually, public):
esxcli system snmp set –targets=192.168.99.99@161/public
Or we set the community name as follows:
esxcli system snmp set –communities YOUR_COMMUNITY_STRING
Additionally, we specify the location:
esxcli system snmp set –syslocation “Atlee 18, Mun, DE”
Contact information:
esxcli system snmp set --syscontact admin@bobcares.com
Then we enable SNMP service on the ESXi host:
esxcli system snmp set --enable true
Then to test the SNMP configuration, we run the below command.
esxcli system snmp test
To apply the settings, we restart the SNMP agent.
/etc/init.d/snmpd restart
To reset current settings, we use the below command.
esxcli system snmp set –r
Then to disable SNMP, we use the below command.
esxcli system snmp set --disable true
ESXi Firewall Configuration for SNMP Traffic
We follow SNMP traffic in the ESXi host firewall in two ways. To allow SNMP requests 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 we can allow inbound traffic from an IP address of our monitoring server or an IP subnet where our SNMP servers 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
Now we can monitor your VMWare ESXi hosts over SNMP.
Change SNMP Settings on ESXi Host Using PowerCLI
If we want to quickly configure SNMP parameters on multiple ESXi hosts, we use this PowerCLI script:
$ESXi = 'mun-esxi01'
$Community = 'Public'
$Target = '192.168.99.99'
$Port = '161'
#Connection to an ESXi host
Connect-VIServer -Server $sESXiHost
#Clearing the current SNMP settings
Get-VMHostSnmp | Set-VMHostSnmp -ReadonlyCommunity @()
#Configure SNMP parameters
Get-VMHostSnmp | Set-VMHostSnmp -Enabled:$true -AddTarget -TargetCommunity $Community -TargetHost $Target -TargetPort $Port -ReadOnlyCommunity $Community
#Display the current SNMP parameters
$Cmd= Get-EsxCli -VMHost $ESXiHost
$Cmd.System.Snmp.Get()
VMWare ESXi SNMPv3 Configuration
Till now discussed how to enable and configure an SNMP agent v1 and v2 on ESXi hosts. Starting from ESXi 5.1, a more modern protocol version is used: SNMP v3. We use the following commands to configure a more secure SNMPv3.
We set authentication and encryption protocols by running the below command.
esxcli system snmp set -a MD5 -x AES128
Here is the command that generates hashes for the authentication and encryption passwords (replace authpass and privhash with your password):
esxcli system snmp hash --auth-hash authpass --priv-hash privhash --raw-secret
Using the hashes (authhash and privhash), we add a user.
esxcli system snmp set -e yes -C snmp@woshub.com -u snmpuser/authhash/privhash/priv
Then we specify the SNMP target address as below.
esxcli system snmp set –v3targets 192.168.99.99@161/user/priv/trap
Remotely we check the SNMP configuration using the Linux snmpwalk tool:
snmpwalk -v3 -u snmpuser -l AuthPriv -a SHA -A P@ssw0rd1 -x AES-X P@ssw0rd 192.168.1.120
[Need any further assistance in fixing VMWare errors? – We are here to help you]
Conclusion
Today, we saw how our Support Engineers configure SNMP VMWare ESXi 5.5.
0 Comments