← 返回
沟通协作 Key 中文

Skill

Monitor the Claude API for outages and latency spikes with rich Telegram alerts. Status monitoring, latency probes, and automatic recovery notifications.
监控API服务的故障和延迟波动,通过Telegram发送详细告警。包括状态监控、延迟探测和自动恢复通知。
chapati23
沟通协作 clawhub v1.2.1 2 版本 100000 Key: 需要
★ 2
Stars
📥 1,075
下载
💾 3
安装
2
版本
#latest

概述

Claude Watchdog 🐕

Monitor the Anthropic/Claude API for outages and latency spikes. Sends rich alerts to Telegram — no agent tokens consumed for status checks.

What It Does

Status Monitor (status-check.py)

  • Polls status.claude.com every 15 minutes via cron
  • Alerts with incident name, latest update text, per-component status
  • Tags incidents as "(not our model)" if e.g. Haiku is affected but you use Sonnet
  • Sends all-clear on recovery
  • Zero token cost

Latency Probe (latency-probe.py)

  • Sends a minimal request through OpenClaw's local gateway every 15 minutes
  • Measures real end-to-end latency to Anthropic API
  • Maintains rolling baseline (median of last 20 samples)
  • Alerts with 🟡/🟠/🔴 severity based on spike magnitude
  • Sends all-clear when latency recovers
  • ~$0.000001 per probe

Setup

Run the interactive setup script:

bash /path/to/skills/claude-watchdog/scripts/setup.sh

You'll need:

  1. Telegram Bot Token — from @BotFather
  2. Telegram Chat ID — send a message to your bot, then check https://api.telegram.org/bot/getUpdates
  3. OpenClaw Gateway Token — run:

```bash

python3 -c "from pathlib import Path; import json; print(json.load(open(Path.home() / '.openclaw/openclaw.json'))['gateway']['auth']['token'])"

```

  1. Gateway Port — default 18789

The setup script writes config, installs cron jobs, and runs an initial check.

To uninstall (removes cron jobs, optionally config/state):

bash /path/to/skills/claude-watchdog/scripts/setup.sh --uninstall

Config

Stored in ~/.openclaw/skills/claude-watchdog/claude-watchdog.env. To reconfigure, either re-run setup.sh or edit this file directly — changes take effect on the next cron run (within 15 minutes).

TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...
OPENCLAW_GATEWAY_TOKEN=...
OPENCLAW_GATEWAY_PORT=18789
MONITOR_MODEL=sonnet
PROBE_MODEL=openclaw
PROBE_AGENT_ID=main
VariableDefaultDescription
--------------------------------
TELEGRAM_BOT_TOKEN(required)Telegram bot token from @BotFather
TELEGRAM_CHAT_ID(required)Target chat for alerts
OPENCLAW_GATEWAY_TOKEN(required)Auth token for the local OpenClaw gateway
OPENCLAW_GATEWAY_PORT18789Port the OpenClaw gateway listens on
MONITOR_MODELsonnetModel name to match in status incidents (e.g. "sonnet", "haiku")
PROBE_MODELopenclawModel alias sent to the gateway for latency probes. openclaw uses the gateway's default model routing
PROBE_AGENT_IDmainValue of the x-openclaw-agent-id header sent with probes
FILTER_KEYWORDS(none)Comma-separated keywords to filter out of status alerts (e.g. "skills,Artifacts,Memory"). Empty = receive all alerts

Scripts also accept these as environment variables (env file takes priority).

Security Note

The env file contains sensitive tokens (Telegram bot token, gateway token). The setup script sets permissions to 600 (owner-only read/write). If you create or edit the file manually, ensure restricted permissions:

chmod 600 ~/.openclaw/skills/claude-watchdog/claude-watchdog.env

Alert Examples

Status incident:

🟠 Anthropic Status: Partially Degraded Service

📌 Elevated error rates on Claude 3.5 Haiku (not our model)
Status: Investigating
Update: "We are investigating increased error rates..."

Components:
  🟠 API: partial outage

🔗 https://status.claude.com

Latency spike:

🟡 Anthropic API — High Latency Detected

Current: 12.3s
Baseline: 3.1s (median of last 19 samples)
Ratio: 4.0×

Slow responses are expected right now.

Recovery:

✅ Anthropic API — Latency Back to Normal

Current: 2.8s
Baseline: 3.1s
Was: 12.3s when alert fired

State & Logs

All state and log files are stored in ~/.openclaw/skills/claude-watchdog/:

FilePurpose
---------------
claude-watchdog-status.jsonStatus check state
claude-watchdog-latency.jsonLatency probe state & samples
claude-watchdog-status.logStatus check log
claude-watchdog-latency.logLatency probe log

Tuning Thresholds

Edit constants at the top of latency-probe.py:

ConstantDefaultMeaning
----------------------------
ALERT_MULTIPLIER2.5Alert if latency > N× baseline median
ALERT_HARD_FLOOR10.0sAlways alert above this absolute threshold
RECOVER_MULTIPLIER1.5Clear alert when below N× baseline
BASELINE_WINDOW20Rolling sample window size
BASELINE_MIN_SAMPLES5Minimum samples before alerting starts
PROBE_TIMEOUT45sGive up on probe after this long

Requirements

  • Python 3.10+ (stdlib only, no pip dependencies)
  • OpenClaw gateway running locally
  • Telegram bot with access to the target chat

版本历史

共 2 个版本

  • v1.2.1 当前
    2026-03-29 11:42 安全 安全
  • v1.2.0
    2026-03-07 01:52

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,680
content-creation

Youtube Summary

chapati23
在聊天中发送 YouTube 链接即可总结视频内容。支持自定义提示词,可在 URL 后附上具体指令(如“重点关注技术细节...”)。
★ 0 📥 1,076
communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,587