A beginner-friendly Python tool that checks whether a list of services/URLs are up, logs the results, and saves a JSON report.
Built as a learning project covering Python scripting, HTTP requests, logging, file I/O, and GitHub Actions CI.
- Checks HTTP status and response time for each target
- Logs results to terminal and to
logs/checker.log - Saves a timestamped JSON report to
reports/ - GitHub Actions workflow runs checks on every push and on a schedule
health-checker/
├── checker.py # Main script
├── requirements.txt # Python dependencies
├── .gitignore
├── .github/
│ └── workflows/
│ └── health-check.yml # CI/CD pipeline
├── logs/ # Created at runtime
└── reports/ # Created at runtime
1. Clone the repo
git clone https://github.com/YOUR_USERNAME/YOUR_REPO.git
cd YOUR_REPO2. Install dependencies
pip install -r requirements.txt3. Run the checker
python checker.pyEdit the TARGETS list in checker.py to check your own URLs:
TARGETS = [
{"name": "My App", "url": "https://myapp.example.com"},
{"name": "My API", "url": "https://api.example.com/health"},
]You can also adjust:
TIMEOUT_SECONDS— how long to wait before marking a service as down- The cron schedule in
.github/workflows/health-check.yml
2024-01-15 10:30:01 INFO Starting health checks...
2024-01-15 10:30:01 INFO [UP] Google — 142ms (HTTP 200)
2024-01-15 10:30:02 INFO [UP] GitHub — 310ms (HTTP 200)
2024-01-15 10:30:02 WARNING [DOWN] Fake Service — Connection error: ...
==================================================
HEALTH CHECK SUMMARY
==================================================
✅ UP: 2
❌ DOWN: 1
Services down:
- Fake Service (Connection error: ...)
==================================================
- Python scripting and project structure
- HTTP requests with the
requestslibrary - Logging to files and stdout
- Writing JSON reports
- GitHub Actions for CI/CD automation
- Add email/Slack alerts when a service goes down
- Add a retry mechanism before marking a service as DOWN
- Store results in a database (SQLite to start)
- Build a simple dashboard to visualise uptime history