Quantcast
Channel: THWACK: All Content - All Communities
Viewing all articles
Browse latest Browse all 13537

Help with custom PowerShell monitor

$
0
0

I am trying to monitor the search index for SharePoint.

 

I would need to monitor when the state for index component state= degraded

 

anyone able to help me create a custom monitor?

the powershell command would be:

 

$ssappn = Get-SPEnterpriseSearchServiceApplication

Get-SPEnterpriseSearchStatus –SearchApplication $ssappn[0].Name

purna-degradedserviceappn.png

 

My super quick attempt to write a PS monitor.

 

$ErrorActionPreference = "silentlycontinue";

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

$Error.Clear();

$stat1=$stat2=$stat3=$stat4=0;

$ssappn = Get-SPEnterpriseSearchServiceApplication

$out=Get-SPEnterpriseSearchStatus –SearchApplication $ssappn[0].Name

 

 

if ($out.State -eq 'Active')

{

  Write-host "Message: Search Index is active!";

  Write-host "Statistic: $stat";

  Exit 0;

  }

  Elseif

($out.State -eq 'degraded')

{

  Write-host "Message: Search Index is degraded!";

  Write-host "Statistic: $stat";

  Exit 1;

  }

 

However, i don't know how i would filter out just one line to check for the status. I really only care if the Index is Degraded


Viewing all articles
Browse latest Browse all 13537

Trending Articles



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