Custom UDM
In our previous article, we developed PerformanceMetricsMBean and registered it with the MBean Server. The next step is to write the UDM so that the metrics collected by the PerformanceMetricsMBean can be used to display in OVPM or OVPI.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE MetricDefinitions SYSTEM "MetricDefinitions.dtd"> <!-- sample UDM metrics configuration File --> <MetricDefinitions> <Metrics> <Metric id="WLSSPI_0701" alarm="no" previous="no" report="yes"> <MBean instanceType="single"> <FromVersion server="6.0" update="1"/> <ObjectName>*:name=PerformanceMetrics</ObjectName> <Attribute>responseTime</Attribute> </MBean> </Metric> <Metric id="WLSSPI_0702" alarm="no" previous="no" report="yes"> <MBean instanceType="single"> <FromVersion server="6.0" update="1"/> <ObjectName>*:name=PerformanceMetrics</ObjectName> <Attribute>hostName</Attribute> </MBean> </Metric> </Metrics> </MetricDefinitions>
This code is the UDM for the metrics that we want to be graphed in OVPM. The UDM syntax and structure is governed by the MetricsDefintion.dtd file. The WLS-SPI validates the UDM using the MetricDefintions.dtd. The MetricDefinitions.dtd file consists of the MetricDefinitions, Metric, MBean, FromVersion/ToVersion and Calculation/Formula elements.
The MetricDefinitions element, which is the top-level element, contains one collection of metrics—consisting of one or more metric definitions. The metric element represents one metric and has a unique id. In the UDM above, there two metric elements for two metrics: responseTime with ID WLSSPI_701 and hostName with ID WLSSPI_0702. If the metric is a reporting or graphing or alarming metric, the convention followed for an ID is that it should begin with WLSSPI_0xxx, where xxx should be a number from 700 through 799. If the metric is used only within the calculation of another metric, the ID must begin with a letter (it is case-sensitive). If the metric value is to be sent to the agent, the alarm attribute is set to yes. Similarly, if the metric value is logged for reporting or graphed, the report and graph attributes are set to yes. If the previous attribute is set to yes, the metric value is saved in a history file so that deltas can be computed.
In the UDM, the MBean element is used when the data source of the metric is an attribute of MBean. The MBean element in the UDM contains the FromVersion, ObjectName, and Attribute elements; and the InstanceType attribute. The InstanceType attribute indicates whether there can be multiple instances of this MBean. The FromVersion element indicates the lowest server version supported by this metric. There are two attributes to this element: a server attribute that specifies a primary server version in the UDM (that is, 6.0), and another attribute called update that specifies a secondary server version. A 1 for a service pack 1 or a * indicates that no secondary server version is specified. The ObjectName element is the JMX complaint object name of the MBean in this example and is the PerformanceMetrics MBean. The Attribute element specifies the name of the MBean's attribute name that needs to be graphed in OVPM.
Assuming that the required configuration tasks are performed to integrate the OVPM/OVPI and Weblogic, the operations personnel can view the JMX-based instrumented metrics on OVPM in graphical format. OVPM provides certain predefined graph templates that can be readily used to view the metrics. Using OVPI, the metrics data can be saved to a persistent store, and custom screens can be programmed to output the data based on the requirement.