VMware Cloud Community
NeenaJim
Enthusiast
Enthusiast
Jump to solution

SNMP

Can someone please help me to get the SNMP, SSH and Syslog information of all the ESXi hosts in the vCenter. 
I have the command to get those information for single esxi hosts. But not sure how to get the information of all the ESXi hosts in the vCenter.

I am looking the output something like< ESXi hosts name, SNMP status, SSH status and syslog 

Appreciate your help in advance! 

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You could do something like this

Connect-VIServer -Server <vCenter Name>

Get-VMHost | Get-VMHostService | Where-Object { $_.Key -eq "TSM-SSH" } | Select-Object -Property *
Get-VMHost -PipelineVariable vmhost | Get-VMHostSysLogServer | Select-Object @{N = 'VMHost'; E = { $vmhost.Name } }, *
Get-VMHost | Get-VMHostService | Where-Object { $_.Key -eq "SNMPD" } | Select-Object -Property  *


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
8 Replies
LucD
Leadership
Leadership
Jump to solution

What code are you using for a single ESXi node?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
NeenaJim
Enthusiast
Enthusiast
Jump to solution

For SNMP,

$user = 'root'
$pswd = 'password'
$esxName = 'esxihost'
Connect-VIServer -Server $esxName -User $user -Password $pswd
Get-VMHostService -VMHost $esxName | where{$_.Key -eq 'snmpd'}

Here the out put is coming like this:NeenaJim_0-1654094726785.png

I am looking the output has ESXi host name too.

 

For SSH,

Connect-VIServer -Server <vCenter Name>
Get-VMHost | Foreach { Stop-VMHostService -HostService ($_ | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"} ) }

NeenaJim_1-1654094892122.png

Here also the output doesn't have ESXi hosts name

Syslog,

Connect-VIServer -Server <vCenter Name>
$VMHosts = @(Get-VMHost)
Foreach ($VMHost in $VMHosts){
Get-VMHost $VMHost | get-VMHostSysLogServer
}

NeenaJim_2-1654095164908.png

Here also the output doesn't have ESXi hosts name

So after connecting the vCenter,  here I am looking an output that has the ESXi name and all the results of SNMP, SSH and Syslog. Can you please help @LucD ?

Thank you again for helping me!

 

 

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Are you using a vCenter?
Some snippets connect directly to the ESXi node.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
NeenaJim
Enthusiast
Enthusiast
Jump to solution

I would like to get the results of all the ESXi hosts by connecting the vCenter. But dont know how for SNMP!

Reply
0 Kudos
NeenaJim
Enthusiast
Enthusiast
Jump to solution

Just done some re-arrangements and got this:

Connect-VIServer -Server <vCenter Name>
Get-VMHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"}
Get-VMHost | get-VMHostSysLogServer
Get-VMHost | Get-VMHostService | Where { $_.Key -eq "SNMPD"}

But still it doesn't have the ESXi hosts name.

@LucD , is there any option where I can get the esxi host name in the output result?

Reply
0 Kudos
NeenaJim
Enthusiast
Enthusiast
Jump to solution

@LucD, Do you think it is possible to display ESXi host name in the output result?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

You could do something like this

Connect-VIServer -Server <vCenter Name>

Get-VMHost | Get-VMHostService | Where-Object { $_.Key -eq "TSM-SSH" } | Select-Object -Property *
Get-VMHost -PipelineVariable vmhost | Get-VMHostSysLogServer | Select-Object @{N = 'VMHost'; E = { $vmhost.Name } }, *
Get-VMHost | Get-VMHostService | Where-Object { $_.Key -eq "SNMPD" } | Select-Object -Property  *


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
NeenaJim
Enthusiast
Enthusiast
Jump to solution

Thank you, this really helps. You are such a great! Thanks again..

Reply
0 Kudos