Python port of the Simple Puppeteer uptime checker.
$ pip install -r requirements.txt
Note: This project depends on the now deprecated pyppeteer package. As it is unmaintained and has been outside of minor changes for a long time they advise considering playwright-python as an alternative.
Create a site-config.json at the root of your Node.js project with the (1) sites you want to monitor, and (2) add one key element's selector as well per url (be careful using simply "body"
, as even error pages has a valid <body>
element).
In this example the first site will throw an error due to bad ssl certificate:
[
{ "site": "https://expired.badssl.com/", "selector": "#dashboard" },
{ "site": "https://badssl.com/", "selector": "#dashboard" },
{ "site": "https://google.com", "selector": "body" }
]
$ python main.py
Output:
$ python main.py
- https://expired.badssl.com/ retries after 1 unsuccessful attempt(s)
- https://expired.badssl.com/ retries after 2 unsuccessful attempt(s)
- https://expired.badssl.com/ retries after 3 unsuccessful attempt(s)
HEALTH CHECK FAILED on https://expired.badssl.com/ with HTTP unknown status (PageError)
HEALTH CHECK PASSED on https://badssl.com/ with HTTP 200
HEALTH CHECK PASSED on https://google.com with HTTP 200
Example:
name: monitoring
on:
workflow_dispatch:
jobs:
run-health-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Python 3
uses: actions/setup-python@v3
with:
python-version: 3.12
- name: Install project
run: pip install -r requirements.txt
- name: Run health check
run: python main.py
MIT License
Copyright (c) 2023 David Barton