Interfaces that return monitor data in XML documents
Some monitor data is reported as elements in XML documents.
- You can use XQuery to run queries against the XML document.
- You can use the XSLTRANSFORM scalar function to transform the document into other formats.
- You can view their contents as formatted text by using built-in MON_FORMAT_XML_* formatting functions, or the XMLTABLE table function.
Monitor table
functions with names that end with _DETAILS
Examples
of these table functions include:- MON_GET_PKG_CACHE_STMT_DETAILS
- MON_GET_WORKLOAD_DETAILS
- MON_GET_CONNECTION_DETAILS
- MON_GET_SERVICE_SUBCLASS_DETAILS
- MON_GET_ACTIVITY_DETAILS
- MON_GET_UNIT_OF_WORK_DETAILS
- APPLICATION_HANDLE
- MEMBER
- DETAILS


The schema for the XML document that is returned in the DETAILS column is available in the file sqllib/misc/DB2MonRoutines.xsd. Further details can be found in the file sqllib/misc/DB2MonCommon.xsd.
Some of the monitor elements contained in the document in the DETAILS column might be grouped into higher-level document elements. For example, monitor elements that report on activity-related metrics are part of the activity_metrics element. Similarly, system-level metrics are part of the system_metrics element.
XML data returned by event monitors
Several event monitors return data in XML format. They are summarized in Table 1. Details about the XML documents returned by the various event monitor are described in the sections that follow.Event monitor | Event monitor output format | XML document returned1 |
---|---|---|
Statistics event monitor | Relational table File Named pipe |
|
Activity event monitor | Relational table File Named pipe |
details_xml |
Package cache event monitor | Unformatted event (UE) table | metrics This document can be viewed only after the UE table is transformed to either XML or relational tables. |
Unit of work event monitor | Unformatted event (UE) table | metrics This document can be viewed only after the UE table is transformed to either XML or relational tables. |
Statistics event monitor
The statistics event monitor records metrics in XML format when either of the two following logical data groups are included in the event monitor output:- EVENT_SCSTATS
- EVENT_SUPERCLASSSTATS
- EVENT_WLSTATS


In addition to viewing system metrics from the XML document in the metrics monitor element, you can view the individual metrics directly from the output associated with the EVENT_SCMETRICS, EVENT_SUPERCLASSMETRICS and EVENT_WLMETRICS logical data groups.
- The system_metrics element that is reported in the details_xml document contained in the DETAILS_XML column produced by the statistics event monitor is also a part of the XML document contained in the DETAILS column returned by the MON_GET_SERVICE_SUBCLASS_DETAILS and MON_GET_WORKLOAD_DETAILS table functions. Like the metrics reported in the details_xml document, the values for the metrics reported in the document contained in the DETAILS column accumulate until the database is deactivated.
- See Information written to XML for system_metrics and activity_metrics monitor elements for the schema for the XML output from a statistics event monitor.
Activity event monitor
When you create an activity event monitor to report on monitor elements in the event_activity logical data group (see event_activity logical data group), one of the columns produced is DETAILS_XML. If the event monitor is written to a table, DETAILS_XML is a column. If it is written to a file or named pipe, DETAILS_XML is part of the self-describing data stream. Either way, the document contains the activity_metrics monitor element, which, in turn, contains a number of monitor elements that report on metrics related to activities. See Information written to XML for system_metrics and activity_metrics monitor elements for the schema for the XML output from an activity event monitor.Package cache event monitor
The package cache event monitor writes its output to an unformatted event (UE) table. If you convert the data in this table with the EVMON_FORMAT_UE_TO_TABLES table function, one of the tables produced is PKGCACHE_EVENT. This table contains a METRICS column. In each row, this column contains an XML document with elements associated with package cache event monitor elements.The EVMON_FORMAT_UE_TO_XML function also produces an XML document with elements associated with package cache event monitor elements. For example, the XML document element <num_executions> corresponds to the num_executions monitor element. See Information written to XML for a package cache event monitor for the schema for the XML output from a package cache event monitor.
Unit of work event monitor
The unit of work event monitor writes its output to an unformatted event (UE) table. If you convert the data in this table with the EVMON_FORMAT_UE_TO_TABLES table function, one of the tables produced is UOW_EVENT. This table contains a METRICS column, which contains an XML document with elements associated with unit of work event monitor elements.The EVMON_FORMAT_UE_TO_XML function also produces an XML document with elements associated with unit of work event monitor elements. For example, the XML document element <workload_name> corresponds to the workload_name monitor element. See Information written to XML by EVMON_FORMAT_UE_TO_XML for a unit of work event monitor for the schema for the XML output from a unit of work event monitor.