360 Secure SkillHub
360 安全技能中心

Uptime Checker

轻量级零依赖 Python 脚本,用于检测单个或多个网站/API 的可用性与响应时间,支持自定义期望状态码、请求头、超时和请求方法,可校验 SSL 证书、跟踪历史记录并按文本或 JSON 输出,任一端点不可用时返回非零退出码。

johnnywang2001
johnnywang2001
热度 82.19
最近更新 2026-05-11 17:31:45
分类:自动化依赖:代码执行 / 第三方 API / 读写文件应用场景:DevOps / 工作流 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add uptime-checker
Metadata
name
uptime-checker
description
Lightweight URL uptime checker and response time monitor. Check if websites and APIs are up, measure response times, track history, and detect SSL issues. Use when checking if a site is down, monitoring API endpoints, measuring response times, checking SSL certificates, or building uptime reports. Triggers on "is this site up", "check uptime", "website down", "response time", "monitor URL", "endpoint health check", "site status".

Uptime Checker

Zero-dependency URL uptime checker with response time monitoring, history tracking, and multi-URL support.

Quick Start

# Check a single URL
python3 scripts/uptime_check.py https://example.com

# Check multiple URLs
python3 scripts/uptime_check.py https://api.example.com https://example.com https://status.example.com

# JSON output for scripting
python3 scripts/uptime_check.py https://example.com --format json

# Check with custom expected status
python3 scripts/uptime_check.py https://example.com/old-page --expected-status 301

# Load URLs from file
python3 scripts/uptime_check.py --urls-file urls.txt

# Save results and view history
python3 scripts/uptime_check.py https://example.com --save --history-file checks.json
python3 scripts/uptime_check.py --history --history-file checks.json

# Skip SSL verification (self-signed certs)
python3 scripts/uptime_check.py https://internal.example.com --no-verify-ssl

# Custom timeout and method
python3 scripts/uptime_check.py https://example.com --timeout 5 --method HEAD

# Add custom headers (auth, etc.)
python3 scripts/uptime_check.py https://api.example.com --header "Authorization:Bearer token123"

Features

  • Check single or multiple URLs in one command
  • Response time measurement in milliseconds
  • SSL certificate validation
  • Redirect detection and following
  • History tracking with uptime percentage summaries
  • Configurable expected HTTP status codes
  • Custom headers, methods, and timeouts
  • JSON and text output formats
  • Exit code 1 if any endpoint is down (for scripting/cron)
  • No external dependencies — pure Python stdlib