Skip to main content

Metric

A metric represents a single data value provided by a plugin, such as a CPU temperature or the name of the operating system.
Each metric has a core or custom MetricType, which defines the kind of value and its units, and always belongs to a Category.

A metric only describes the data. Its actual value is pushed separately as a MetricValue.

See also: Registering Items, Updating Metric Values

Properties

PropertyTypeRestrictionsDescription
IdstringRequired
Length: 1 - 256
Pattern: ^[\w\.\-]+$
The unique identifier of the metric.
LabelstringRequired
Length: 1 - 64
The textual label of the metric. Longer labels are truncated.
TypeIdstringRequired
Length: 1 - 256
Pattern: ^[\w\.\-]+$
The type of this metric: a core type or the ID of a registered MetricType.
CategoryIdstringRequired
Length: 1 - 256
Pattern: ^[\w\.\-]+$
The category of this metric: a core category or the ID of a registered Category.
IsStaticboolDefault: falseWhether the value of the metric is static. See Static and Dynamic Metrics.
Descriptionstring?Max length: 256An optional textual description of the metric.
GroupIdstring?Length: 1 - 256
Pattern: ^[\w\.\-]+$
An optional group the metric belongs to (the ID of a registered Group).

Static and Dynamic Metrics

  • Dynamic metrics (the default) change over time, e.g. CPU usage or a temperature. Their values are typically updated periodically using the scheduler.
  • Static metrics have a value that does not change until the next system reboot, e.g. the name of the CPU or the operating system. Mark them with .AsStaticValue() and set their value only once.

Creating a Metric

Metrics are created using the MoBroItem.CreateMetric() builder, which guides you through all required properties in the following order:

  1. WithId(id)
  2. WithLabel(label) or WithLabel(label, description)
  3. OfType(...) — a CoreMetricType, a CoreMetricTypeCurrency, a registered MetricType or its ID
  4. OfCategory(...) — a CoreCategory, a registered Category or its ID — or OfNoCategory() for CoreCategory.Miscellaneous
  5. OfGroup(...) — a registered Group or its ID — or OfNoGroup()
  6. Optional: AsStaticValue() or AsDynamicValue()
  7. Build()
var cpuName = MoBroItem
.CreateMetric()
.WithId("cpu_name")
.WithLabel("CPU Name", "The model name of the processor")
.OfType(CoreMetricType.Text)
.OfCategory(CoreCategory.Cpu)
.OfNoGroup()
.AsStaticValue()
.Build();