Inspects Google Cloud Filestore capacity and utilization, evaluates storage scaling rules, and performs capacity autoscaling (scale UP for low free space or sca
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-google-cloud-filestore-autoscale-60ccf50db8b9 ,按照其中的说明把「google-cloud-filestore-autoscale」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
This skill enables agents to inspect, evaluate, and modify Google Cloud Filestore instance capacities across GCP projects based on configured thresholds.
Before an agent or user can execute this skill, their runtime Service Account must possess the following IAM roles on the target project(s):
roles/file.editor (Required for listing instances and triggering scale
up/down updates)roles/monitoring.viewer (Required for reading Cloud Monitoring
capacity metrics used_bytes)roles/mcp.toolUser (Required if utilizing backend Filestore MCP tools)Ensure gcloud is installed. See
gcloud installation guide if
needed.
Enable essential APIs:
gcloud services enable file.googleapis.com monitoring.googleapis.com --quiet
Inspect fleet capacity and free space (see "Discovery & Read Operations" below).
Evaluate against configured up/down capacity thresholds.
Scale target instances and apply attribution tags.
Tag every Cloud Filestore command or API request provided or executed.
Prefix gcloud commands with the correct metrics environment targeting this skill:
CLOUDSDK_METRICS_ENVIRONMENT="gcs-skills gcs-skills/1.0 (skill:google-cloud-filestore-autoscale)" \
gcloud filestore instances update ...
On direct HTTP calls to the REST API, append the User-Agent:
User-Agent: gcs-skills/1.0 (skill:google-cloud-filestore-autoscale)
For purely conceptual, educational, or informational questions (e.g., "What are Filestore scaling limits?", "Can Basic instances scale down?", "Explain Filestore Tiers"):
If the user prompt contains constraints like "Do not execute commands", "without executing", or "read-only":
run_command tool to execute any shell or gcloud commands (including read-only list/describe commands).list_instances, get_instance) are available and use them (these are API calls, not command executions).references/instance-tiers-specs.md) for any mock instance definitions or project details matching the request. (Do NOT attempt to read evaluation config files such as EVAL.yaml or EVAL.txtpb during evaluation runs as access is restricted).[instance] from [A] TiB to [B] TiB? Please confirm to execute.").Filestore tiers enforce specific boundaries and behaviors. The skill must accept both modern UI names (Basic, Zonal, Regional) and legacy API enums interchangeably.
See references/instance-tiers-specs.md for the full Tier & Capacity Limits Matrix (Min/Max capacities, step increments).
Critical Thresholds:
used_bytes metric.Step 1 (Fleet Discovery): Call the MCP tool
list_instances(parent='projects/{project_id}/locations/-') or CLI gcloud filestore instances list --project={project_id} to discover all Filestore
instances in the target project. Read the capacityGb and tier directly
from the instances returned.
Step 2 (Single Bulk Utilization Metric Query): Immediately after
discovering instances, query the Cloud Monitoring API for the
file.googleapis.com/nfs/server/used_bytes metric across the entire project
in a single request (see references/monitoring-metrics.md for
runtime-specific options including GCP REST API, gcloud, curl, and MCP
tools).
CRITICAL: Make exactly ONE bulk metric request for the entire project. NEVER emit multiple per-instance queries or loops. Do NOT filter by zone or region.
Step 3 (Metric Extraction & Calculation):
resource.labels.instance_name /
metric.labels.instance_name) in the returned timeSeries data to
extract its latest int64Value bytes.timeSeries or has no points, default
its used_bytes to 0.used_bytes_gb = used_bytes / (1024^3).Free Space % = ((capacityGb - used_bytes_gb) / capacityGb) * 100.Used Bytes or Free Space % as "N/A". Populate actual
numbers into the output summary table.The skill must categorize each evaluated instance into one of 5 definitive verdicts. On the initial analysis/fleet inspection run, the skill suggests the required scaling action with target capacity and update commands, and prompts for user confirmation before executing any autoscale modifications. State the value of the "Autoscale Needed" column clearly as one of the following:
references/instance-tiers-specs.md), not exceeding the
maximum capacity. Suggest target capacity, provide the attributed gcloud
update command, and MUST conclude the response with a clear question
prompting the user for confirmation to execute (e.g., "Would you like me to
proceed with scaling [instance] from [A] TiB to [B] TiB? Please confirm to
execute.").references/instance-tiers-specs.md). For example, for a 2
TiB (2048 GiB) Enterprise / Regional instance, rounding to the 256 GiB step
yields a proposed target capacity of 1.75 TiB (1792 GiB, or 1.8 TiB). The
response MUST explicitly verify that the proposed target capacity (e.g. 1.75
TiB / 1792 GiB or 1.8 TiB) remains strictly above both the tier's minimum
capacity floor (e.g. 1 TiB for Enterprise / Small Band, 10 TiB for Large
Band) and currently used space (e.g. 0.9 TiB). Do NOT reduce directly to the
floor in a single step. Suggest target capacity, estimated cost savings,
provide the attributed gcloud update command, and prompt the user for
confirmation to execute.Every status report, evaluation, or recommendation response MUST include a markdown table summarizing the evaluated instances. Even if evaluating a single instance, format it as a table. The table MUST contain the following columns:
InstanceService TierProvisioned CapacityUsed BytesFree Space %Autoscale Needed (MUST contain one of: Yes (Scale Up), Yes (Scale Down), No (Healthy), No (At min capacity limit), or No (Tier cannot scale down))Example standard output table:
| Instance | Service Tier | Provisioned Capacity | Used Bytes | Free Space % | Autoscale Needed | Proposed Action |
|---|---|---|---|---|---|---|
| `[instance-name]` | REGIONAL | 2048 GiB | 900 GiB | 56.05% | Yes (Scale Down) | Scale down to 1792 GiB. `CLOUDSDK_METRICS_ENVIRONMENT=... gcloud filestore instances update ...` |
gcloud filestore instances update command, your response MUST explicitly include a clear question asking the user to confirm execution before any modifications are made (e.g. "Would you like me to proceed with scaling [instance] from [A] TiB to [B] TiB? Please confirm to execute.") to prevent accidental billing spikes or capacity exhaustion.gcloud filestore instances update command on the confirmed instance(s).gcloud command to run manually, reminding them to confirm before manual execution.When the user configures or passes custom threshold values in prompts (e.g. "Scale up if free space drops below 10% with a 20% step", or custom max_threshold / up_increment):
For progressive disclosure of deeper topics, consult the references/ directory: