360 Secure SkillHub
360 安全技能中心

site-monitor

核心功能含网站变更检测(带文本差异)、可用性检查、正则匹配特定内容、批量监控多站点;通过Python命令行调用,以退出码反馈结果,可集成OpenClaw配置定时巡检或心跳告警。典型场景:竞品页面更新监控、站点可用性巡检、特定内容上线提醒,仅依赖Python及requests库。

zacjiang
zacjiang
热度 16.17
最近更新 2026-09-12 20:42:00
分类:自动化依赖:代码执行 / 读写文件 / 第三方 API应用场景:自动化脚本 / 日程安排

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add site-monitor
Metadata
name
website-monitor
description
Monitor websites for changes, downtime, or specific content. Get notified when a page changes, goes down, or matches/stops matching a pattern. Lightweight — no database needed.
author
zacjiang
version
1.0.0
tags
monitor, website, uptime, change detection, alert, scraping, automation

Website Monitor

Lightweight website monitoring — detect changes, downtime, or content patterns without external services.

Usage

Check if a site is up

python3 {baseDir}/scripts/monitor.py check https://example.com

Monitor for changes (compare to last snapshot)

python3 {baseDir}/scripts/monitor.py watch https://example.com --state-dir /tmp/monitor-state

Returns exit code 0 if unchanged, 1 if changed (with diff), 2 if down.

Check for specific content

python3 {baseDir}/scripts/monitor.py match https://example.com/pricing --pattern "Enterprise plan"

Returns exit code 0 if pattern found, 1 if not found.

Batch monitor from file

# sites.txt: one URL per line
python3 {baseDir}/scripts/monitor.py batch sites.txt --state-dir /tmp/monitor-state

Integration with OpenClaw

Heartbeat check

Add to your HEARTBEAT.md:

Run website monitor batch check on sites.txt.
If any site is down or changed, notify me.

Cron job

# Check every 30 minutes
openclaw cron add --every 30m --task "Run website monitor on my sites list and alert me if anything changed"

Features

  • 🔍 Change detection with text diff
  • ⬆️ Uptime checking (HTTP status + response time)
  • 🎯 Pattern matching (regex supported)
  • 📁 File-based state (no database needed)
  • 📋 Batch monitoring from URL list
  • 🪶 Zero dependencies beyond Python stdlib + requests

Dependencies

pip3 install requests

How State Works

When using watch mode, the script saves a hash of each page's text content in --state-dir. On the next run, it compares the current hash to the saved one. If different, it reports the change and shows a text diff.

State files are named by URL hash, so you can monitor hundreds of sites without collision.