Create a metric

Create a metric definition for a task table.

  1. Navigate to Metrics > Definitions.
  2. Click New.
  3. Complete the Metric definition form then click Submit.
    Table 1. New metric definitions
    Field Description
    Number The system generates a unique record number for the metric definition.
    Name Enter a unique name to describe what metrics are collected.
    Table

    Select the table that you want to collect metrics for. A metric can only apply to one table.

    Note: The list shows only tables and database views that are in the same scope as the metric definition
    Field Select the table column you want to monitor for changes. Metrics only work on audited fields. Creating a metric for non-audited field produces unreliable metrics.
    Type Select what values this metric generates.
    • Field value duration: This type of metric measures the duration of time from when the value of the specified field is set until it is changed. A Field value duration metric can optionally specify a script. The script can either return a duration value or set the answer variable to false to stop processing the metric. For example, the baseline incident metrics stop calculating duration when the Active field of an incident is set to false. The script can also carry out any other action such as closing the duration of other metrics defined on the same record. See the example script for more information.
    • Script calculation: This type of metric creates a metric instance using a script. The script has access to the current row in the table (for example an incident) and the metric definition. The script can then perform any calculation and insert data into the metric_instance table. The calculation does not have to result in a duration. It can calculate any type of value and store it in the metric instance value.
    Timeline Check this box to display the metric on a timeline.
    Active Check this box to monitor changes for this metric.
    Description [Optional] Specify what data the metric monitors and it's conditions.
    Script Enter the script you want the metric to run to either calculate a duration or perform some calculation on the metric_instance table.
    Note: In the base system, metrics are configured to work on the task table only. To apply metrics to cmdb_ci tables, duplicate the metric events business rule that currently runs on the task table for the cmdb_ci table. Without the events created, no metric processing can occur.