System Monitoring - How does yours look?

Currently setting up my System Monitoring page, got quite some data here, so I decided to split it in multiple views.

Started with the Home Server view, heavily inspired by @jimpower’s awesome work.

What do you guys think?

11 Likes

I enabled up making a whole dashboard for system monitoring.

How are you getting the CPU and RAM for your addons/docker containers?

I have a shell script running on the host that posts to mqtt ,that checks whether I’m running the latest docker containers and started to include ram and cpu there, until I found this nice little custom_component.

Did you ever find a solution for a reliable influxdb database size sensor? I’ll probably extend my shell script on the host to check the the used size of the mapped volume, but I hope there’s a more elegant solution.

Ah ok, not applicable to HassOS/supervised by the looks of it.

No, not yet.

hi, can you share your Lovelace code and automation? thank you

Hello! I still not finished yet, but I’m at a good point to share it =)

I have 2 main views for System and Devices connected to HA:

Then each information has a “subview” with some details:

Subview



4 Likes

Hi there!

I’ve got my setup on GitHub here: https://github.com/pqpxo/SWAKES_hassio

1 Like

Hi there,

How do you get those RPI informations? Like the DB, SSL, version, update? Thanks…

The DB is probably the file sensor integration and SSL probably the certificate expire integration and the version and the versions through the version integration

Thank you for the informations…

Cool, how do you retrieve latest docker images versions?

I use a shell script on the host that compares the digest of the local image with the digest of the remote image and publishes the info to MQTT afterwards. A cronjob runs it once every hour. Let me know if you want more details or the script.

2 Likes

I got it to work on a supervised install.

Follow this guide to modify the docker settings on the host system.
Then installed Monitor docker through HACS.

monitor_docker:
  - name: Docker
    url: tcp://192.168.1.79:2375

After a restart I got plenty of sensors to play with.

1 Like

Its seems that file sensor doesnt work. It wont allow to read the info

Did you add the directory to the allow_external_dirs as mentioned in the docs?

Got it… my bad…Thanks again

I would be very interested in the shell script you use for determining whether a new image is available. Could you please share that?

Yes sure, however some remarks.

  • My shell script programming skills are extremly basic
  • You need to use the latest tag for your images for this script to work
  • There may be docker images for which it doesn’t work

This is the shell script, it takes a .txt file as an input (see example later).
The script publishes “Error” if the local or the remote digest can not be found, it publishes “Update available” if the local digest is not equal to the remote digest and it publishes “Up-to-Date” if the local digest matches the remote digest.
You need to replace “username” and “password” with your credentials to log in to the MQTT broker in the second last line (was to lazy to make it a parameter).

#!/bin/bash
# Example usage:
# ./check_docker_latest.sh check_docker_list.txt

IMAGES="$1"

LINES=$(cat $IMAGES)

for LINE in $LINES
do
    NAME=$(echo $LINE | cut -f1 -d,)
    REMOTE_IMAGE=$(echo $LINE | cut -f2 -d,)
    LOCAL_IMAGE=$(echo $LINE | cut -f3 -d,)
    # Get token
    token=$(curl --silent "https://auth.docker.io/token?scope=repository:$REMOTE_IMAGE:pull&service=registry.docker.io" | jq -r '.token')
    # Get remote checksum
    digest=$(curl --silent -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
            -H "Authorization: Bearer $token" \
            "https://registry.hub.docker.com/v2/$REMOTE_IMAGE/manifests/latest" | jq -r '.config.digest')
    # Get local checksum
    local_digest=$(docker images -q --no-trunc $LOCAL_IMAGE:latest)
    # Check remote against local checksum
    if [[ $digest != sha256* ]] || [[ $local_digest != sha256* ]]; then
           payload="Error"
    elif [ "$digest" != "$local_digest" ] ; then
           payload="Update available"
    else
           payload="Up-to-date"
    fi
    # publish result to MQTT
    mosquitto_pub -h localhost -t "docker-image-updates/$NAME" -m "$payload" -u "username" -P "password" -r
done

And here’s my example for the .txt input file:

mosquitto,library/eclipse-mosquitto,eclipse-mosquitto
esphome,esphome/esphome,esphome/esphome
grafana,grafana/grafana,grafana/grafana
influxdb,library/influxdb,influxdb
unifi-poller,golift/unifi-poller,golift/unifi-poller
portainer,portainer/portainer,portainer/portainer

Each line represents one image. Each line has three values separated by a comma, the first value is the name of the MQTT topic that the info will be published to, the second value is the remote repository and the third value is the local repository.

E.g. for InfluxDB
I choose influxdb as the MQTT topic name. The remote repository can be found here in the section "Quick reference (cont.) under the title “image-updates” -> library/influxdb. The local repository is what I defined in docker-compose in the field “image”-> influxdb

  influxdb:
    container_name: influxdb
    environment:
      - INFLUXDB_DB=smart_home
      - INFLUXDB_ADMIN_USER=username
      - INFLUXDB_ADMIN_PASSWORD=supersecretpassword
    image: influxdb:latest
    ports:
      - "8086:8086"
    restart: unless-stopped
    volumes:
      - ./influxdb:/var/lib/influxdb
      - /etc/localtime:/etc/localtime:ro

I hope to find a better solution at one point, but for the moment this satisfies my needs. Let me know in case you have any questions or anything should be unclear.

3 Likes

Sounds like a great feature request for the monitor_docker dev(s)? :slight_smile:

2 Likes

Hi! In your config setup i don’t find the image for unifi network (usg, ap, switch). I tried to download from google with png format, but I don’t visualise correct. So, can you share the image? Thanks