I am trying to write a script in the powershell monitor but am having some difficulty.
Basically I want to monitor Web Farm Framework status. If I run the commands manually in powershell, they involve the following two commands:
Add-PSSnapin WebFarmSnapin
Get-Server -WebFarm WEBFARM1 -Address SERVER01A
The output is:
Address : SERVER01A
WebFarm : WEBFARM1
Enabled : T
ServerError :
ReadyForLoadBalancing : True
ActiveOperations : {SampleRuntimeData, ServerCounters, RunRemote}
AvailableOperations : {AutoRepair, WindowsUpdateProvider, AddServer, ServiceControl...}
OperatingSystem : Microsoft Windows NT 6.1.7601 Service Pack 1
ArchitectureSize : 64
CultureInfo : en-US
Counters : Microsoft.Web.Farm.ServerCounters
My goal is to use SAM to monitor the "ReadyForLoadBalancing" parameter and show the component as DOWN (sending an alert) if the status != true.
So far, I've got this:
Add-PSSnapin WebFarmSnapin
$GetServerOutput = "Get-Server -WebFarm WEBFARM1 -Address SERVER01A" | Out-String
I'm not a programmer or developer so I'm stuck at that point and not sure how to finish up the script and get it working.