tmolavi/mcp-agent-skills-hub/alloydb-postgres-monitor
Claude Code and agent skill by tmolavi/mcp-agent-skills-hub
- community
Checking that the SKILL.md file is still in the repository.
Use these skills when you need to troubleshoot slow performance, analyze
Install
npx vskill@latest install tmolavi/mcp-agent-skills-hub/alloydb-postgres-monitorSKILL.md
Usage
All scripts can be executed using Node.js. Replace <param_name> and <param_value> with actual values.
Bash: node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'
PowerShell: node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'
Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence.
Scripts
get_query_metrics
Fetches query level cloudmonitoring data (timeseries metrics) for queries running in an AlloyDB instance. To use this tool, you must provide the Google Cloud projectId and a PromQL query.
Generate the PromQL query for AlloyDB query metrics using the provided metrics and rules. Get labels like cluster_id, instance_id, and query_hash from the user's intent. If query_hash is provided, use the per-query metrics.
Defaults:
- Interval: Use a default interval of
5mfor_over_timeaggregation functions unless a different window is specified by the user.
PromQL Query Examples:
- Basic Time Series:
avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance"}[5m]) - Top K:
topk(30, avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance"}[5m])) - Mean:
avg(avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="my-instance","cluster_id"="my-cluster"}[5m])) - Minimum:
min(min_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance","cluster_id"="alloydb-cluster"}[5m])) - Maximum:
max(max_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance","cluster_id"="alloydb-cluster"}[5m])) - Sum:
sum(avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance","cluster_id"="alloydb-cluster"}[5m])) - Count streams:
count(avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance","cluster_id"="alloydb-cluster"}[5m])) - Percentile with groupby on instanceid, clusterid:
quantile by ("instance_id","cluster_id")(0.99,avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","cluster_id"="my-cluster","instance_id"="my-instance"}[5m]))
Available Metrics List: metricname. description. monitored resource. labels. aggregate is the aggregated values for all query stats, Use aggregate metrics if query id is not provided. For perquery metrics do not fetch querystring unless specified by user specifically. Have the aggregation on query hash to avoid fetching the querystring. Do not use latency metrics for anything.
alloydb.googleapis.com/database/postgresql/insights/aggregate/latencies: Aggregated query latency distribution.alloydb.googleapis.com/Database.user,client_addr.alloydb.googleapis.com/database/postgresql/insights/aggregate/execution_time: Accumulated aggregated query execution time since the last sample.alloydb.googleapis.com/Database.user,client_addr.alloydb.googleapis.com/database/postgresql/insights/aggregate/io_time: Accumulated aggregated IO time since the last sample.alloydb.googleapis.com/Database.user,client_addr,io_type.alloydb.googleapis.com/database/postgresql/insights/aggregate/lock_time: Accumulated aggregated lock wait time since the last sample.alloydb.googleapis.com/Database.user,client_addr,lock_type.alloydb.googleapis.com/database/postgresql/insights/aggregate/row_count: Aggregated number of retrieved or affected rows since the last sample.alloydb.googleapis.com/Database.user,client_addr.alloydb.googleapis.com/database/postgresql/insights/aggregate/shared_blk_access_count: Aggregated shared blocks accessed by statement execution.alloydb.googleapis.com/Database.user,client_addr,access_type.alloydb.googleapis.com/database/postgresql/insights/perquery/latencies: Per query latency distribution.alloydb.googleapis.com/Database.user,client_addr,querystring,query_hash.alloydb.googleapis.com/database/postgresql/insights/perquery/execution_time: Accumulated execution times per user per database per query.alloydb.googleapis.com/Database.user,client_addr,querystring,query_hash.alloydb.googleapis.com/database/postgresql/insights/perquery/io_time: Accumulated IO time since the last sample per query.alloydb.googleapis.com/Database.user,client_addr,io_type,querystring,query_hash.alloydb.googleapis.com/database/postgresql/insights/perquery/lock_time: Accumulated lock wait time since the last sample per query.alloydb.googleapis.com/Database.user,client_addr,lock_type,querystring,query_hash.alloydb.googleapis.com/database/postgresql/insights/perquery/row_count: The number of retrieved or affected rows since the last sample per query.alloydb.googleapis.com/Database.user,client_addr,querystring,query_hash.alloydb.googleapis.com/database/postgresql/insights/perquery/shared_blk_access_count: Shared blocks accessed by statement execution per query.alloydb.googleapis.com/Database.user,client_addr,access_type,querystring,query_hash.alloydb.googleapis.com/database/postgresql/insights/pertag/latencies: Query latency distribution.alloydb.googleapis.com/Database.user,client_addr,action,application,controller,db_driver,framework,route,tag_hash.alloydb.googleapis.com/database/postgresql/insights/pertag/execution_time: Accumulated execution times since the last sample.alloydb.googleapis.com/Database.user,client_addr,action,application,controller,db_driver,framework,route,tag_hash.alloydb.googleapis.com/database/postgresql/insights/pertag/io_time: Accumulated IO time since the last sample per tag.alloydb.googleapis.com/Database.user,client_addr,action,application,controller,db_driver,framework,route,io_type,tag_hash.alloydb.googleapis.com/database/postgresql/insights/pertag/lock_time: Accumulated lock wait time since the last sample per tag.alloydb.googleapis.com/Database.user,client_addr,action,application,controller,db_driver,framework,route,lock_type,tag_hash.alloydb.googleapis.com/database/postgresql/insights/pertag/shared_blk_access_count: Shared blocks accessed by statement execution per tag.alloydb.googleapis.com/Database.user,client_addr,action,application,controller,db_driver,framework,route,access_type,tag_hash.alloydb.googleapis.com/database/postgresql/insights/pertag/row_count: The number of retrieved or affected rows since the last sample per tag.alloydb.googleapis.com/Database.user,client_addr,action,application,controller,db_driver,framework,route,tag_hash.
Parameters
| Name | Type | Description | Required | Default | |
|---|---|---|---|---|---|
| projectId | string | The Id of the Google Cloud project. | Yes | ||
| query | string | The promql query to execute. | Yes |
get_query_plan
Generate a PostgreSQL EXPLAIN plan in JSON format for a single SQL statement—without executing it. This returns the optimizer's estimated plan, costs, and rows (no ANALYZE, no extra options). Use in production safely for plan inspection, regression checks, and query tuning workflows.
Parameters
| Name | Type | Description | Required | Default | |
|---|---|---|---|---|---|
| query | string | The SQL statement for which you want to generate plan (omit the EXPLAIN keyword). | Yes |
get_system_metrics
Fetches system level cloudmonitoring data (timeseries metrics) for an AlloyDB cluster, instance. To use this tool, you must provide the Google Cloud projectId and a PromQL query.
Generate the PromQL query for AlloyDB system metrics using the provided metrics and rules. Get labels like cluster_id and instance_id from the user's intent.
Defaults:
- Interval: Use a default interval of
5mfor_over_timeaggregation functions unless a different window is specified by the user.
PromQL Query Examples:
- Basic Time Series:
avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance"}[5m]) - Top K:
topk(30, avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance"}[5m])) - Mean:
avg(avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="my-instance","cluster_id"="my-cluster"}[5m])) - Minimum:
min(min_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance","cluster_id"="alloydb-cluster"}[5m])) - Maximum:
max(max_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance","cluster_id"="alloydb-cluster"}[5m])) - Sum:
sum(avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance","cluster_id"="alloydb-cluster"}[5m])) - Count streams:
count(avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","instance_id"="alloydb-instance","cluster_id"="alloydb-cluster"}[5m])) - Percentile with groupby on instanceid, clusterid:
quantile by ("instance_id","cluster_id")(0.99,avg_over_time({"__name__"="alloydb.googleapis.com/instance/cpu/average_utilization","monitored_resource"="alloydb.googleapis.com/Instance","cluster_id"="my-cluster","instance_id"="my-instance"}[5m]))
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/alloydb-postgres-monitor/SKILL.md
Popularity
- Repository stars
- 8
- 7-day trend score
- 11
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tmolavi/mcp-agent-skills-hub/alloydb-postgres-monitor)