Good morning,
today I wrote a script to monitor the services on a docker host.
You'll get a warning if a container is dead which should be running.
Just move the script to /var/prtg/scripts and create a new sensor "SSH Scripts"
Dont forget to execute chmod +x !
#!/bin/sh
#Variables
hostname="`cat /etc/hostname`"
#MAIN
deadcontainer="`docker service ls --format {{.Name}}:{{.Replicas}} | grep '0/1' | cut -d':' -f1`"
if [ "$deadcontainer" == "" ]; then
echo "0:1:All container are running"
exit 0
else
for i in $deadcontainer; do
echo "1:0:$deadcontainer is not running"
exit 1
done
fi
Have fun!
Awesome, thanks for sharing! :)
PRTGapi | Feature Requests | SNMP Issues
Kind regards,
Stephan Linke, Tech Support Team
Jul, 2019 - Permalink