Implement Automated Analysis and Alerting
System monitoring involves not only measuring and recording metrics but also doing some automated analysis to detect anomalies and create alerts when an action is required.
Pretty graphs and animated icons aside… even the flashiest dashboards get boring on day 3, especially when anomalies are few and far between. Do you really expect to monitor those graphs long-term? How much do you trust yourself to pay close attention and pick up on anomalies when things do fail?
Advertisement Begins
Advertisement End
I’d much rather have a computer do this analysis and alert me with precise, actionable notifications that already contain all the information required to begin further analysis. Introducing…
Alerta – System Monitoring Dashboard
I implemented the system dashboard called Alerta which uses a push approach to monitoring. Rather than pinging devices individually from a central server, Alerta relies on each device checking in periodically with a heartbeat request.
This heartbeat is a simple message saying “Hey I’m still here and operating normally”. If a heartbeat is missed, Alerta automatically generates an alert to indicate a problem with the device. For example, when my security light operates normally, it sends periodic heartbeats to Alerta. Of course, this is only possible when it is operating normally and connected to Wifi. If there is any Wifi issue it is unable to send the heartbeat message. Alerta reacts to this by raising an alert. Should the device start working again, the alert is automatically removed as manual intervention is no longer required.
You can see a sample alert in the images below.
Heartbeat monitoring for Tasmota devices
Kitchen Multi-Timer Pro
Now you’re cooking
Multi Timer Pro is your ultimate meal prep companion, keeping track of multiple cooking times and making adjustments on the fly. Give it a try today and become a better home cook!
My lights run on Tasmota – a popular IoT firmware that hardly needs introduction in the home automation community. Unfortunately, Tasmota is not capable to sending HTTP heartbeat requests itself because it is built on a comprehensive MQTT API. As a workaround, I created a small service called <a href="https://github.com/danobot/alerta-mqtt-gateway" target="_blank" rel="noreferrer noopener">alerta-mqtt-gateway</a>
that listens to specific MQTT topics and relays a heartbeat to Alerta every time a message is received.
The following is an extract from my configuration file. It monitors a Tasmota device on tele/tv_led/STATE
and two RF devices transmitting on home/gw/433toMQTT
.
topics:
tele/tv_led/STATE:
origin: tv_led
timeout: 130
home/gw/433toMQTT:
type: json
attribute: value
listeners:
- value: 2678906
heartbeat:
origin: mtn-living-room
timeout: 604800
tags:
- motion
- value: 13690522
heartbeat:
origin: mtn-living-room-secondary
timeout: 604800
tags:
- motion
Note that you might have to adjust your Tasmota device’s TelePeriod
setting to send status information more frequently. The timeout
value indicates how long Alerta should wait for the next heartbeat before raising an alert.
On the next page, we talk about Home Assistant and Lovelace integration.