How to Create an Override for a Diagnostic

System Center

Updated: May 22, 2009

Applies To: Operations Manager 2007 R2, Operations Manager 2007 SP1, System Center Operations Manager 2007

You can create an override for a property or configuration parameter for a diagnostic. A property override changes the default value of a diagnostic property, and a configuration override changes the default value of a custom configuration setting for a diagnostic. If you want to create an override for a diagnostic, use the ManagementPackDiagnosticPropertyOverride or ManagementPackDiagnosticConfigurationOverride class. These classes are derived from the ManagementPackDiagnosticOverride class.

Only the Enabled property can be overridden for diagnostics. To figure out which parameters can be overridden, you must look at the definition of the diagnostic in the Management Pack that defines the diagnostic. All the parameters that can be overridden are defined in the OverrideableParameters element of the diagnostic. You can also call the GetOverrideableParameters method to get the list of parameters programmatically.

The following example creates an override for the Enabled property of a diagnostic.

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.EnterpriseManagement
Imports Microsoft.EnterpriseManagement.Administration
Imports Microsoft.EnterpriseManagement.Common
Imports Microsoft.EnterpriseManagement.Configuration
Imports Microsoft.EnterpriseManagement.Monitoring

Namespace SDKSamples
    Class Program
        Public Overloads Shared Function Main(ByVal args() As String) As Integer

            Dim mg As ManagementGroup
            Dim mp As ManagementPack
            Dim monitoringClass As MonitoringClass
            Dim diagnosticCriteria As MonitoringDiagnosticCriteria
            Dim diagnostic As MonitoringDiagnostic
            Dim diagnosticOverride As ManagementPackDiagnosticPropertyOverride

            mg = New ManagementGroup("localhost")

            mp = mg.GetManagementPacks("OverrideTestMP")(0)

            monitoringClass = mg.GetMonitoringClass(SystemMonitoringClass.WindowsComputer)

            diagnosticCriteria = New MonitoringDiagnosticCriteria( _

            diagnostic = mg.GetMonitoringDiagnostics(diagnosticCriteria)(0)

            diagnosticOverride = New ManagementPackDiagnosticPropertyOverride(mp, _

            diagnosticOverride.Diagnostic = diagnostic
            diagnosticOverride.Property = ManagementPackWorkflowProperty.Enabled
            diagnosticOverride.Value = "false"
            diagnosticOverride.Context = monitoringClass
            diagnosticOverride.DisplayName = "SampleDiagnosticOverride"


            ' Save the changes into the management pack.

        End Function
    End Class
End Namespace