如何顯示監視閾值

適用於: Operations Manager 2007

若要顯示監視閾值,請使用本節中描述的指令碼。此指令碼可用於大部分監視。它會建立包含下列資料行且可使用 Excel 加以檢視的 .csv 檔案。

 

欄位 描述

Type

監視的目標物件類型

DisplayName

監視的顯示名稱

Threshold

監視使用的閾值

AlertOnState

判定監視是否會在狀態變更時產生警示

AutoResolveAlert

判定當監視恢復綠色狀態時,是否會自動解除產生的警示

AlertSeverity

所產生警示的嚴重性

請執行下列指令碼以建立顯示監視閾值的 .csv 檔案:

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"

社群新增項目

顯示: