I have configured two ESXi (vmHost1 and vmHost2) servers to send out SNMP traps. However they are being received (target is a VM on vmHost1) with the listed ip address of 127.0.0.1
I have seen known issues such as if the name of your ESXi host is localhost that this will occur but I have configured alternate hostnames on both servers and checked the ESXi servers hosts file to ensure it lists both the ip and machine name.
On my SNMP receiver I am using a powershell script below which displays within it the ip address that the trap was received from.
$UdpPort=162
$endpoint = New-Object System.Net.IPEndPoint([IPAddress]::Any, $UdpPort)
$udpclient= New-Object System.Net.Sockets.UdpClient $UdpPort
while($content=$udpclient.Receive([ref]$endpoint)) {Write-Host -nonewline $content}
Relevant ip addresses
vmHost1: 192.168.1.111
vmHost2: 192.168.1.112
SNMP Trap receiver: 192.168.1.151
Current SNMP setup on ESXi Server
C:\Program Files (x86)\VMware\VMware vSphere CLI>vicfgsnmp.pl --server 192.168.1.111 --username root --password rootPass -show
Current SNMP agent settings:
Enabled: 1
UDP port: 161
Communities:
ESXi-COM
Notification targets:
192.168.1.151@162/ESXi-COM
Options:
EnvEventSource=indications
engineid=00000063000000a100000000
loglevel=info