none
How to get Monitor/Rules thresholds values in SCOM 2012

    Question

  • I know that there will be a Power Shell script available to get monitor/rules threshold values in scom 2007 R2

    I want to export scom 2012 MP's threshold values. Please anyone help on this. T

    Regards,

    Venkat

    Friday, February 1, 2013 2:05 PM

Answers

  • Here you go for Monitors with threshold values

    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
    }
    Function GetFrequency ([String] $configuration)
    {
    $config = [xml] ("<config>" + $configuration + "</config>")
    $Frequency = $config.Config.Frequency
    if($Frequency -eq $null)
    {
    $frequency = $config.Config.Frequency;
    }
     return ($frequency)
    }
    Function GetNumsamples ([String] $configuration)
    {
    $config = [xml] ("<config>" + $configuration + "</config>")
    $Samples = $config.Config.Samples
    if($Samples -eq $null)
    {
    $Samples = $config.Config.NumSamples;
    }
     return ($Samples)
    }
    Function GetCounterName ([String] $configuration)
    {
    $config = [xml] ("<config>" + $configuration + "</config>")
    $Counter = $config.Config.Counter
    if($Counter -eq $null)
    {
    $Counter = $config.Config.CounterName;
    }
     return ($Counter)
    }
    Function GetObject ([String] $configuration)
    {
    $config = [xml] ("<config>" + $configuration + "</config>")
    $Object = $config.Config.Object
    if($Object -eq $null)
    {
    $Object = $config.Config.ObjectName;
    }
     return ($Object)
    }
    $perfMonitors = get-scommonitor 
    $perfMonitors | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}},@{name="Target";expression={foreach-object {(Get-SCOMClass -Id:$_.Target.Id).DisplayName}}},DisplayName,enabled,@{name="Threshold";expression={foreach-object {GetThreshold $_.Configuration}}}, @{name="Frequency";expression={foreach-object {GetFrequency $_.Configuration}}}, @{name="Samples";expression={foreach-object {GetNumSamples $_.Configuration}}}, @{name="Counter";expression={foreach-object {GetCounterName $_.Configuration}}}, @{name="Object";expression={foreach-object {GetObject $_.Configuration}}} | sort Target, DisplayName | export-csv "c:\export\PerformanceMonitors.csv"

    • Marked as answer by Illam Friday, February 22, 2013 9:16 AM
    Thursday, February 21, 2013 3:58 PM

  • Hi,

    Please see if the method for SCOM 2007 helps:

    Appendix: Monitors and Overrides for Management Packs
    http://technet.microsoft.com/en-us/library/ff723847.aspx

    Thanks.


    Nicholas Li
    TechNet Community Support

    Monday, February 4, 2013 4:58 AM
    Moderator

All replies


  • Hi,

    Please see if the method for SCOM 2007 helps:

    Appendix: Monitors and Overrides for Management Packs
    http://technet.microsoft.com/en-us/library/ff723847.aspx

    Thanks.


    Nicholas Li
    TechNet Community Support

    Monday, February 4, 2013 4:58 AM
    Moderator
  • Here you go for Monitors with threshold values

    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
    }
    Function GetFrequency ([String] $configuration)
    {
    $config = [xml] ("<config>" + $configuration + "</config>")
    $Frequency = $config.Config.Frequency
    if($Frequency -eq $null)
    {
    $frequency = $config.Config.Frequency;
    }
     return ($frequency)
    }
    Function GetNumsamples ([String] $configuration)
    {
    $config = [xml] ("<config>" + $configuration + "</config>")
    $Samples = $config.Config.Samples
    if($Samples -eq $null)
    {
    $Samples = $config.Config.NumSamples;
    }
     return ($Samples)
    }
    Function GetCounterName ([String] $configuration)
    {
    $config = [xml] ("<config>" + $configuration + "</config>")
    $Counter = $config.Config.Counter
    if($Counter -eq $null)
    {
    $Counter = $config.Config.CounterName;
    }
     return ($Counter)
    }
    Function GetObject ([String] $configuration)
    {
    $config = [xml] ("<config>" + $configuration + "</config>")
    $Object = $config.Config.Object
    if($Object -eq $null)
    {
    $Object = $config.Config.ObjectName;
    }
     return ($Object)
    }
    $perfMonitors = get-scommonitor 
    $perfMonitors | select-object @{Name="MP";Expression={ foreach-object {$_.GetManagementPack().DisplayName }}},@{name="Target";expression={foreach-object {(Get-SCOMClass -Id:$_.Target.Id).DisplayName}}},DisplayName,enabled,@{name="Threshold";expression={foreach-object {GetThreshold $_.Configuration}}}, @{name="Frequency";expression={foreach-object {GetFrequency $_.Configuration}}}, @{name="Samples";expression={foreach-object {GetNumSamples $_.Configuration}}}, @{name="Counter";expression={foreach-object {GetCounterName $_.Configuration}}}, @{name="Object";expression={foreach-object {GetObject $_.Configuration}}} | sort Target, DisplayName | export-csv "c:\export\PerformanceMonitors.csv"

    • Marked as answer by Illam Friday, February 22, 2013 9:16 AM
    Thursday, February 21, 2013 3:58 PM