Simple website uptime monitor written in Python
  • Python 97.5%
  • Dockerfile 2.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-14 12:10:18 +02:00
.forgejo/workflows Update container.yaml 2026-02-10 21:17:46 +01:00
.gitignore Add .gitignore for config.yaml file 2026-01-31 17:05:11 +01:00
config.yaml.example Add waiting time before notification 2026-06-12 12:54:23 +02:00
Dockerfile Use Python 3.14 to build image 2026-02-04 18:32:03 +01:00
LICENSE Initial commit 2024-11-05 20:18:29 +00:00
README.md Add pre-built image instructions 2026-01-29 17:20:30 +01:00
requirements.txt Add optional certificate expiry check 2025-02-25 20:55:01 +01:00
uptime.py Show time in system timezone 2026-06-14 12:10:18 +02:00

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

License

GNU General Public License 3.0