Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all articles
Browse latest Browse all 2677

vCenter Powershell Application Monitor Issues

$
0
0

Greetings,

 

I'm currently working on a ps script monitor that will monitor vCenter Alarms since this wasn't offered OoB with VMAN (why?..) Anyways, The script works on my local machine, and on the SW Server just fine, it's whenever I bring it to the script into the application monitor i'm having issues. Tests will return "unknown" but will sometimes test error free. The output I'm getting now is:

 

Output: ==============================================

 

Name Port User

---- ---- ----

VBMPRVIC322.cbn.local 443 NTD1\nocmonitoring

Message:

Statistic:

Message:

Statistic

 

This is only when 64 bit mode is selected, when using x86 I get the error "VMware.VimAutomation.Core' was not loaded because no valid module file was found in any module director" followed by a bunch of "not recognized as the name of a cmdlet" I've installed the latest PowerCLI modules, Tried Importing VMWare.PowerCLI instead of VMware.VimAutomation.Core. I've tried execution modes local and remove against the VIS itself and against the Solarwinds server to no joy. Is there any reason anyone can think of that may be preventing this from working?

 

 

Import-Module -Name "E:\Scripts\VMWare\VMware.VimAutomation.Core"

 

 

$vCenter = 'vCenter321'

 

 

Connect-VIServer $vCenter -User user1 -Password 'password'

 

 

$rootFolder = Get-Folder -Server $vCenter "Datacenters"

 

 

Function Get-TriggeredAlarms {

foreach ($ta in $rootFolder.ExtensionData.TriggeredAlarmState) {

$alarm = "" | Select-Object VC, EntityType, Alarm, Entity, Status, Time, Acknowledged, AckBy, AckTime

$alarm.VC = $vCenter

$alarm.Alarm = (Get-View -Server $vc $ta.Alarm).Info.Name

$entity = Get-View -Server $vc $ta.Entity

$alarm.Entity = (Get-View -Server $vc $ta.Entity).Name

$alarm.EntityType = (Get-View -Server $vc $ta.Entity).GetType().Name

$alarm.Status = $ta.OverallStatus

$alarm.Time = $ta.Time

$alarm.Acknowledged = $ta.Acknowledged

$alarm.AckBy = $ta.AcknowledgedByUser

$alarm.AckTime = $ta.AcknowledgedTime

$alarm

}

}

Disconnect-VIServer $vCenter -Confirm:$false

 

 

$alarms = Get-TriggeredAlarms $vCenter

 

 

foreach ($alarm in $alarms) {

 

 

if ($ta.OverallStatus -eq 'red'){

$Red = Write-Output ""$alarm.Alarm" on "$alarm.Entity", Overall status is Red."

$Red1 = Write-Output "1"

}

 

 

if ($ta.OverallStatus -eq 'yellow'){

$Yellow = Write-Output ""$alarm.Alarm" on "$alarm.Entity", Overall status is Yellow."

$Yellow1 = Write-Output "2"

}

}

   

 

 

 

 

Write-Host "Message: $Red"

Write-Host "Statistic: $Red1"

Write-Host "Message: $Yellow"

Write-Host "Statistic $Yellow1"


Viewing all articles
Browse latest Browse all 2677

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>