Building a Free Uptime Monitor in Under 30 Minutes (No Paid Tools)
说明与用途
使用 Python 和 GitHub Actions 在 30 分钟内构建免费的网站可用性监控:脚本定期检查 URL 并通过 Discord、Slack 或 Telegram Webhook 发送警报。
问题
Personal projects often require uptime monitoring, but paid tools charge per site and frequency, making them costly for simple checks.
结果
A fully functional, zero‑cost uptime monitor that runs on GitHub Actions, alerts via popular chat platforms, and requires no dedicated server or paid service.
工作流
- Create a new GitHub repository
- Add a Python script that sends an HTTP GET to the target URL, checks the status code, and posts a JSON payload to a webhook URL if the check fails
- Store the target URL and webhook URL in GitHub Secrets
- Create a .github/workflows/uptime.yml file with a schedule trigger (cron) and steps to set up Python, install dependencies, and run the script
- Test the workflow by forcing a failure and verifying the alert is received
- Adjust the cron interval as needed (5, 10, or 15 minutes)
证据
Check if a site responds, on a schedule. If it doesn't respond, or the response code isn't in the 200 range, send an alert somewhere you'll actually see it — Discord, Slack, or Telegram all work fine with a webhook.
The webhook URL and any other secrets go into the repo's encrypted secrets, not into the script itself, so nothing sensitive ends up committed to the repository.
This isn't a replacement for a proper monitoring tool if you need historical uptime data, multi-region checks, or alerting that escalates through multiple channels if the first one doesn't get acknowledged.
- 记录日期: 2026-09-22T18:30:43.194Z