From e8298afe3a8047a7673cc37804ac81623c0d79cd Mon Sep 17 00:00:00 2001 From: William Lam Date: Wed, 25 Jan 2017 05:54:32 -0800 Subject: [PATCH] Adding Get-VAMIHealth function --- Modules/VAMI.psm1 | 57 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/Modules/VAMI.psm1 b/Modules/VAMI.psm1 index abdf4a3..6c8c835 100644 --- a/Modules/VAMI.psm1 +++ b/Modules/VAMI.psm1 @@ -2,15 +2,15 @@ <# .NOTES =========================================================================== - Created by: William Lam + Created by: William Lam Date: Jan 20, 2016 - Organization: VMware + Organization: VMware Blog: www.virtuallyghetto.com Twitter: @lamw =========================================================================== .SYNOPSIS This function retrieves some basic information from VAMI interface (5480) - for a VCSA node which can be an Embedded VCSA, External PSC or External VCSA. + for a VCSA node which can be an Embedded VCSA, External PSC or External VCSA. .DESCRIPTION Function to return basic VAMI summary info .EXAMPLE @@ -33,4 +33,53 @@ $summaryResult.Uptime = $uptime $summaryResult -} \ No newline at end of file +} + +Function Get-VAMIHealth { +<# + .NOTES + =========================================================================== + Created by: William Lam + Date: Jan 20, 2016 + Organization: VMware + Blog: www.virtuallyghetto.com + Twitter: @lamw + =========================================================================== + .SYNOPSIS + This function retrieves health information from VAMI interface (5480) + for a VCSA node which can be an Embedded VCSA, External PSC or External VCSA. + .DESCRIPTION + Function to return VAMI health + .EXAMPLE + Connect-CisServer -Server 192.168.1.51 -User administrator@vsphere.local -Password VMware1! + Get-VAMIHealth +#> + $healthOverall = (Get-CisService -Name 'com.vmware.appliance.health.system').get() + $healthLastCheck = (Get-CisService -Name 'com.vmware.appliance.health.system').lastcheck() + $healthCPU = (Get-CisService -Name 'com.vmware.appliance.health.load').get() + $healthMem = (Get-CisService -Name 'com.vmware.appliance.health.mem').get() + $healthSwap = (Get-CisService -Name 'com.vmware.appliance.health.swap').get() + $healthStorage = (Get-CisService -Name 'com.vmware.appliance.health.storage').get() + + # DB health only applicable for Embedded/External VCSA Node + $vami = (Get-CisService -Name 'com.vmware.appliance.system.version').get() + + if($vami.type -eq "vCenter Server with an embedded Platform Services Controller" -or $vami.type -eq "vCenter Server with an external Platform Services Controller") { + $healthVCDB = (Get-CisService -Name 'com.vmware.appliance.health.databasestorage').get() + } else { + $healthVCDB = "N/A" + } + $healthSoftwareUpdates = (Get-CisService -Name 'com.vmware.appliance.health.softwarepackages').get() + + $healthResult = "" | Select HealthOverall, HealthLastCheck, HealthCPU, HealthMem, HealthSwap, HealthStorage, HealthVCDB, HealthSoftware + $healthResult.HealthOverall = $healthOverall + $healthResult.HealthLastCheck = $healthLastCheck + $healthResult.HealthCPU = $healthCPU + $healthResult.HealthMem = $healthMem + $healthResult.HealthSwap = $healthSwap + $healthResult.HealthStorage = $healthStorage + $healthResult.HealthVCDB = $healthVCDB + $healthResult.HealthSoftware = $healthSoftwareUpdates + + $healthResult +}