Token导航 LogoToken导航TokenDH.com
运维和基础设施敏感数据github未标认证来源可访问clear审计提醒

monitoring-database-health监控数据库健康状况

Agent Skill

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

总安装

661

周安装

27

GitHub Stars

2,067

下载量

214
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill monitoring-database-health

简介

monitoring-database-health 用于辅助数据库表结构、查询语句和迁移脚本分析。

  • 适合让 Agent 分析 schema、编写 SQL、排查查询问题或生成迁移建议。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 使用时需明确数据库类型和环境,涉及写入操作时应优先 dry-run 或事务保护。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Database Health Monitor

Overview

Monitor database server health across PostgreSQL, MySQL, and MongoDB by tracking key performance indicators including connection utilization, query throughput, replication lag, disk usage, cache hit ratios, vacuum activity, and lock contention.

Prerequisites

  • Database credentials with access to system statistics views (pg_stat_*, performance_schema, serverStatus)
  • psql, mysql, or mongosh CLI tools for running health check queries
  • Permissions: pg_monitor role (PostgreSQL), PROCESS privilege (MySQL)
  • Baseline metrics from a period of normal operation for threshold calibration
  • Alerting channel configured (email, Slack webhook, PagerDuty)

Instructions

  1. Check connection utilization:

- PostgreSQL: SELECT count(*) AS active_connections, (SELECT setting::int FROM pg_settings WHERE name = 'max_connections') AS max_connections, round(count(*)::numeric / (SELECT setting::int FROM pg_settings WHERE name = 'max_connections') * 100, 1) AS utilization_pct FROM pg_stat_activity - MySQL: SELECT VARIABLE_VALUE AS connections FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Threads_connected' - Alert threshold: utilization above 80%

  1. Monitor query throughput and error rate:

- PostgreSQL: SELECT datname, xact_commit AS commits_total, xact_rollback AS rollbacks_total, xact_rollback::float / GREATEST(xact_commit, 1) AS rollback_ratio FROM pg_stat_database WHERE datname = current_database() - MySQL: SHOW GLOBAL STATUS LIKE 'Com_commit' and SHOW GLOBAL STATUS LIKE 'Com_rollback' - Alert threshold: rollback ratio above 5% or throughput drops more than 50% from baseline

  1. Check disk usage and growth:

- PostgreSQL: SELECT pg_size_pretty(pg_database_size(current_database())) AS db_size and SELECT tablename, pg_size_pretty(pg_total_relation_size(tablename::text)) AS size FROM pg_tables WHERE schemaname = 'public' ORDER BY pg_total_relation_size(tablename::text) DESC LIMIT 10 - Alert threshold: disk usage above 80% or growth rate projecting full disk within 7 days

  1. Monitor cache hit ratio:

- PostgreSQL: SELECT sum(heap_blks_hit)::float / GREATEST(sum(heap_blks_hit) + sum(heap_blks_read), 1) AS cache_hit_ratio FROM pg_statio_user_tables - MySQL: SELECT (1 - (VARIABLE_VALUE / (SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Innodb_buffer_pool_read_requests'))) AS hit_ratio FROM performance_schema.global_status WHERE VARIABLE_NAME = 'Innodb_buffer_pool_reads' - Alert threshold: cache hit ratio below 95% indicates shared_buffers or innodb_buffer_pool_size needs increasing

  1. Check vacuum and autovacuum health (PostgreSQL):

- SELECT relname, last_vacuum, last_autovacuum, n_dead_tup, n_live_tup, round(n_dead_tup::numeric / GREATEST(n_live_tup, 1) * 100, 1) AS dead_pct FROM pg_stat_user_tables WHERE n_dead_tup > 1000 ORDER BY n_dead_tup DESC LIMIT 10 - Alert threshold: dead tuple percentage above 20% or autovacuum not running for more than 24 hours on active tables

  1. Monitor replication lag (if replicas exist):

- PostgreSQL: SELECT client_addr, state, pg_wal_lsn_diff(sent_lsn, replay_lsn) AS lag_bytes FROM pg_stat_replication - MySQL: SHOW REPLICA STATUS\G - check Seconds_Behind_Source - Alert threshold: lag above 30 seconds or replication stopped

  1. Check for long-running queries:

- PostgreSQL: SELECT pid, now() - query_start AS duration, state, query FROM pg_stat_activity WHERE state!= 'idle' AND now() - query_start > interval '5 minutes' ORDER BY duration DESC - Alert threshold: any query running longer than 10 minutes (OLTP) or 1 hour (analytics)

  1. Monitor lock contention:

- PostgreSQL: SELECT count(*) AS waiting_queries FROM pg_stat_activity WHERE wait_event_type = 'Lock' - Alert threshold: more than 10 queries waiting for locks simultaneously

  1. Compile all health checks into a single monitoring script that runs via cron every 60 seconds, outputs metrics in a structured format (JSON), and triggers alerts when thresholds are breached.
  2. Create a health summary dashboard query that returns a single-row result with RAG (Red/Amber/Green) status for each health dimension: connections, throughput, disk, cache, vacuum, replication, queries, and locks.

Output

  • Health check queries tailored to the specific database engine
  • Monitoring script (shell or Python) for scheduled health checks with alerting
  • Threshold configuration with default values and tuning guidance
  • Dashboard summary query providing RAG status across all health dimensions
  • Alert notification templates for Slack, email, or PagerDuty integration

Error Handling

ErrorCauseSolution
pg_stat_activity returns incomplete datatrack_activities = off in postgresql.confEnable track_activities = on and track_counts = on; reload configuration
Health check query itself times outDatabase under heavy load or lock contentionSet statement_timeout = '5s' for monitoring queries; use a dedicated monitoring connection
False alerts during maintenance windowsPlanned maintenance triggers threshold breachesImplement alert suppression windows; add maintenance mode flag to monitoring script
Disk usage alert but no obvious growthWAL files, temporary files, or pg_stat_tmp consuming spaceCheck pg_wal directory size; check for orphaned temporary files; verify wal_keep_size setting
Cache hit ratio drops after restartBuffer pool/shared_buffers cold after database restartImplement cache warming script that runs key queries after restart; alert will self-resolve as cache warms

Examples

PostgreSQL health dashboard for a production SaaS application: A single cron-based script checks 8 health dimensions every 60 seconds, writing results to a metrics table. A dashboard query shows: connections 45/200 (GREEN), cache hit 98.5% (GREEN), dead tuples 2.1% (GREEN), disk 62% (GREEN), replication lag 0.5s (GREEN), long queries 0 (GREEN), lock waiters 1 (GREEN), rollback ratio 0.3% (GREEN).

Detecting impending disk full condition: Health monitor tracks daily disk growth rate. Current usage: 72%, daily growth: 1.2GB, remaining: 280GB. Projected full date: 233 days. Alert triggers at 80% with recommendation to archive old data or add storage. A second alert at 90% escalates to PagerDuty.

Identifying autovacuum falling behind: Health check shows the events table with 15M dead tuples (45% dead ratio) and last autovacuum 3 days ago. Root cause: autovacuum_vacuum_cost_delay too conservative for a high-write table. Fix: set per-table autovacuum_vacuum_cost_delay = 2 and autovacuum_vacuum_scale_factor = 0.01.

Resources

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

github-copilot

26.56%
按下载量换算57

OpenCode

23.76%
按下载量换算51

Cursor

17.44%
按下载量换算37

Claude Code

13.97%
按下载量换算30

Antigravity

8.32%
按下载量换算18

Gemini CLI

3.23%
按下载量换算7

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills