Script that will 'ping' a server on a regular basis & send email on failure.
1.5K
Image repository Dockerhub: mlefkon/pinger , Source repository Github: mlefkon/pinger
A docker container cron job runs curl to 'ping' your server/endpoint. An email is sent via SMTP relay if any problems occur.
ping is used, not curl, so only domain name is needed here.At the end of each ${STATUS_EMAIL_DAYS} time period and email will be sent with:
Data is saved to ${ENDPOINT_NAME}.{ping|fails|history}.log files in /var/log/pinger/. A docker volume can be mounted here to persist. These are CSV files with the formats:
$ docker run --name mypinger -d \
-e ENDPOINT_NAME="My Pinger" \
-e INTERVAL_MIN=3 \
-e THRESHOLD_FAILS_FOR_EMAIL=2 \
-e PING_URL=https://my.url.com/myscript \
-e ALLOW_INSECURE=0 \
-e IPv6=0 \
-e RELIABLE_REFERENCE_PING_HOST=google.com \
-e EXPECTED_RESPONSE="eg: Ping succeeded" \
-e RELAY_HOST=smtps://smtp.relay.com \
-e RELAY_USERNAME=user \
-e RELAY_PASSWORD=pass \
-e [email protected] \
-e RELAY_SENDER_INFORMAL_NAME="Pinger Alert" \
-e [email protected] \
-e STATUS_EMAIL_DAYS=7 \
mlefkon/pinger
The container should probably be run on the 'host' network, assuming the host can operate with IPv6 that the 'ping' is to outside the network. Otherwise a docker 'bridge' network will need to be used with IPv6 enabled, adding an extra layer of complexity.
Note that IPv6 addresses used with curl should be enclosed in [square brackets] like:
https://[::1]
Content type
Image
Digest
sha256:e6132a495…
Size
9.3 MB
Last updated
3 months ago
docker pull mlefkon/pinger