VMware Cloud Community
qwert1235
Enthusiast
Enthusiast
Jump to solution

Configure snmp.xml file on ESXi 5.5 via PowerShell or PowerCLI

Hello:

I wonder if there is a way to configure snmp.xml file on ESXi host (/etc/vmware/snmp.xml) via script? I have root password and want to be able update/change this file remotely...

Thank you very much!

0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
Leadership
Jump to solution

To use the Set-VMHostSnmp cmdlet you have to be connected to the ESXi host directly. The following example will connect to an ESXi host named ESX01 and sets SNMP to enabled and a read-only community example-community (Example 1 from the Set-VMHostSnmp help):

Connect-VIServer ESX01

$vmhostSNMP = Get-VMHostSNMP

Set-VMHostSNMP $vmhostSNMP -Enabled:$true -ReadOnlyCommunity 'example-community'

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition

View solution in original post

0 Kudos
4 Replies
RvdNieuwendijk
Leadership
Leadership
Jump to solution

You can use the PowerCLI Set-VMHostSnmp cmdlet to configure the /etc/vmware/snmp.xml file in a script.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
qwert1235
Enthusiast
Enthusiast
Jump to solution

Thank you very much for your answer!

do you have any syntax examples?  I read somewhere you should use different approach for different versions of ESXi... 

Thanks a lot!

0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

To use the Set-VMHostSnmp cmdlet you have to be connected to the ESXi host directly. The following example will connect to an ESXi host named ESX01 and sets SNMP to enabled and a read-only community example-community (Example 1 from the Set-VMHostSnmp help):

Connect-VIServer ESX01

$vmhostSNMP = Get-VMHostSNMP

Set-VMHostSNMP $vmhostSNMP -Enabled:$true -ReadOnlyCommunity 'example-community'

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
0 Kudos
qwert1235
Enthusiast
Enthusiast
Jump to solution

Thanks a lot!

0 Kudos