2023-08-19 15:44:50 +00:00
|
|
|
# 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
|
|
|
|
|
2023-10-04 15:46:48 +00:00
|
|
|
The program has two subcommands.
|
2023-08-19 15:44:50 +00:00
|
|
|
|
2023-10-04 15:39:03 +00:00
|
|
|
### log
|
2023-08-19 15:44:50 +00:00
|
|
|
|
2023-10-04 15:39:03 +00:00
|
|
|
Get the current connection status to the default host (1.1.1.1) and timeout (2).
|
2023-08-19 15:44:50 +00:00
|
|
|
|
2023-10-04 15:39:03 +00:00
|
|
|
```txt
|
|
|
|
$ outage_detector log
|
|
|
|
> [YYYY-MM-DD HH:MM:SS][1.1.1.1][OK]
|
2023-08-19 15:44:50 +00:00
|
|
|
```
|
|
|
|
|
2023-10-04 15:39:03 +00:00
|
|
|
Or use a custom host and timeout with
|
2023-08-19 15:44:50 +00:00
|
|
|
|
|
|
|
```txt
|
2023-10-04 15:39:03 +00:00
|
|
|
$ outage_detector log --host 1.0.0.1 --timeout 4
|
|
|
|
> [YYYY-MM-DD HH:MM:SS][1.1.1.1][FAIL]
|
2023-08-19 15:44:50 +00:00
|
|
|
```
|
|
|
|
|
2023-10-04 15:39:03 +00:00
|
|
|
To append a log to `outages.log`.
|
|
|
|
Will create the file if it does not exist.
|
|
|
|
This will suppress output to stdout.
|
2023-08-19 15:44:50 +00:00
|
|
|
|
|
|
|
```txt
|
2023-10-04 15:39:03 +00:00
|
|
|
$ outage_detector log outages.log --host 1.0.0.1 --timeout 4
|
2023-08-19 15:44:50 +00:00
|
|
|
> [YYYY-MM-DD HH:MM:SS][1.1.1.1][FAIL]
|
|
|
|
```
|
|
|
|
|
2023-10-04 15:39:03 +00:00
|
|
|
### outages
|
2023-08-19 15:44:50 +00:00
|
|
|
|
2023-10-04 15:39:03 +00:00
|
|
|
Print the major outages to stdout.
|
2023-08-19 15:44:50 +00:00
|
|
|
|
|
|
|
```txt
|
2023-10-04 15:39:03 +00:00
|
|
|
$ outage_detector log outages.log
|
|
|
|
> [YYYY-MM-DD HH:MM:SS][1.1.1.1] lasting for 3 Minutes
|
2023-08-19 15:44:50 +00:00
|
|
|
```
|
|
|
|
|
2023-10-04 15:39:03 +00:00
|
|
|
You can also specify the time in minutes a connection loss should count as an outage.
|
|
|
|
Default is 3 Minutes.
|
|
|
|
|
|
|
|
```txt
|
|
|
|
$ outage_detector log outages.log --time 6
|
|
|
|
>
|
|
|
|
```
|