ESX and SNMP

Clear all existing SNMP Trap Targets

$vmhostsnmp = Get-VMHostSNMP
Set-VMHostSnmp -HostSnmp $vmhostsnmp -ReadOnlyCommunity @() -RemoveTarget -TrapTargetToRemove$$vmhostsnmp.TrapTargets[0]

Set SNMP trap target(s)

$snmpTargets = @("192.168.25.22", "192.168.32.35", "192.168.32.56")
$snmpPort = "162"
$snmpCommunity ="hithere"

$snmpTargets | % { Set-VMHostSnmp –HostSnmp $vmhostsnmp –ReadOnlyCommunity $snmpCommunity –TargetHost $_ –TargetCommunity $snmpCommunity –TargetPort $snmpPort –AddTarget –Confirm:$false }

Note: There is a maximum of three (3) trap targets allowed. See link below
Configure SNMP Targets

Display the current SNMP Settings

Get-VMHostSnmp | Select -ExpandProperty TrapTargets

HostName        Port  Community           
--------        ----  ---------           
192.168.25.22   162   hithere
192.168.32.35   162   hithere
192.168.32.56   162   hithere

Environmental Information:
ESXi 5.5

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.