Agent Skills
› supercheck-io/supercheck
› supercheck-monitoring-alerts
supercheck-monitoring-alerts
GitHub管理Supercheck监控与告警,涵盖HTTP/SSL等检查执行、区域聚合、状态机及多通道通知。支持事件创建、自动恢复、UI展示及SSRF安全策略,确保分布式调度的可靠性与数据一致性。
Trigger Scenarios
配置或修改监控项(如HTTP、Ping、Playwright)
排查告警误报或漏报问题
处理监控事件的生命周期(创建、恢复、重新打开)
调试通知渠道或聚合逻辑异常
Install
npx skills add supercheck-io/supercheck --skill supercheck-monitoring-alerts -g -y
SKILL.md
Frontmatter
{
"name": "supercheck-monitoring-alerts",
"description": "Work on Supercheck HTTP request, website\/SSL, ping host, port check, or Playwright synthetic monitors, wrong monitor status or uptime (false down, missing regions), check cycles, regional scheduling and aggregation, alert thresholds, state and history, incidents, or email, Slack, webhook, Telegram, Discord, and Microsoft Teams notifications."
}
Supercheck monitoring and alerts
flowchart LR
SCHED[Distributed monitor scheduler] --> Q[Regional queues]
Q --> CHECK[HTTP, website, ping, port, or synthetic execution]
CHECK --> AGG[Regional aggregation]
AGG --> STATE{Alert state machine}
STATE --> HIST[Alert history]
STATE --> NOTIFY[Notification providers]
Start here
| File | Why |
|---|---|
worker/src/monitor/monitor.service.ts |
Check execution per monitor type; SSRF-safe probes via requestPinnedMonitorTarget (common/utils/pinned-monitor-request.ts); cycle arrival recording |
worker/src/monitor/monitor-evaluator.ts |
Threshold, transition, and alert logic (evaluateAndSendAlert) |
app/src/lib/monitor-cycles.ts, worker/src/monitor-control/ (cycle-policy.ts, monitor-cycle.service.ts, monitor-cycle.processor.ts) |
Durable check cycles: regional quorum, closing, aborting |
app/src/lib/monitor-aggregation-service.ts |
Regional rollup and uptime |
worker/src/notification/notification.service.ts, app/src/db/schema/notification.ts |
Providers, delivery, alert history |
Monitor definition and execution
- Monitor definitions are tenant-owned configuration; executions and regional results are immutable observations.
- Preserve target, type, request/check config (method, headers/body, auth, timeouts, expected status/keywords, SSL checks), synthetic test reference, frequency, location selection, alert thresholds/flags, muted state, enabled state, and notification relationships across schema, APIs, UI, scheduler, queue, and worker. Monitor
retryStrategyis deprecated and ignored. - Monitor destinations are untrusted. Validate URL shape at configuration time; enforce SSRF-safe DNS-pinned resolution at execution time, re-applied on every redirect and against DNS changes.
- Scheduling is safe across multiple app replicas via BullMQ repeatable monitor jobs keyed by a stable jobId, with a Redis NX lock guarding startup re-scheduling (
app/src/lib/monitor-scheduler.ts). Restarts or overlapping ticks must not duplicate dispatch. - Location selection maps deterministically to worker queues and rejects unknown/unavailable locations deliberately.
Aggregation
- A regional result and aggregate monitor state are separate. Never infer global health from one region.
- Define how missing, late, timed-out, and conflicting regional results affect aggregate status; preserve that rule across dashboards, APIs, and alert evaluation. Cycle status is
open,closed, oraborted(app/src/db/schema/monitor-cycles.ts), and the work is split:decideMonitorCycleinworker/src/monitor-control/cycle-policy.tscomputes the regional quorum decision only.MonitorCycleService.closeCycle(monitor-cycle.service.ts) applies it: monitor status, synthetic missing-region results, and alert evaluation.monitor-cycle.service.tsaborts cycles for paused or disabled monitors. An aborted cycle writes no synthetic failures, so it does not count against uptime.monitor-cycle.processor.tsbacks off and retries closure when a dependency check is temporarily unavailable, instead of failing the cycle.recordCycleArrivalinworker/src/monitor/monitor.service.tstreats a cycle owned by another monitor as absent, and a result for a closed or aborted cycle never re-evaluates it.
- Use consistent units and boundaries for latency, uptime, thresholds, and time windows.
- Store enough immutable evidence to explain why an alert transitioned without retaining secrets or unrestricted response bodies.
Alert state and history
- Model transitions explicitly using the current states and consecutive-failure/recovery policy.
- Persist state transitions with the result that caused them;
alert_historyrecords each delivery attempt (provider, status, outcome). - Deduplicate repeated failing observations while preserving meaningful reminders/escalations configured by the product.
- Recovery closes the active condition once (one recovery alert per outage); failure reminders back off exponentially and are capped at 3 per sequence.
- Alerts open incidents: a sent or failed (not pending)
alert_historyrow is queued forapp/src/sre/lib/background-alert-triage.ts, which opens or joins one incident per monitor or job.alertConfigcarriesincidentEnabled(default on),incidentSeverity(autoorsev1-sev4) andautoResolveIncident(default on); a recovery resolves the open auto-opened incident when it is on, even if recovery alerts are off. OnlySRE_ENABLEDis needed;SRE_AUTOMATION_ENABLEDgates AI triage. Keep these fields in sync across the app schema, worker, CLI schema, MCP tools and OpenAPI. - Alert acknowledgement is not implemented; incident acknowledgement is (see the SRE operations skill). Manual status changes require permission, tenant scope, audit events, and race-safe updates.
Notification providers
- Provider definitions (email, Slack, webhook, Telegram, Discord, Teams; webhook presets for PagerDuty, Opsgenie, Splunk On-Call, Better Stack, and incident.io) are scoped to their owning tenant and secrets remain encrypted/redacted.
- Render messages from bounded, escaped data. Do not leak headers, variables, tokens, raw response bodies, or internal errors.
- Delivery uses bounded timeouts with provider-appropriate retry behavior (Slack, Telegram, Discord, and Teams retry; webhook and email are single-attempt today).
- Webhook destinations use SSRF protection (allowlisted hosts, DNS pinning). Notification delivery is strictly outbound; no inbound callback route exists.
- Record delivery outcome and safe provider diagnostics without blocking the monitor’s terminal persistence indefinitely.
Verify
- Unit-test threshold boundaries, state transitions, deduplication, recovery, and partial/missing region behavior.
- Integration-test scheduler ownership, queue routing, worker output, and provider retry/idempotency.
- Test cross-tenant provider/monitor access and secret redaction.
- Use disposable provider endpoints and clean them up; live delivery acceptance remains separate from automated tests.
Version History
-
8a9bade
Current 2026-11-03 04:16
新增从告警创建和解决事件的功能,优化事件详情页、通知页面及邮件模板;修复时区导致的自动恢复错误及SQL时序问题,增强告警去重与恢复逻辑的准确性。
- 974a753 2026-09-22 16:21


