9 releases (5 breaking)
0.6.1 | Nov 13, 2024 |
---|---|
0.6.0 | Nov 12, 2024 |
0.5.1 | Nov 11, 2024 |
0.4.1 | Nov 9, 2024 |
0.1.0 | Nov 8, 2024 |
#606 in Network programming
48 downloads per month
110KB
1.5K
SLoC
Netpulse
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:
netpulsed
– A daemon that is supposed to run all the time on your server / machine that should keep track of your internet connectionnetpulse
– A Tool that can read and analyze the store, which contains the checks made bynetpulsed
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.
Dependencies
~7–17MB
~243K SLoC