Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/benjaminch/miradors

A very very (very?) basic poor man tool to check website uptime on a scheduled basis.
https://github.com/benjaminch/miradors

rust website-uptime-monitoring

Last synced: 12 days ago
JSON representation

A very very (very?) basic poor man tool to check website uptime on a scheduled basis.

Awesome Lists containing this project

README

        

# Miradors
This app is just a very simple tool allowing you to monitor if your websites are up and send you an email if not.

# Run it locally
## Via ENV
```
$ MIRADORS_CHECK_INTERVAL_IN_SECONDS=30 \
MIRADORS_WEBSITES_TO_CHECK="https://google.com https://google.fr" \
[email protected] \
MIRADORS_EMAIL_SERVICE_SENDER_DISPLAYED_NAME=Miradors \
MIRADORS_EMAIL_SERVICE_DOMAIN=example.sh \
MIRADORS_EMAIL_SERVICE_API_KEY=[MAILGUN_API_KEY] \
[email protected] \
cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
Running `target/debug/miradors`
2022-12-29T20:29:31.736859Z INFO miradors: https://google.fr: [TIME] 141.880138ms
2022-12-29T20:29:31.736969Z INFO miradors: https://google.fr: [OK]
2022-12-29T20:29:31.917753Z INFO miradors: https://google.com: [TIME] 180.662528ms
2022-12-29T20:29:31.917803Z INFO miradors: https://google.com: [OK]
2022-12-29T20:29:31.918911Z INFO miradors: All good!
2022-12-29T20:30:02.044902Z INFO miradors: https://google.fr: [TIME] 120.376224ms
2022-12-29T20:30:02.044937Z INFO miradors: https://google.fr: [OK]
2022-12-29T20:30:02.197198Z INFO miradors: https://google.com: [TIME] 152.082385ms
2022-12-29T20:30:02.197251Z INFO miradors: https://google.com: [OK]
2022-12-29T20:30:02.198014Z INFO miradors: All good!
2022-12-29T20:30:32.318437Z INFO miradors: https://google.fr: [TIME] 116.46398ms
2022-12-29T20:30:32.318483Z INFO miradors: https://google.fr: [OK]
2022-12-29T20:30:32.462661Z INFO miradors: https://google.com: [TIME] 143.998689ms
2022-12-29T20:30:32.462694Z INFO miradors: https://google.com: [OK]
2022-12-29T20:30:32.463398Z INFO miradors: All good!
2022-12-29T20:31:02.587308Z INFO miradors: https://google.fr: [TIME] 118.382081ms
2022-12-29T20:31:02.587339Z INFO miradors: https://google.fr: [OK]
2022-12-29T20:31:02.749481Z INFO miradors: https://google.com: [TIME] 162.043646ms
2022-12-29T20:31:02.749530Z INFO miradors: https://google.com: [OK]
2022-12-29T20:31:02.750230Z INFO miradors: All good!

```

## Via config file
```
$ cat config.json
{
"check_interval_in_seconds": 30,
"websites_to_check": "https://google.com https://google.fr",
"email_service_config": {
"sender_email": "[email protected]",
"sender_displayed_name": "Miradors",
"domain": "example.sh",
"api_key": "[MAILGUN_API_KEY]",
"recipient_email": "[email protected]"
}
}

$ MIRADORS_CONFIG_FILE=config.json cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.15s
Running `target/debug/miradors`
2022-12-29T20:19:52.072370Z INFO miradors: https://google.com: [TIME] 201.387487ms
2022-12-29T20:19:52.072466Z INFO miradors: https://google.com: [OK]
2022-12-29T20:19:52.073327Z INFO miradors: All good!
2022-12-29T20:20:22.307127Z INFO miradors: https://google.com: [TIME] 228.32006ms
2022-12-29T20:20:22.307194Z INFO miradors: https://google.com: [OK]
2022-12-29T20:20:22.308085Z INFO miradors: All good!

```

# Using Docker image
## Via ENV
```
docker run \
-e MIRADORS_CHECK_INTERVAL_IN_SECONDS=30 \
-e MIRADORS_WEBSITES_TO_CHECK="https://google.com https://google.fr" \
-e [email protected] \
-e MIRADORS_EMAIL_SERVICE_SENDER_DISPLAYED_NAME=Miradors \
-e MIRADORS_EMAIL_SERVICE_DOMAIN=example.sh \
-e MIRADORS_EMAIL_SERVICE_API_KEY=[MAILGUN_API_KEY] \
-e [email protected] \
ghcr.io/benjaminch/miradors:latest
2022-12-30T00:06:00.856993Z INFO miradors: https://google.com: [TIME] 132.636935ms
2022-12-30T00:06:00.857234Z INFO miradors: https://google.com: [OK]
2022-12-30T00:06:00.984119Z INFO miradors: https://google.fr: [TIME] 125.824959ms
2022-12-30T00:06:00.984191Z INFO miradors: https://google.fr: [OK]
2022-12-30T00:06:00.986428Z INFO miradors: All good!
```

## Via config file
```
$ cat config.json
{
"check_interval_in_seconds": 30,
"websites_to_check": "https://google.com",
"email_service_config": {
"sender_email": "[email protected]",
"sender_displayed_name": "Miradors",
"domain": "example.sh",
"api_key": "[MAILGUN_API_KEY]",
"recipient_email": "[email protected]"
}
}

$ docker run \
-v $(pwd)/config.json:/config.json \
--env MIRADORS_CONFIG_FILE=config.json \
ghcr.io/benjaminch/miradors:latest
2022-12-30T10:00:34.395011Z INFO miradors: https://google.com: [TIME] 1.258705674s
2022-12-30T10:00:34.395183Z INFO miradors: https://google.com: [OK]
2022-12-30T10:00:34.396929Z INFO miradors: All good!
```