locked
SCOM Override RRS feed

  • Question

  • Hi guys,

    I need write C# code for scom. I use SDK and I have question.

    This is code from

    https://msdn.microsoft.com/en-us/library/bb960482.aspx

    System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Text;
    using Microsoft.EnterpriseManagement;
    using Microsoft.EnterpriseManagement.Administration;
    using Microsoft.EnterpriseManagement.Common;
    using Microsoft.EnterpriseManagement.Configuration;
    using Microsoft.EnterpriseManagement.Monitoring;
    
    namespace SDKSamples
    {
        class Program
        {
            //---------------------------------------------------------------------
            static void Main(string[] args)
            {
                ManagementGroup                         mg;
                ManagementPack                          mp;
                MonitoringClassCriteria                 classCriteria;
                MonitoringClass                         monitoringClass;
                MonitorCriteria                         monitorCriteria;
                ManagementPackMonitor                   monitor;
                ManagementPackMonitorPropertyOverride   monitorOverride;
    
                mg = new ManagementGroup("localhost");
    
                mp = mg.GetManagementPacks("OverrideTestMP")[0];
    
                classCriteria = new MonitoringClassCriteria("Name='Microsoft.SQLServer.2005.Database'");
    
                monitoringClass = mg.GetMonitoringClasses(classCriteria)[0];
    
                monitorCriteria = new MonitorCriteria("DisplayName='Database Status'");
    
                monitor = mg.GetMonitors(monitorCriteria)[0];
    
                monitorOverride = new ManagementPackMonitorPropertyOverride(mp, "SampleMonitorOverride");
    
                monitorOverride.Monitor     = monitor;
                monitorOverride.Property    = ManagementPackMonitorProperty.Enabled;
                monitorOverride.Value       = "false";
                monitorOverride.Context     = monitoringClass;
                monitorOverride.DisplayName = "SampleMonitorOverride";
    
                mp.Verify();
                
                //Save the changes into the management pack.
                mp.AcceptChanges();
            }        
        }
    Why i can use monitoring class for create override? I founded managementpack without classes and i get error with this sample of code. Can I make override without classes if I can how?

    Tuesday, September 1, 2015 8:26 PM

Answers

  • Hello Mark1805, the purpose of this forum is to support the Open Specifications documentation. You can read about the Microsoft Open Specifications program from http://www.microsoft.com/openspecifications/en/us/default.aspx
    The library of Open Specification documents can be accessed from http://msdn.microsoft.com/en-us/library/dd208104(PROT.10).aspx
    Your question may be more applicable to this forum,


    https://social.technet.microsoft.com/Forums/en-US/0b58edbd-8b7e-4630-9579-9850918b2606/scom-2012-sdk?forum=operationsmanagerdeployment


    Regards,
    Sreekanth Nadendla
    Microsoft Windows Open specifications

    Wednesday, September 2, 2015 1:49 AM