netpulse

Crates.ionetpulse
lib.rsnetpulse
version0.6.1
sourcesrc
created_at2024-11-08 19:36:25.431605
updated_at2024-11-13 10:20:07.884217
descriptionKeep track of if your internet is still alive, collect stats against a crappy ISP
homepagehttps://github.com/PlexSheep/netpulse
repositoryhttps://github.com/PlexSheep/netpulse
max_upload_size
id1441491
size163,017
Christoph J. Scherr (PlexSheep)

documentation

README

Netpulse

Project badge Crates.io License GitHub Release GitHub language count Rust CI

Keep track of your internet connection with a daemon

Why?

My ISP has trouble pretty much every year some month delivering constant uptime, Netpulse helps keep track of when your internet connectivity goes down.

Usage

Netpulse has two parts:

  1. netpulsed – A daemon that is supposed to run all the time on your server / machine that should keep track of your internet connection
  2. netpulse – A Tool that can read and analyze the store, which contains the checks made by netpulsed

To use Netpulse, you need to let the daemon netpulsed run for a while, and then you can read out the data with netpulse.

Basically, netpulsed will try to make HTTP requests to a few targets every 60 seconds.

The Daemon

The daemon of Netpulse can be started, ended and so on with the netpulsed executable.

A simple sudo netpulsed --start will let the daemon run until you stop it or your system shuts down. Root privileges are required for starting and setup, but privileges will be dropped to the user netpulse with the group netpulse.

Therefore, you need to create a user netpulse on your system to use the daemon:

useradd -r -s /usr/sbin/nologin netpulse

To set everything up, including a systemd unit file and copying the netpulsed executable to /usr/local/bin/, do the following:

netpulsed --setup

Updating

Just run netpulsed --setup again, and restart the systemd service with systemctl restart netpulsed.service if you use that.

The Reader

You can use netpulse --test to run the checks the daemon would run and see the status. Just using netpulse without arguments will result in it trying to load and analyze the store.

Files and Directories

netpulsed will try to create a few directories / files:

  • /run/netpulse/netpulse.pid – lockfile with the PID of the daemon to make sure it doesn't run multiple times
  • /var/lib/netpulse/netpuse.store – the database where your checks are stored
  • /var/log/netpulse.log – contains the stdout of the daemon
  • /var/log/netpulse.err – contains the stderr of the daemon

Targets

The target IPs with which checks are made are defined in the constant TARGETS here.

Currently, it boils down to 1.1.1.1 (cloudflare's DNS server), and the respective IPv6 adress of that.

Commit count: 199

cargo fmt