|
||
---|---|---|
nix | ||
outage_detector | ||
.envrc | ||
.gitignore | ||
flake.lock | ||
flake.nix | ||
poetry.lock | ||
pyproject.toml | ||
README.md |
Outage Detector
This script pings a host and logs whether a connection could be established. It then can also extract the major outages from these logs. It is mainly used as a tool for statistical analysis of residential internet connections.
Usage
The program has two subcommands.
log
Get the current connection status to the default host (1.1.1.1) and timeout (2).
$ outage_detector log
> [YYYY-MM-DD HH:MM:SS][1.1.1.1][OK]
Or use a custom host and timeout with
$ outage_detector log --host 1.0.0.1 --timeout 4
> [YYYY-MM-DD HH:MM:SS][1.1.1.1][FAIL]
To append a log to outages.log
.
Will create the file if it does not exist.
This will suppress output to stdout.
$ outage_detector log outages.log --host 1.0.0.1 --timeout 4
> [YYYY-MM-DD HH:MM:SS][1.1.1.1][FAIL]
outages
Print the major outages to stdout.
$ outage_detector log outages.log
> [YYYY-MM-DD HH:MM:SS][1.1.1.1] lasting for 3 Minutes
You can also specify the time in minutes a connection loss should count as an outage. Default is 3 Minutes.
$ outage_detector log outages.log --time 6
>