# Metric monitor

The integration called metric-monitor is a Lynx component that can be installed and configured to monitor devices and functions for old data. The main usage of this is to tell if the device has become unresponsive. This is done by configuring a time interval where the function or device should have sent at least one message.

# Configuration

Configuration of the metric monitor is done using meta-data on either functions or devices.

Note: Only the MQTT topic in topic_read will be monitored.

# Format

Key: metric_monitor.max_silent_time

The metric-monitor reads this value as a duration of time as specified by golang:s standard duration parser (opens new window). This means that the biggest time unit that can be specified is in h (hour).

# On a Function

When set on a function only that function is monitored. The event is still triggered as expected for that function and the resulting meta is applied to the function.

# On a Device

When set on the device the metric-monitor wil monitor all functions connected to that device. This mainly used for devices that might not report every value on updates. An example would be a smoke-sensor that would normally update battery every 24h but not the other values.

The resulting meta-data will be set on the device and not the functions.

# Result

The metric monitor uses meta-data to mark functions or devices that have met the threshold configured by the user. It also uses MQTT to create an event when status for an object is updated.

# Meta-data

The metric-monitor will set two meta-data keys on objects that it detects with too old data.

The keys metric_monitor.status and metric_monitor.status_text will be set to the following settings.

Status Text
0 OK
1 Warning
2 Critical

# Event

An event will be published on MQTT on the topic <client_id>/evt/metric-monitor/status_updated when changes to the status is detected. It is recommended to subscribe to this topic to trigger notifications or other functionality. The following describes the structure that the metric-monitor sends in the event MQTT message.

  "installation_id": 1,
  "object_type": "device",
  "object_id": 1,
  "timestamp": 1644930810