Monitoring a server (via MQTT?)

Can HA monitor remote servers for the CPU/GPU temperatures and memory used?

My remote servers are typically Ubuntu.

Any MQTT agent that can be installed on the remote server? Or even better if the protocol is customized to HA, doesn’t have to be MQTT.

thanks, I rewrote my OP to make it clearer. I’m looking to monitor remote servers, not HA itself.

That’s why I posted a link to the System Bridge integration.

It connects to this application:

Even I had the same question in my mind. I wanted to monitor my NUC that’s running firewall. If the temperature goes above threshold value a smart switch May power on DC fan kept near the NuC to provide additional cooling

You can send the temperature from the server to your HA installation either via MQTT or via the API (e.g. curl).

As an example, I’m running this script on my church’s router via cron every five minutes:

#!/bin/bash

export HALLT="MY_LLT"
export IP="`ip addr show dev pppoe0 | grep inet | cut -d\  -f 6`"
export CPU="`/usr/sbin/ubnt-hal getTemp | grep CPU: | cut -d: -f2 | cut -d\  -f1`"
export PHY="`/usr/sbin/ubnt-hal getTemp | grep PHY: | cut -d: -f2 | cut -d\  -f1`"
export LD1="`cat /proc/loadavg | cut -d\  -f1`"
export LD5="`cat /proc/loadavg | cut -d\  -f2`"
export TS="`date -Iseconds`"

curl -k -X POST -H "Authorization: Bearer $HALLT" -H "Content-Type: application/json" \
     -d "{\"state\": \"$IP\", \"attributes\": \
         {\"CPU\": \"$CPU\", \
          \"PHY\": \"$PHY\", \
          \"LD1\": \"$LD1\", \
          \"LD5\": \"$LD5\",
          \"updated\": \"$TS\" }}" \
     https://MY_DOMAIN/api/states/sensor.church_router

MY_LLT is a long-lived access token generated by HA.

1 Like

thanks, i’m pondering between system bridge and the curl script… both have their pros and cons

I’ve got another option you might consider - I wrote a daemon (called dunnart) to monitor my remote Linux boxes in HA via MQTT. It uses MQTT discovery to automatically integrate with HA, so it is pretty easy to setup - the most complicated part is setting up the config to connect to MQTT server.

It is a small standalone executable that is very flexible on what attributes it monitors and how often it sends updates. It can monitor cpu temperature and usage, memory usage, file system usage, network usage… but it will only monitor the attributes you select.

It doesn’t do GPU temps yet, as I typically run it on RPis where that isn’t an issue, but it would be pretty simple to add that option.

GitHub - klattimer/Malaria: A system statistics reporter written in python might be what you’re looking for, I wrote it for dense information reporting.