Sign inSign up

offlineinternet/ideascube-net-probe

By offlineinternet

•Updated over 2 years ago

A service to check for network statuses.

Image
0

1.1K

offlineinternet/ideascube-net-probe repository overview

⁠ideascube-net-probe

A service to check for network statuses.

⁠Synopsis

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.

⁠Flag files

The probes write flag files in order to provide information to other services:

  • lan: a local network is available
  • cdn: a CDN server is available
  • internet: a functional internet connection is available

Files 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

⁠Usage

There is two ways to use this tool:

  • The host install is powered by a systemd unit and a configuration file.
  • The Docker image is configured via environment variables.
⁠Install on the host

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
⁠Docker usage

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
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
⁠Compose
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

⁠Configuration

The script has a default configuration.

  • on host installs, a custom configuration may be loaded from /etc/default/ideascube-net-probe.
  • on Docker install, you should use env-file/environment statements.

In both cases, values can be overriden via environment variables:

  • DELAY: delay between probes, in seconds
  • INTERFACE: which interface the state should be checked for
  • CDN_TARGET: the CDN hostname to search for
  • HTTP_TARGET: a SSL enabled URL to check for
  • FLAGS_DIR: the directory where the state flags files are written to
  • VERBOSE: enable verbose mode for debugging

Tag summary

Content type

Image

Digest

sha256:1b86b191e…

Size

28.8 MB

Last updated

over 2 years ago

docker pull offlineinternet/ideascube-net-probe