I always use bash scripts on the other hosts, started by cron, and publish the results to mqtt.
For example, this monitors if a script in a screen session is running.
#!/bin/bash
SCR_NAME='E3DC2MQTT'
MQTT='192.168.77.67'
TOPIC="home/sensors/$(hostname)/e3dc2ha_daemon"
if /usr/bin/screen -ls | grep $SCR_NAME >> /dev/null; then
PAYLOAD='on'
else
PAYLOAD='off'
/srv/e3dc/init.sh start &
fi
/usr/bin/mosquitto_pub -t "$TOPIC" -m "$PAYLOAD" -h "$MQTT"
Good idea… but I checked it, and every cycle it read just the last line… if in between the check cycle an error pops up, and after that a succes, it will not be visible…