Skip to main content

Adding User-Defined Metrics

Adding User-Defined Metrics

You can add user-defined metrics to the History Monitor (SYS.History package):

  1. Create a class, or multiple classes, that inherit from SYS.History.AdaptorOpens in a new tab and add %Numeric properties to define the metrics.

    Note:

    User-written classes must be in the %SYS namespace, and should begin with “Z” or “z” to prevent naming conflicts with system classes and problems during upgrades.

  2. Code the Sample()Opens in a new tab method to instantiate the class and provide periodic values for each property. This method is called when the interval data is collected.

  3. When you compile your class, it is added as an embedded object to an interval persistent class in SYS.History. You can choose where and when it is collected using the INTERVALOpens in a new tab parameter provided in SYS.History.AdaptorOpens in a new tab class. This selects which interval class it is added to and which %Monitor class does the collection, as shown in the following table:

    INTERVAL Selected Interval Class Used %Monitor Class Used
    “User” (default) SYS.History.User %Monitor.System.HistoryUserOpens in a new tab
    “UserPerf” SYS.History.UserPerf %Monitor.System.HistoryPerfOpens in a new tab
    “UserSys” SYS.History.UserSys %Monitor.System.HistorySysOpens in a new tab

    Selecting “UserPerf” or “UserSys” lets you collect data at the same interval and with the same timestamp as SYS.History.PerfDataOpens in a new tab or SYS.History.SysDataOpens in a new tab, which makes it easier to correlate your data with the system data. “User” gives you a choice of a third (unrelated) time interval.

    Note:

    There are several parameters in the SYS.History.AdaptorOpens in a new tab class that provide options for how properties are collected and summarized; for more information, see the SYS.History.AdaptorOpens in a new tab class reference documentation.

  4. User-defined classes are also added as embedded objects to the SYS.History.UserHourly and SYS.History.UserDaily summary classes. The user-defined metrics are summarized and automatically purged just like the system metrics.

    Important:

    User-defined metric classes become embedded objects in persistent data. You should not change definitions after data collection has started: deleting objects can result in orphaned data; re-defining existing classes or properties can cause already stored data to be misinterpreted.

    However, because of the schema evolution feature, you can safely add new objects and properties. See Schema Evolution.

FeedbackOpens in a new tab