Zum Hauptinhalt springen

Supervision hôte Smart-Home-Integration, kostenlos und Open Source

Supervision hôte-Integration für Gladys Assistant

Reports the CPU, memory, disk usage and CPU temperature of the machine running Gladys.

Info

Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.

This integration creates one device in Gladys, representing the machine Gladys runs on, with five sensors:

SensorUnitSource
CPU usage%/proc/stat
Memory usage%/proc/meminfo (MemAvailable)
Disk usage%statfs() on the monitored path
Free disk spaceGiBstatfs() on the monitored path
CPU temperature°C/sys/class/thermal or hwmon

Everything is read locally, on the machine: no agent to install, no cloud service, no data leaving your home.

Installation​

Requires Gladys 5.1 or later. On an older version the integration simply does not appear in the catalog: update Gladys first.

  1. Install the integration from the Gladys catalog (category Services).
  2. Open the Configuration tab and save (the defaults are fine for the vast majority of setups).
  3. Go to the Discovery tab: the "Machine hôte" device shows up, click Add.

The first values are published within seconds, then every 5 minutes.

Refresh rate and database size​

This is the point that shapes the whole integration. Gladys writes one history row for every published value: there is no server-side deduplication. A system monitor publishing 5 metrics every 30 seconds writes roughly 5 million rows a year, the vast majority of them repeating the previous value. On a Raspberry Pi with an SD card, that costs both space and write endurance.

Three guardrails, all tunable in the Configuration screen:

  • Refresh interval (300 s by default, 60 s minimum) — how often the metrics are read. The integration runs its own timer: it does not use the Gladys scheduler, which cannot go slower than one read per minute.
  • Minimum variation (2 percentage points / 1 °C by default) — a value is only published when it moved by at least this much since the last published value. A slow drift therefore always crosses the threshold eventually, while background noise stops filling the database. Set it to 0 to publish everything.
  • Maximum interval without a point (60 min by default) — even when nothing moves, each sensor is published at least once per hour, so the charts keep a continuous line.

With the default settings, a quiet machine typically writes a few dozen rows per day instead of tens of thousands.

The Keep history switch goes one step further: turned off, the sensors still show their live value but write no history row at all. Note that this setting is applied when the device is created; if the device already exists, change it directly on the device page in Gladys (each feature has its own "keep history" checkbox there).

Disk space: which disk is measured?​

A container does not see the host filesystem, it sees its own. The default path /data is the volume Gladys mounts from the host: it is the filesystem holding your Gladys data, so it is the free space that actually matters in practice.

To monitor another mount point, put its path in Disk path to monitor — as long as it is visible from inside the container.

The percentage is computed the way df does: root-reserved blocks are excluded, so a freshly formatted ext4 filesystem reads 0%, not 5%.

CPU temperature​

The sensor is auto-detected among those the kernel exposes under /sys/class/thermal (Raspberry Pi and ARM boards) and /sys/class/hwmon (coretemp on Intel, k10temp on AMD…). Sensors whose name clearly designates the CPU are preferred.

If your machine exposes no sensor at all (virtual machine, LXC container, non-Linux host), the temperature feature is simply not created: the other four keep working.

If the chosen sensor is not the right one, use the List temperature sensors button: it shows every visible sensor with its current reading and marks the one in use with a >. Copy the path you want into CPU temperature sensor.

Available actions​

  • Read the metrics now — reads everything immediately and shows the result under the button, without waiting for the next refresh. This is the first test to run when a value looks wrong.
  • List temperature sensors — see above.

Dashboard widget​

Add the Host health box to a dashboard (box list, integrations section). It shows:

  • three gauges in percent: CPU, memory, disk;
  • the CPU temperature (when a sensor exists) and the free disk space;
  • a CPU / memory / disk history chart;
  • the state of each alert (see below);
  • a Read now button.

The box has a single setting, the chart period (last hour, 24 hours, week, month… or no chart). The chart only shows once the device has been added and keeps its history.

Until the device is added from the Discovery screen, the box still shows the last reading. Once the device is added, the temperature and the chart update live; the three gauges (in whole percents) and the free space (rounded, e.g. 432 GB or 1.8 TB) follow each reading of the integration.

Scenes​

"Host metric alert" trigger​

The integration watches four thresholds, set in the Configuration screen (Alerts for scenes section):

ThresholdDefault
CPU90 %
Memory90 %
Disk90 %
CPU temperature80 °C

Set a threshold to 0 to disable that alert.

When a metric reaches its threshold, the trigger fires once ("Alert raised"). It fires once more when the metric comes back down ("Back to normal"): 5 points under the threshold for the percentages, 3 °C for the temperature. That margin keeps a disk hovering around 90 % from running your scenes at every reading.

In the scene editor you can filter on the metrics (leave empty for all) and on the event (raised, back to normal, or both). These variables are available to the actions of the scene: metric, metric_label, status, value, threshold, unit, device_name and message — a ready-made message, in French, e.g. "Machine hôte : Utilisation disque à 92 % (seuil 90 %)".

Example: "when the disk reaches its threshold → send me a message with message".

Good to know:

  • the alert is checked on every reading, even when the value is not written to the history;
  • the CPU usage is an average over the refresh interval: a spike of a few seconds triggers nothing;
  • after the integration restarts, an alert still in progress is raised again on the first reading.

"Read the host metrics" action​

This action reads every metric when the scene reaches it and makes them available to the next actions: cpu_percent, memory_percent, disk_percent, disk_free_gib, temperature and summary (a one-line summary, in French). A metric that cannot be read is empty, never 0.

Example: "every Monday at 9 am → read the host metrics → send me summary".

The readings go through the same guardrails as the normal refresh: a scene running often does not fill the database.

Troubleshooting​

No value shows up. Check that the device was actually added from the Discovery tab: until it is created, Gladys silently ignores published states. As soon as you add it, the integration publishes a full snapshot again — so the five metrics appear within seconds, without waiting for the next refresh or the next guaranteed point.

The device shows "No recent value". That badge appears when no state has been recorded for 48 hours — so, in practice, never. Use the Read the metrics now action: it ends with "N state(s) published". If N is at least 1, the integration does publish, and the problem is the feature matching described right below.

The device was created by an older version. Gladys never updates the features of a device that already exists: publishing the device again only refreshes its entry on the Discovery screen. A device created with older identifiers therefore keeps them, and the states published for the new ones are dropped without a visible error (the Gladys server logs DeviceFeature "..." not found (or not added to Gladys), skipping state update.). The integration detects this at startup and reports it in the configuration screen. The only fix is to remove the device in Gladys, then add it again from the Discovery screen. That is also how you apply a change to the Keep history option, or make the temperature appear on a device created before the sensor was detected.

The temperature is missing. That is expected on a VM. Use the List temperature sensors action to confirm the kernel exposes none.

The charts look like stairs. That is the intended behaviour: between two published points, the value did not move more than the threshold. Lower the minimum variation for more detail — at the cost of a bigger database.

The values look smoothed. The published CPU usage is the average over the refresh interval, not an instant sample: a 2-second spike inside a 5-minute window stays barely visible. Shorten the interval if you are hunting short spikes.

The integration logs every read. Check the logs from the Gladys interface, with LOG_LEVEL=debug for the full detail.

Konfigurationseinstellungen​

Diese Einstellungen fragt Supervision hôte in seinem Konfigurationsbildschirm in Gladys ab.

EinstellungTypPflichtfeldBeschreibung
Host supervisionsectionNeinOne device exposing the health of the machine that runs Gladys: CPU usage, memory usage, disk usage, free disk space and CPU temperature. Everything is read locally from /proc and /sys, no agent and no cloud service involved.
Device namestringNeinName of the device created in Gladys. Useful when several machines are monitored.
Disk path to monitorstringNeinPath whose filesystem is measured. The default /data is the integration volume, hosted on the same filesystem as your Gladys data.
CPU temperature sensor (optional)stringNeinLeave empty to auto-detect. Otherwise, the sysfs file to read, e.g. /sys/class/thermal/thermal_zone0/temp.
Refresh rate and historysectionNeinGladys writes one history row per published value, so a host monitor left unchecked fills the database fast. The integration reads the metrics on its own schedule and only publishes a value when it moved more than the thresholds below — with a guaranteed point at least once per maximum interval so the charts stay continuous.
Refresh interval (s)numberNeinHow often the metrics are read, in seconds. 300 s (5 minutes) is plenty for host supervision.
Minimum variation (%)numberNeinA percentage reading is only published when it moved by at least this many points since the last published value. 0 publishes every reading.
Minimum variation (°C)numberNeinSame threshold, applied to the CPU temperature.
Maximum interval without a point (min)numberNeinEven when nothing moves, each metric is published at least once per this interval so the charts keep a continuous line.
Keep historybooleanNeinApplied when the device is created. Turn it off to keep only the live values, with no history row at all.
Alerts for scenessectionNeinWhen a metric reaches its threshold, the integration fires the "Host metric alert" scene trigger once, and once more when the metric comes back down. Use it to be notified of a full disk or an overheating CPU. Set a threshold to 0 to disable that alert.
CPU alert threshold (%)numberNeinThe CPU usage is averaged over the refresh interval, so short spikes do not count. 0 disables the alert.
Memory alert threshold (%)numberNein0 disables the alert.
Disk alert threshold (%)numberNein0 disables the alert.
CPU temperature alert threshold (°C)numberNein0 disables the alert. Ignored when no temperature sensor is found.

So installierst du Supervision hôte in Gladys​

  1. Öffne in Gladys Integrationen: Supervision hôte erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
  2. Klicke auf Installieren. Gladys lädt das Docker-Image (ghcr.io/prohand/gladys-host-monitoring:2.0.2) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration).
  3. Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
  4. Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/prohand/gladys-host-monitoring.

Supervision hôte benötigt Gladys >=5.1.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.

Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.

Über externe Integrationen​

Supervision hôte ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von prohand veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.

Abonniere den Newsletter von Gladys Assistant

Ein paar E-Mails im Monat zu neuen Releases und Neuigkeiten aus dem Projekt. Verschickt von Pierre-Gilles Leymarie, dem Gründer des Projekts. Jederzeit abbestellbar 🙂