Welcome to MSDN Blogs Sign in | Join | Help

So what thresholds do my monitors have?

One of the things people have been asking about is what thresholds are used by various monitors. There is no bullet proof way to do this, but here is a script I wrote that would answer this question for the majority of monitors:

function GetThreshold ([String] $configuration)
{

$config = [xml] ("<config>" + $configuration + "</config>")

$threshold = $config.Config.Threshold

if($threshold -eq $null)
{
$threshold = $config.Config.MemoryThreshold
}

if($threshold -eq $null)
{
$threshold = $config.Config.CPUPercentageThreshold
}

if($threshold -eq $null)
{

if($config.Config.Threshold1 -ne $null -and $config.Config.Threshold2 -ne $null)
{
                $threshold = "first threshold is: " + $config.Config.Threshold1 + " second threshold is: " + $config.Config.Threshold2
}

}

if($threshold -eq $null)
{

if($config.Config.ThresholdWarnSec -ne $null -and $config.Config.ThresholdErrorSec -ne $null)
{
 $threshold = "warning threshold is: " + $config.Config.ThresholdWarnSec + " error threshold is: " + $config.Config.ThresholdErrorSec 
}

}

if($threshold -eq $null)
{
                if($config.Config.LearningAndBaseliningSettings -ne $null)
                {             
                                $threshold = "no threshold (baseline monitor)"
                }
}

return $threshold

}

$perfMonitors = get-monitor -Criteria:"IsUnitMonitor=1 and Category='PerformanceHealth'"

$perfMonitors | select-object @{name="Target";expression={foreach-object {(Get-MonitoringClass -Id:$_.Target.Id).DisplayName}}},DisplayName, @{name="Threshold";expression={foreach-object {GetThreshold $_.Configuration}}}, @{name="AlertOnState";expression={foreach-object {$_.AlertSettings.AlertOnState}}}, @{name="AutoResolveAlert";expression={foreach-object {$_.AlertSettings.AutoResolve}}}, @{name="AlertSeverity";expression={foreach-object {$_.AlertSettings.AlertSeverity}}} | sort Target, DisplayName | export-csv "c:\monitor_thresholds.csv"

The output of this script is a csv file with the following columns:

Type - the type of objects the monitor is targeted to

DisplayName - the display name of the monitor

Threshold - the threshold used by the monitor

AlertOnState - whether the monitor generates an alert when its state changes

AutoResolveAlert - whether the generated alert will be autoresolved when the monitor state goes back to green

AlertSeverity - the severity of the generated alert

 

Published Tuesday, August 07, 2007 12:36 AM by Boris Yanushpolsky
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: So what thresholds do my monitors have?

Friday, June 20, 2008 12:19 PM by Volker

the script says "The 'Path' paramter is empty or the required provider location is not set." How come?

# re: So what thresholds do my monitors have?

Wednesday, January 21, 2009 8:35 PM by Michael

I am getting the same prompt as Volker, when trying to run this script. It is probably related to how I saved and ran the script. I copied and pasted the entire contents to a .ps1 file and then called this file from the OpsMgr Command Shell.

Can someone please help? Thanks.

# re: So what thresholds do my monitors have?

Wednesday, January 21, 2009 8:38 PM by CluelessWithPShell

I am getting the same prompt as Volker, when trying to run this script. It is probably related to how I saved and ran the script. I copied and pasted the entire contents to a .ps1 file and then called this file from the OpsMgr Command Shell.

Can someone please help? Thanks.

# re: So what thresholds do my monitors have?

Wednesday, July 15, 2009 12:42 PM by Paul Bendall

I had the same issue with regard to "The 'Path' paramter is empty or the required provider location is not set."

When you start Ops Manager Shell DON'T change to the directory where you saved the script file to. Instead just type the full path to the script, i.e I copied the script and pasted into a file called Get-Thresholds.ps1 which I saved to C:\Temp. Therefore, I typed c:\temp\Get-Threshold.ps1. In so doing the path is taken as the current location in the Ops Manager Shell

HTH

Paul

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker