360 Secure SkillHub
360 安全技能中心

Uptimecheck

通过 python3 脚本检查一个或多个 URL/API 端点是否可用,输出状态码与毫秒响应时间;支持从文本文件批量读取 URL、自定义超时、将结果保存到本地 JSONL 历史并查询。全部正常返回退出码 0,存在故障返回 1,便于 CI/cron 告警。

rogue-agent1
rogue-agent1
热度 52.01
最近更新 2026-05-11 17:37:27
分类:自动化依赖:代码执行 / 读写文件应用场景:DevOps / 自动化脚本

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add uptimecheck
Metadata
name
uptimecheck
description
Check if URLs and API endpoints are up or down with response times and status codes. Use when asked to monitor uptime, check if a website is down, measure HTTP response times, track endpoint health over time, or verify that services are responding. Supports batch checking from files, history tracking with JSONL storage, and configurable timeouts. Zero dependencies — pure Python stdlib.

uptimecheck ✅

Lightweight URL uptime monitor with response time measurement and history tracking.

Commands

Check endpoints

# Check one or more URLs
python3 scripts/uptimecheck.py check https://github.com https://api.example.com

# Check from a file (one URL per line, # comments supported)
python3 scripts/uptimecheck.py check -f urls.txt

# Save results to history for trend analysis
python3 scripts/uptimecheck.py check https://myapi.com --save

# Custom timeout (default 10s)
python3 scripts/uptimecheck.py check https://slow-api.com -t 30

View history

# Recent checks
python3 scripts/uptimecheck.py history

# Filter by URL
python3 scripts/uptimecheck.py history --url github.com

# Last N entries
python3 scripts/uptimecheck.py history -n 100

Output

  • ✅ for 2xx-4xx responses (client errors count as "up")
  • ❌ for 5xx, timeouts, DNS failures, connection refused
  • Response time in milliseconds
  • Summary with count of down endpoints

History Storage

Results saved to ~/.uptimecheck/checks.jsonl — one JSON object per line with url, status, ms, ok, timestamp.

Exit Codes

  • 0: All endpoints responding
  • 1: One or more endpoints down (useful for CI/cron alerting)