次の方法で共有


How to Create a Knowledge Article

Applies To: System Center 2012 - Operations Manager

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

A knowledge article contains custom information aimed at helping a user of the Operations Manager Operations Console or the Web Console. Knowledge articles are added to a management pack or an element of a management pack, such as a monitor, a discovery object, or a rule, by using the ManagementPackKnowledgeArticle class. The knowledge article is written in HTML, and it can contain specific information about the element or management pack that it is associated with.

The following code example creates a knowledge article for a rule:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using System.Collections.ObjectModel;

namespace SDKSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            ManagementGroup mg = new ManagementGroup("localhost");
            ManagementPack defaultMP = mg.ManagementPacks.GetManagementPacks(new ManagementPackCriteria("ID='Microsoft.SystemCenter.OperationsManager.DefaultUser'"))[0];

            ManagementPackRuleCriteria ruleCriteria = new ManagementPackRuleCriteria("DisplayName = 'SQL User Connections'");

            ManagementPackRule rule = null;
            try
            {
                rule = mg.Monitoring.GetRules(ruleCriteria)[0];
            }
            catch (ArgumentOutOfRangeException)
            {
                Console.WriteLine("Error: Could not retrieve the specified rule.");
                return;
            }
            
            ManagementPackKnowledgeArticle article = 
                new ManagementPackKnowledgeArticle(rule, "ENU", defaultMP);
            article.HtmlContent = 
                "<html><body>This is a placeholder for a knowledge article</body></html>";

            defaultMP.AcceptChanges();
        }
    }
}      

See Also

Other Resources

Automating Operations Manager Administration