Hi there,
How do you get those RPI informations? Like the DB, SSL, version, update? Thanks…
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.
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.
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.
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.
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
Indeed. I was discussing this a while ago with @philhawthorne who created HA Dockermon. It is a very interesting feature, which I think many users would like to have.
The problem is that it seems that it does not work with all the images. In my limited testing I couldn’t get it to work for deconz and ozwdaemon for example. But could as well be that I did something wrong. I’ll open an issue on the monitor docker repo and see if I can discuss it with the dev.
Edit: Opened an issue here
First of all, @Burningstone, ty for your post with the script, it inspired me to do the same.
I tried to set this up, started with the unifi-controller as is runs outside my supervised install.
Couldn´t get it to work though, ends up with a error payload to mqtt.
Would you mind taking a look?
Sure I can take a look at it later today/during the weekend
Try changing your docker_check_list.txt to
unifi,ryansch/unifi-rpi,ryansch/unifi-rpi
The thrid parameter is the field image:
in your docker-compose file minus the :latest
, which is ryansch/unifi-rpi
not unifi
.
Yeah, that did it, that was the culprit. Ty!
Are you running all those docker containers in your example outside of HA supervisor?
I’m on a supervised install and supervisor is controlling them for me, I can’t really get information about versions with the script for those containers, right?
I just have a few that I manage with docker-compose myself, unifi and portainer.
Any ty for your great exemple, you don’t happen to have the code that system view up on github or so?
I don’t run Supervised, I run Home Assistant Container.
I’m currently checking this on a test instance that runs Supervised, will see if I get it to work.
My repo is here, however, I haven’t uploaded the system monitoring, need to write the guide on how to get the sensors etc. first, but should be there in the next 2-3 weeks.