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 metadata 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 Go's standard duration parser. 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 will monitor all functions connected to that device. This is 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 metadata will be set on the device and not the functions.
Result
The metric monitor uses metadata 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.
Metadata
The metric-monitor will set two metadata 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 values.
| 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 are 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
}