all the shit
This commit is contained in:
commit
78f788db6f
23
docker-compose.yaml
Normal file
23
docker-compose.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
downdetector:
|
||||||
|
image: debian
|
||||||
|
container_name: down_detector
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ./:/dd
|
||||||
|
|
||||||
|
#entrypoint: ls -la /dd/scripts/file_uptime.sh
|
||||||
|
entrypoint: /dd/scripts/loop.sh /dd/logs /dd/conf/ips.txt
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
caddy:
|
||||||
|
image: caddy
|
||||||
|
container_name: downdetector_caddy
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
volumes:
|
||||||
|
- "./logs:/srv/logs"
|
||||||
|
command: "caddy file-server --browse /srv/logs"
|
||||||
|
|
19
scripts/file_uptime.sh
Executable file
19
scripts/file_uptime.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
FILE="dd/conf/ips.txt"
|
||||||
|
OUTDIR="dd/logs"
|
||||||
|
#FILE=$IPFILE
|
||||||
|
#OUTDIR=$LOGSDIR
|
||||||
|
|
||||||
|
|
||||||
|
while read LINE;
|
||||||
|
do
|
||||||
|
IP=$(echo $LINE | cut -d" " -f1)
|
||||||
|
NAME=$(echo $LINE | cut -d" " -f2)
|
||||||
|
|
||||||
|
echo "Name=$NAME, IP=$IP"
|
||||||
|
|
||||||
|
ping $IP -c 1 > /dev/null || echo "$(date +"%D - %H:%M:%S"): $NAME down" >> $OUTDIR/$NAME
|
||||||
|
|
||||||
|
done < "$FILE"
|
||||||
|
|
||||||
|
|
17
scripts/loop.sh
Executable file
17
scripts/loop.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
WAITTIME=60
|
||||||
|
|
||||||
|
chmod +x /dd/scripts/*
|
||||||
|
apt-get update && apt-get install -y iputils-ping
|
||||||
|
mkdir -p /dd/logs
|
||||||
|
|
||||||
|
while true;
|
||||||
|
do
|
||||||
|
/dd/scripts/file_uptime.sh || exit 404
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Waiting $WAITTIME seconds"
|
||||||
|
|
||||||
|
sleep $WAITTIME
|
||||||
|
done;
|
3
scripts/uptime.sh
Executable file
3
scripts/uptime.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
ping $1 -c 1 > /dev/null || echo "$(date +"%D - %H:%M:%S"): $2 down" >> $2
|
Loading…
Reference in New Issue
Block a user