A service to check for network statuses.
1.1K
A service to check for network statuses.
The script checks for the interface status.
If it is up, then it checks for CDN presence, and downloads from a SSL backed URL to ensure internet connectivity is functional.
The probes write flag files in order to provide information to other services:
lan: a local network is availablecdn: a CDN server is availableinternet: a functional internet connection is availableFiles are deleted as the related resource disappear.
This can be used, for instance in a Systemd unit:
[Unit]
Description = Updates download service
ConditionPathExists = /var/lib/ideascube-net-probe/internet
There is two ways to use this tool:
The install.sh script
installs the binary,
creates a state directory,
installs a default configuration file,
installs and enables a systemd unit.
The unit is NOT started, it's up to you to start it whenever it is relevant:
systemctl enable ideascube-net-probe.service
systemctl status ideascube-net-probe.service
journalctl -f -u ideascube-net-probe
The container requires net=host in order to see the interfaces.
As a result, the container gets the same hostname than the host,
so it may be convenient to set the container hostname in order
to avoid confusion.
The container also needs to access the Avahi socket in order to resolve mDNS casts
docker run -d \
--name ideascube-net-probe \
--hostname ct-ideascube-net-probe \
--net=host \
-v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \
-e DELAY=3 \
offlineinternet/ideascube-probe
services:
ideascube-probe:
container_name: ideascube-net-probe
hostname: ct-ideascube-net-probe
network_mode: host
volumes:
- /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket
environment:
- DELAY=3
image: offlineinternet/ideascube-probe
The script has a default configuration.
/etc/default/ideascube-net-probe.env-file/environment statements.In both cases, values can be overriden via environment variables:
DELAY: delay between probes, in secondsINTERFACE: which interface the state should be checked forCDN_TARGET: the CDN hostname to search forHTTP_TARGET: a SSL enabled URL to check forFLAGS_DIR: the directory where the state flags files are written toVERBOSE: enable verbose mode for debuggingContent type
Image
Digest
sha256:1b86b191e…
Size
28.8 MB
Last updated
over 2 years ago
docker pull offlineinternet/ideascube-net-probe