VMware Cloud Community
sjtmal
Contributor
Contributor

SNMP on esxi 5

Can we configure multiple SNMP target on esxi 5 host? If yes, what is the command.

I am running following command.

vicfg-snmp.pl --server esxhost --username root -t snmpserver@162/community

3 Replies
jrmunday
Commander
Commander

Yes, it's possible ... I normally do this using PowerShell;

## Connect to the ESXi Host using root (**NOT vCenter**)

Connect-VIServer -Server 'esxihost.fqdn' -User 'root' -Password 'rootpassword'

## Enable SNMP

Write-Host -Object "$(Get-Date -Format s) - Enabling SNMP"

Get-VMHostSnmp | Set-VMHostSnmp -Enabled:$true

## Add Communities

Write-Host -Object "$(Get-Date -Format s) - adding SNMP communities"

Get-VMHostSnmp | Set-VMHostSnmp -ReadOnlyCommunity Community1, Community2

## Add Targets

Write-Host -Object "$(Get-Date -Format s) - Adding SNMP targets"

Get-VMHostSnmp | Set-VMHostSnmp -TargetCommunity 'Community1' -TargetHost 'target1.fqdn' -TargetPort 162 -AddTarget

Get-VMHostSnmp | Set-VMHostSnmp -TargetCommunity 'Community2' -TargetHost 'target2.fqdn' -TargetPort 162 -AddTarget

## Disconnect from the ESXi Host

Disconnect-VIServer -Server 'esxihost.fqdn' -Force -Confirm:$false

vExpert 2014 - 2022 | VCP6-DCV | http://www.jonmunday.net | @JonMunday77
Almero
Enthusiast
Enthusiast

HI There , Don't you have to start SNMPd ?

Or is this done , when you Enable ?

Reply
0 Kudos
filips992
Contributor
Contributor

Hello Almero,

You can always check the status of snmp service :

/etc/init.d/snmpd status

In case it is not started, you can start it with:

/etc/init.d/snmpd start

Enable parameters add the service to startup only i believe - but cant guarantee on that.

Smiley Happy

Reply
0 Kudos