Pegasus Enhancement Proposal (PEP)
PEP #: 206
Title: System Log Indication Handler
Version: 1.3
Created: 27 October 2004
Authors: Yi Zhou
Status: Approved
Version History:
Version | Date | Author | Change Description |
---|---|---|---|
1.0 | 27 October 2004 | Yi Zhou | Initial Submission |
1.1 | 19 November 2004 | Yi Zhou | Updated based on 11/2/04 comments. |
1.2 | 24 November 2004 | Yi Zhou |
|
1.3 | 1 December 2004 | Yi Zhou | Updated the PEP based on 11/30/04 comments. |
Abstract: This PEP proposes the addition of a new Indication Handler to OpenPegasus release 2.5. The System Log Indication Handler is being proposed to enable CIM indications to be delivered to a system log file.
System Log facility (e.g. syslog) is already widely used in Pegasus. However, Pegasus currently does not support event notification delivery to system log file.
This PEP proposes to define a new type of Indication Handler, System Log Indication Handler. The System Log Indication Handler will allow indications to be delivered to a system log file.
The proposed solution will meet following requirements:
The proposal would require the following changes:
// ==================================================================== // PG_ListenerDestinationSystemLog // ==================================================================== [Description ( "PG_ListenerDestinationSystemLog is used to support event notification " "delivery to a system log file")] class PG_ListenerDestinationSystemLog: CIM_ListenerDestination { };
// ==================================================================== // CIM_FormattedIndicationSubscription // ==================================================================== [Association, Version ( "2.8.1000" ), Experimental, Description ( "A subclass of IndicationSubscription that defines the " "text formatting of Indication information. The " "TextFormatOwningEntity, TextFormatID, TextFormat, and " "TextFormatParameters properties are used to describe " "a human-readable representation of the Indication as " "defined by the referenced CIM_IndicationFilter. This " "representation MAY be used by the CIM_ListenerDestination " "when the intended consumer of the Indication is human. " "For example, this format could be used when writing the " "Indication to a system log or sending an e-mail " "notification to a system administrator.")] class CIM_FormattedIndicationSubscription : CIM_IndicationSubscription [Description ( "The TextFormatOwningEntity is a string that uniquely " "identifies the entity that owns the definition of " "the human-readable format described in this instance. " "OwningEntity MUST include a copyrighted, trademarked " "or otherwise unique name that is owned by the business " "entity or standards body defining the format."), ModelCorrespondence { "CIM_FormattedIndicationSubscription.TextFormatID", "CIM_FormattedIndicationSubscription.TextFormat", "CIM_FormattedIndicationSubscription.TextFormatParameters"} ] string TextFormatOwningEntity; [Description ( "An opaque string that uniquely identifies, within the scope " "of the TextFormatOwningEntity, a human-readable format " "for representing the Indications described by this " "Subscription."), ModelCorrespondence { "CIM_FormattedIndicationSubscription.TextFormatOwningEntity", "CIM_FormattedIndicationSubscription.TextFormat", "CIM_FormattedIndicationSubscription.TextFormatParameters"} ] string TextFormatID; [Description ( "A string describing the human-readable format for " "representing the Indications described by this " "Subscription. The actual text is constructed by applying " "the dynamic content, defined in the Indication, to the " "string specified in this property. /n /n The dynamic " "content is specified by embedding the following syntax in " "the appropriate places in the format string: \n" "\"{\" <index >["["[<index>]"]"],<type>\"}\" \n" "- the first occurrence of <index> defines the element " "of TextFormatParameters that contains the name of the " "Indication property to be used to populate the text " "message.\n" "- if the Indication property defined by the first <index> " "is an array property, then the first index MUST be followed " "by either empty brackets (i.e., []) or an index value " "enclosed in brackets (e.g., [1]). If empty brackets are " "specified (e.g., {4[], string}), then the dynamic content " "of the text message is populated with a list of the array " "elements. If an index is specified (e.g., {4[1], string}, " "then only the specified array element is used to populate " "the message. If the value of the dynamic content is not " "defined in the Indication, then the string \"UNKNOWN\" " "is used to populate the text message.\n" "-defines the type of the dynamic content. Valid " "values for are: \'boolean\', \'string\', \'char16\', " "\'uint8\', \'sint8\', \'uint16\', \'sint16\', \'uint32\', " "\'sint32\', \'uint64\', \'sint64\', \'datetime\', " "\'real32\', \'real64\' or \'ref\'. \n" "\n" "As an example, a format string for a UPS AlertIndication " "could be defined as follows: \"A {4,string} UPS Alert of " "type {5,uint16} was detected on the device {6,string} on " "the system {2,string} at {1,datetime}. The following " "actions have been recommended to resolve the alert: " "{3[],string}\".")] ModelCorrespondence { "CIM_FormattedIndicationSubscription.TextFormatOwningEntity", "CIM_FormattedIndicationSubscription.TextFormatID", "CIM_FormattedIndicationSubscription.TextFormatParameters"} ] string TextFormat; [Description ( "An indexed array containing the names of properties defined " "in the select clause of the associated CIM_IndicationFilter " "Query. The values of these Indication properties are used " "to populate the dynamic content of the text message."), ArrayType ( "Indexed" ), ModelCorrespondence { "CIM_FormattedIndicationSubscription.TextFormatOwningEntity", "CIM_FormattedIndicationSubscription.TextFormatID", "CIM_FormattedIndicationSubscription.TextFormat"} ] string TextFormatParameters []; };
PerceivedSeverity Pegasus LogLevel ==================== ======================== Fatal/NonRecoverable ===> Logger::FATAL Critical ===> Logger::FATAL Major ===> Logger::SEVERE Minor ===> Logger::WARNING Degraded/Warning ===> Logger::WARNING Information ===> Logger::INFORMATION Other ===> Logger::INFORMATION Unknown ===> Logger::INFORMATIONIf PEGASUS_USE_SYSLOG is defined, the System Log Handler passes the Pegasus severity to System::syslog and there is a mapping in System::syslog from Pegasus severity to syslog error severity today.
The class is as follows: class PEGASUS_COMMON_LINKAGE IndicationFormatter { public: String formatIndicationText( const String & textFormat, const ArrayThe formatting and details of an event are based on both property values of TextFormat and TextFormatParameter in a CIM_FormattedIndicationSubscription instance. If the property TextFormat is not found, or the value of TextFormat is Null, or the value of TextFormat has a syntax error, received indication will be written in the system log entry with default format and with a pretext: "Indication (default format):".& textFormatParams, const CIMInstance & indicationInstance, const ContentLanguages & contentLangs) private: ... ... };
The default format looks like:
For example, if a query is "SELECT IndicationIdentifier, IndicationTime FROM..." The default formatted indication looks like:
The new interface is as follows: virtual void handleIndication( const OperationContext& context, const String& nameSpace, CIMInstance& indicationInstance, CIMInstance& indicationHandlerInstance, CIMInstance& indicationSubscriptionInstance, ContentLanguages& contentLanguages) = 0;
The interface is as follows: void _writeToSystemLog( const String & identifier, Uint32 severity, const String & formattedText)Note: severity parameter in the _writeToSystemLog function is Pegasus logger severity. If PEGASUS_USE_SYSLOG is defined, the function _writeToSystemLog will write the formatted indications into the system log file by calling System::syslog() (System::syslog() is already mapping Pegasus severity to syslog error severity today). Otherwise, the formatted indications will be written into PegasusStandard.log file which is defined in the Logger.cpp. Platform maintainers may add support for other system log mechanisms into this function.
Action | Planned | Actual | Comment |
PEP Submitted | 10/27/04 | 10/27/04 | |
PEP Reviewed | 11/12/04 | 11/02/04 | |
PEP Approved | 11/19/04 | 12/03/04 | |
Code Committed | Pegasus 2.5 FC | 2/25/05 |
Copyright (c) 2004 EMC Corporation; Hewlett-Packard Development Company, L.P.; IBM Corp.; The Open Group;
VERITAS Software Corporation
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without
limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the following conditions:
THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN ALL
COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.