[init] initial commit
This commit is contained in:
12
alert/docker_alarm.sh
Normal file
12
alert/docker_alarm.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker ps -a --format "table {{.Names}}\t{{.Status}}" > /opt/logs/docker_status.log
|
||||
while read line; do
|
||||
echo $line | grep -q 'Exited'
|
||||
if [[ $? -eq 0 ]]; then
|
||||
name=`echo $line | awk '{print $1}'`
|
||||
alarm="Docker Alarm - $name:\nContainer $name has been off line, please check ASAP."
|
||||
bash /opt/scripts/alert/sendmsg.sh "$alarm"
|
||||
fi
|
||||
done < /opt/logs/docker_status.log
|
||||
|
Reference in New Issue
Block a user