附錄:適用於管理組件的監視和覆寫

本節提供詳細的程序和指令碼,您可以用來顯示所匯入之管理組件的規則和其他資訊。

如何檢視管理組件詳細資料

如需監視器和相關覆寫值的詳細資訊,請參閱監視器的 [產品知識] 索引標籤。

若要檢視監視器的 [產品知識] 索引標籤

  1. 在 Operations 主控台中,按一下 [撰寫中]。

  2. 展開 [管理組件物件],然後按一下 [監視器]。

  3. 在 [監視器] 窗格中展開目標,直到找到所要的監視器為止。

  4. 在監視器上按一下滑鼠右鍵,然後按一下 [內容]。

  5. 按一下 [產品知識] 索引標籤。

如何顯示管理組件的監視器

若要使用命令殼層顯示管理組件的監視器與覆寫的輸出清單,請使用下列程序。

若要顯示管理組件的監視器

  1. 按一下 [開始],再依序指向 [所有程式]、[System Center Operations Manager 2007 R2],然後按一下 [Operations Manager 殼層]。

  2. 輸入下列命令: get-monitor -managementPack name.mp | export-csv filename,其中 filename 是輸出檔案的名稱,然後按下 ENTER 鍵。

  3. 隨即建立 .csv 檔案。此 .csv 檔案可以在 Microsoft Office Excel 中開啟。

如何顯示管理組件的覆寫

若要顯示管理組件的覆寫,請使用下列程序。

若要顯示管理組件的覆寫

  1. 按一下 [開始],再依序指向 [所有程式]、[System Center Operations Manager 2007 R2],然後按一下 [Operations Manager 殼層]。

  2. 輸入下列命令: get-override -managementPack name.mp | export-csv filename,其中 filename 是輸出檔案的名稱,然後按下 ENTER 鍵。

  3. 隨即建立 .csv 檔案。此 .csv 檔案可以在 Microsoft Office Excel 中開啟。

如何顯示所有管理組件規則

若要顯示已匯入的管理組件的規則清單,請使用下列程序。

若要顯示管理組件規則

  1. 按一下 [開始],再依序指向 [所有程式]、[System Center Operations Manager 2007 R2],然後按一下 [Operations Manager 殼層]。

  2. 輸入下列命令: get-rule | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}},DisplayName | sort-object -property MP | export-csv filename,其中 filename 是輸出檔案的名稱,然後按下 ENTER 鍵。

  3. 隨即建立 .csv 檔案。此 .csv 檔案可以在 Microsoft Office Excel 中開啟。

如何顯示監視閾值

若要顯示監視閾值,請使用本節中描述的指令碼。此指令碼可用於大部分監視器。 它會建立一個可在 Microsoft Office 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"

如何顯示效能集合規則

若要顯示效能集合規則,請使用本節中的指令碼。此指令碼可用於大部分監視器。 它會建立一個可在 Microsoft Office Excel 中開啟的 .csv 檔案,且檔案會包含下列資料行。

資料行 描述

WriteAction

包含在哪裡寫入效能計數器的相關資訊

WriteToDB 或 CollectionPerformanceData

寫入 Operations Manager 2007 資料庫

WriteToDW 或 CollectPerfDataWarehouse

寫入資料倉儲

WC

將效能計數器的基準資料儲存至操作資料庫

 

若要顯示管理群組中的效能集合規則,請執行下列指令碼:

function GetPerfCounterName ([String] $configuration)
{
   $config = [xml] ("<config>" + $configuration + "</config>")
   return ($config.Config.ObjectName + "\" + $config.Config.CounterName)
}

function GetFrequency ([String] $configuration)
{
   $config = [xml] ("<config>" + $configuration + "</config>")
   $frequency = $config.Config.Frequency;

   if($frequency -eq $null)
   {
      $frequency = $config.Config.IntervalSeconds;
   }

   return ($frequency)
}

function GetDisplayName($performanceRule)
{
   if($performanceRule.DisplayName -eq $null)
   {
      return ($performanceRule.Name);
   }
   else
   {
      return ($performanceRule.DisplayName);
   }
}

function GetWriteActionNames($performanceRule)
{
   $writeActions = ""; 
   foreach($writeAction in $performanceRule.WriteActionCollection)
   {
      $writeActions += " " + $writeAction.Name;
   }
   return ($writeActions);
}

$perf_collection_rules = get-rule -criteria:"Category='PerformanceCollection'"

$perf_collection_rules | select-object @{name="Type";expression={foreach-object {(Get-MonitoringClass -id:$_.Target.Id).DisplayName}}},@{name="RuleDisplayName";expression={foreach-object {GetDisplayName $_}}} ,@{name="CounterName";expression={foreach-object {GetPerfCounterName $_.DataSourceCollection[0].Configuration}}},@{name="Frequency";expression={foreach-object {GetFrequency $_.DataSourceCollection[0].Configuration}}},@{name="WriteActions";expression={foreach-object {GetWriteActionNames $_}}}  | sort Type,RuleDisplayName,CounterName | export-csv "c:\perf_collection_rules.csv"