Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问许可证需确认审计通过

monitoring-setup监控设置

Agent Skill

monitoring-setup 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

267

周安装

11

GitHub Stars

4

下载量

87
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:monitoring-setup(监控设置)
来源仓库:https://github.com/accolver/skill-maker
仓库路径:skills/monitoring-setup
安装命令:
npx skills add https://github.com/accolver/skill-maker --skill monitoring-setup
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/accolver/skill-maker --skill monitoring-setup

简介

monitoring-setup 为服务添加生产级可观测性,集成健康检查、指标、追踪与告警形成完整监控体系。

  • 适用于准备系统上线或增强 SLO 支持,输出可直接对接 Prometheus、Grafana、OpenTelemetry 等标准栈。
  • 提供代码插桩模板、告警规则和运行手册,确保监控即结构化输出而非临时日志。
  • 安装命令为 npx skills add https://github.com/accolver/skill-maker --skill monitoring-setup,需写入应用代码与配置权限。
  • 注意:不用于分析已有监控系统的故障,而是补充缺失的监控覆盖。

SKILL.md

Monitoring Setup

Overview

Add production-grade observability to any service by instrumenting health checks, metrics, tracing, and alerts as a cohesive system. The skill treats monitoring as structured output — not ad-hoc logging — producing files that integrate with standard observability stacks (Prometheus, Grafana, OpenTelemetry, PagerDuty/OpsGenie).

When to use

  • The task is to instrument or operationalize an existing service with health checks, metrics, tracing, alerts, or runbooks.
  • The user is preparing a system for production readiness, SLOs, or on-call support.
  • The deliverable is observability configuration, code instrumentation, and operational guidance.
  • The problem is missing monitoring coverage, not analysis of an already-failing monitoring stack.

Do NOT use when:

  • The task is debugging a current incident or broken observability pipeline.
  • The request is only vendor-specific dashboard clicking with no reusable monitoring design.
  • The work is log aggregation alone without broader observability requirements.

Response format

Always structure the final response with these top-level sections, in this order:

  1. Summary — state the task, scope, and main conclusion in 1-3 sentences.
  2. Decision / Approach — state the key classification, assumptions, or chosen path.
  3. Artifacts — provide the primary deliverable(s) for this skill. Use clear subheadings for multiple files, commands, JSON payloads, queries, or documents.
  4. Validation — state checks performed, important risks, caveats, or unresolved questions.
  5. Next steps — list concrete follow-up actions, or write None if nothing remains.

Rules:

  • Do not omit a section; write None when a section does not apply.
  • If files are produced, list each file path under Artifacts before its contents.
  • If commands, JSON, SQL, YAML, or code are produced, put each artifact in fenced code blocks with the correct language tag when possible.
  • Keep section names exactly as written above so output stays predictable across skills.

Workflow

1. Add health check endpoints

Create three distinct health check endpoints. Each serves a different purpose in orchestration systems like Kubernetes:

EndpointPathPurposeWhat to check
LivenessGET /healthz"Is the process alive?"Process is running, not deadlocked. Minimal checks only.
ReadinessGET /readyz"Can this instance serve traffic?"Database connected, cache warm, dependencies reachable.
StartupGET /startupz"Has initialization completed?"Migrations run, config loaded, initial data seeded.

Critical distinction: Liveness should NEVER check external dependencies. If your liveness probe checks the database and the DB goes down, Kubernetes will restart your healthy pods — making an outage worse. Liveness = "is this process fundamentally broken?" Readiness = "should traffic be routed here?"

Response format:

{
  "status": "ok",
  "checks": {
    "database": { "status": "ok", "latency_ms": 2 },
    "cache": { "status": "ok", "latency_ms": 1 },
    "external_api": { "status": "degraded", "latency_ms": 450 }
  },
  "version": "1.2.3",
  "uptime_seconds": 84321
}

Return HTTP 200 for healthy, 503 for unhealthy. Include individual check statuses so operators can see which dependency is failing.

2. Instrument metrics collection

Use the RED and USE methods to ensure comprehensive coverage:

RED method (for request-driven services):

MetricWhat to measurePrometheus typeExample
RateRequests per secondCounterhttp_requests_total{method, path, status}
ErrorsFailed requests per secondCounterhttp_errors_total{method, path, code}
DurationRequest latency distributionHistogramhttp_request_duration_seconds{method, path}

USE method (for resource-driven components):

MetricWhat to measurePrometheus typeExample
Utilization% of resource capacity in useGaugedb_pool_utilization_ratio
SaturationQueue depth / backpressureGaugerequest_queue_length
ErrorsResource-level error countCounterdb_connection_errors_total

Implementation requirements:

  • Use Prometheus client library for the service's language
  • Expose metrics at GET /metrics in Prometheus exposition format
  • Use histogram buckets appropriate for the service: [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10] seconds for HTTP
  • Label metrics with method, path (normalized), and status_code
  • Add a metrics middleware that instruments ALL requests automatically
  • Include process metrics (memory, CPU, GC, event loop lag where applicable)

3. Add distributed tracing

Implement OpenTelemetry-compatible tracing with correlation ID propagation:

Trace context propagation:

  • Generate a unique trace-id (128-bit hex) for each incoming request without one
  • Propagate via W3C Trace Context headers: traceparent, tracestate
  • Also support X-Correlation-ID / X-Request-ID for backward compatibility
  • Pass trace context to ALL downstream HTTP calls, message queue publishes, and async jobs

Span creation:

  • Create a root span for each incoming request
  • Create child spans for: database queries, external HTTP calls, cache operations, message queue operations
  • Include span attributes: http.method, http.url, http.status_code, db.system, db.statement
  • Set span status to ERROR on failures with error message

Configuration output — generate a trace config file:

// tracing.js - OpenTelemetry configuration
const { NodeSDK } = require("@opentelemetry/sdk-node");
const { getNodeAutoInstrumentations } = require(
  "@opentelemetry/auto-instrumentations-node",
);
const { OTLPTraceExporter } = require(
  "@opentelemetry/exporter-trace-otlp-http",
);

const sdk = new NodeSDK({
  traceExporter: new OTLPTraceExporter({
    url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT ||
      "http://localhost:4318/v1/traces",
  }),
  instrumentations: [getNodeAutoInstrumentations()],
  serviceName: process.env.OTEL_SERVICE_NAME || "my-service",
});

sdk.start();

4. Configure alert thresholds

Define alerts based on SLOs (Service Level Objectives), not arbitrary values. The process:

  1. Define SLOs — e.g., "99.9% of requests complete in < 500ms"
  2. Derive SLIs — the metric that measures the SLO (e.g., http_request_duration_seconds)
  3. Set burn rate alerts — alert when you're consuming error budget too fast

Alert threshold guidelines:

SLO TargetBurn Rate 1hBurn Rate 6hBurn Rate 24h
99.9%14.4x6x3x
99.5%14.4x6x3x
99.0%14.4x6x3x

Alert rule format (Prometheus alerting rules):

groups:
  - name: slo-alerts
    rules:
      - alert: HighErrorRate
        expr: |
          (
            sum(rate(http_requests_total{status=~"5.."}[5m]))
            /
            sum(rate(http_requests_total[5m]))
          ) > (1 - 0.999) * 14.4
        for: 5m
        labels:
          severity: critical
          team: platform
        annotations:
          summary: "Error rate burning through SLO budget at 14.4x"
          description: "Current error rate: {{ $value | humanizePercentage }}"
          runbook: "https://runbooks.example.com/high-error-rate"
          dashboard: "https://grafana.example.com/d/slo-overview"

      - alert: HighLatency
        expr: |
          histogram_quantile(0.99, sum(rate(http_request_duration_seconds_bucket[5m])) by (le))
          > 0.5
        for: 5m
        labels:
          severity: warning
          team: platform
        annotations:
          summary: "P99 latency exceeds 500ms SLO target"
          runbook: "https://runbooks.example.com/high-latency"

Escalation policy:

SeverityResponse TimeNotification ChannelEscalation After
critical5 minutesPagerDuty page15 min to lead
warning30 minutesSlack #alerts2 hours to team
infoNext businessSlack #monitoringNone

Every alert MUST include a runbook annotation linking to resolution steps.

5. Create runbook templates

Generate a runbook for each alert with this structure:

# Runbook: [Alert Name]

## Alert Details

- **Severity:** critical/warning/info
- **SLO:** Which SLO this protects
- **Dashboard:** Link to relevant Grafana dashboard

## Symptoms

What the operator will observe when this fires.

## Diagnosis Steps

1. Check [specific metric/dashboard]
2. Look for [specific log pattern]
3. Verify [specific dependency]

## Resolution

### If caused by [root cause A]

1. Step-by-step fix

### If caused by [root cause B]

1. Step-by-step fix

## Escalation

- If not resolved in [time]: escalate to [team/person]
- If customer-facing: notify [channel]

6. Generate dashboard configuration

Produce a Grafana dashboard JSON or config covering:

  • Overview row: Request rate, error rate, latency P50/P95/P99
  • Health row: Health check status, uptime, version
  • Resources row: CPU, memory, DB pool utilization, queue depth
  • SLO row: Error budget remaining, burn rate, SLO compliance

Checklist

  • Liveness endpoint at /healthz — checks process only, NOT dependencies
  • Readiness endpoint at /readyz — checks all dependencies with individual status
  • Startup endpoint at /startupz — checks initialization completion
  • Health responses include status, individual checks, version, uptime
  • Metrics endpoint at /metrics in Prometheus exposition format
  • RED metrics: request rate, error rate, duration histogram
  • USE metrics: utilization, saturation, errors for resources
  • Metrics middleware instruments all requests automatically
  • Trace context propagation via W3C headers (traceparent)
  • Correlation ID generated for requests without trace context
  • Child spans for DB queries, HTTP calls, cache, message queues
  • Alert thresholds derived from SLOs, not arbitrary values
  • Every alert has severity, team label, runbook link, and dashboard link
  • Escalation policy defined per severity level
  • Runbook template generated for each alert
  • Dashboard config covers request metrics, health, resources, and SLOs

Example

Input: "Add monitoring to our Express.js order service"

Output files produced:

FileContents
health.jsLiveness, readiness, startup route handlers
metrics.jsPrometheus client setup + metrics middleware
tracing.jsOpenTelemetry SDK configuration
alert-rules.ymlPrometheus alerting rules with SLO-based thresholds
runbooks/One markdown file per alert
dashboard.jsonGrafana dashboard configuration

Example health endpoint implementation:

// health.js
const express = require("express");
const router = express.Router();
const { Pool } = require("pg");

const startTime = Date.now();
let startupComplete = false;

// Liveness - process alive, no dependency checks
router.get("/healthz", (req, res) => {
  res.status(200).json({
    status: "ok",
    uptime_seconds: Math.floor((Date.now() - startTime) / 1000),
  });
});

// Readiness - can serve traffic
router.get("/readyz", async (req, res) => {
  const checks = {};
  let healthy = true;

  // Check database
  try {
    const start = Date.now();
    await pool.query("SELECT 1");
    checks.database = { status: "ok", latency_ms: Date.now() - start };
  } catch (err) {
    checks.database = { status: "error", error: err.message };
    healthy = false;
  }

  // Check Redis
  try {
    const start = Date.now();
    await redis.ping();
    checks.cache = { status: "ok", latency_ms: Date.now() - start };
  } catch (err) {
    checks.cache = { status: "error", error: err.message };
    healthy = false;
  }

  res.status(healthy ? 200 : 503).json({
    status: healthy ? "ok" : "unhealthy",
    checks,
    version: process.env.APP_VERSION || "unknown",
    uptime_seconds: Math.floor((Date.now() - startTime) / 1000),
  });
});

// Startup - initialization complete
router.get("/startupz", (req, res) => {
  res.status(startupComplete ? 200 : 503).json({
    status: startupComplete ? "ok" : "starting",
    uptime_seconds: Math.floor((Date.now() - startTime) / 1000),
  });
});

function markStartupComplete() {
  startupComplete = true;
}

module.exports = { router, markStartupComplete };

Common mistakes

MistakeFix
Liveness checks database/external depsLiveness = process health only. Move dependency checks to readiness. DB down + liveness fail = cascading restarts.
Using console.log instead of metricsLogs are for debugging, metrics are for monitoring. Use counters/histograms for anything you'd alert on.
Arbitrary alert thresholds ("error > 10")Derive thresholds from SLOs and burn rates. "10 errors" means nothing without knowing request volume.
No correlation ID propagationGenerate trace ID on ingress, propagate to ALL downstream calls. Without this, distributed debugging is impossible.
Missing runbook links on alertsEvery alert must link to a runbook. An alert without a runbook is just noise that trains operators to ignore alerts.
Single health endpoint for everythingSeparate liveness/readiness/startup. Kubernetes uses them differently; conflating them causes incorrect pod lifecycle decisions.
Metrics without labelsAlways label with method, path, status. Aggregate metrics hide the signal — you need to slice by dimension.
No histogram buckets for latencyUse histograms, not averages. P99 latency matters more than mean. Configure buckets for your expected range.

Quick reference

ComponentOutput fileFormat
Health checkshealth.{js,ts,py}Express/Fastify/Flask routes
Metricsmetrics.{js,ts,py}Prometheus client + middleware
Tracingtracing.{js,ts,py}OpenTelemetry SDK config
Alert rulesalert-rules.ymlPrometheus alerting rules
Runbooksrunbooks/*.mdMarkdown per alert
Dashboarddashboard.jsonGrafana dashboard JSON

Key principles

  1. Liveness is sacred — Never put dependency checks in liveness probes. A liveness failure triggers a pod restart. If your DB is down and liveness checks the DB, Kubernetes restarts all pods, making recovery harder. Liveness answers only: "is this process fundamentally broken?"
  2. SLOs drive alerts — Every alert threshold must trace back to a Service Level Objective. "Error rate > 1%" is meaningless without knowing the SLO. Use burn rate alerting: alert when you're consuming error budget faster than sustainable.
  3. Metrics over logs — Anything you would alert on must be a metric, not a log line. Metrics are aggregatable, queryable, and cheap. Log-based alerting is fragile, expensive, and misses patterns that counters catch naturally.
  4. Trace everything cross-service — Every request entering the system gets a trace ID. Every downstream call propagates it. Without end-to-end tracing, debugging distributed systems requires correlating timestamps across log streams — which doesn't scale.
  5. Alerts without runbooks are noise — Every alert must link to a runbook with diagnosis steps and resolution procedures. Operators receiving alerts without context will either ignore them or waste time investigating from scratch. Runbooks encode institutional knowledge.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.12%
按下载量换算31

Claude

32.41%
按下载量换算28

Cursor

19.02%
按下载量换算17

Gemini CLI

8.83%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills