- Python 97.5%
- Dockerfile 2.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| .gitignore | ||
| config.yaml.example | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
| requirements.txt | ||
| uptime.py | ||
uptime-monitor-py
Simple website uptime monitor written in Python
Intro
This script checks the list of URLs for server response codes and sends Ntfy notification if it differs from "200 OK". Once the server is back up, another notification is sent. The URLs (with optional basic authentication credentials), check interval in seconds, Ntfy topic and optional username/password or token are configured in config.yaml.
It can optionally check for certificate expiry dates for all HTTPS hosts in the URL list and warn within configured number of days.
Checks can be paused within configurable time windows, e.g. during scheduled maintainance.
Quick start
Clone the repo:
git clone https://codeberg.org/glsk/uptime-monitor-py.git
Install dependencies (see requirements.txt).
Copy configuration:
cp config.yaml.example config.yaml
Adjust it to your liking and then start the script:
chmod +x uptime.py
./uptime.py
Run as service
Example Systemd service:
$EDITOR /etc/systemd/system/uptime-monitor-py.service
[Unit]
Description=uptime-monitor-py service
After=network.target
[Service]
ExecStart=/opt/uptime-monitor-py/uptime.py
WorkingDirectory=/opt/uptime-monitor-py
DynamicUser=yes
Restart=always
[Install]
WantedBy=multi-user.target
systemctl enable --now uptime-monitor-py
Run as container
Build image
docker build -t uptime-monitor-py .
Use pre-built image
docker pull codeberg.org/glsk/uptime-monitor-py:latest
Run with Compose
Example compose.yaml:
services:
uptime-monitor-py:
image: uptime-monitor-py
container_name: uptime-monitor-py
restart: unless-stopped
volumes:
- ./config.yaml:/app/config.yaml
Then start container with
docker compose up -d