gcp-networking-observability
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "gcp-networking-observability":https://skillpi.com/zh/skills/deepskill-cad550a2cd18800c884913ea7229219f31b02417a77f5f9e6ee747c0342a4f4a。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
通过分析 VPC 流日志、防火墙日志、Cloud NAT 日志、威胁日志和网络指标来调查 Google Cloud 网络问题。可运行连通性测试进行路径诊断,并使用与 BigQuery 关联的数据集进行大流量分析,适用于排查连接失败、延迟、丢包或流量占用高的应用问题。
介绍来源: third_party · TerminalSkills · 1.0.0 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: gcp-networking-observability
description: |
Investigate Google Cloud networking issues by analyzing VPC Flow Logs,
firewall logs, Cloud NAT logs, threat logs, and networking metrics. Run
Connectivity Tests for path diagnostics and use BigQuery linked datasets
for high-volume traffic analysis. Use when troubleshooting connection
failures, latency, packet loss, or top-talkers.
license: Apache-2.0
compatibility: 'gcloud-cli, bq-cli, BigQuery, Cloud Logging, Cloud Monitoring'
metadata:
author: google-cloud
version: 1.0.0
category: devops
tags:
- gcp
- vpc
- networking
- observability
- flow-logsGCP Networking Observability
Overview
Google Cloud emits multiple network telemetry streams: VPC Flow Logs (sampled IP traffic), firewall rule logs, Cloud NAT translation logs, Cloud Firewall Plus / Cloud IDS threat logs, and aggregated metrics in Cloud Monitoring. Connectivity Tests provide static path analysis for "why can't A reach B?" questions. The right source depends on the question — pick one and stop, do not chase verification across tools.
Instructions
Telemetry Streams
| Stream | Use it for |
|---|---|
| VPC Flow Logs | Top talkers, bytes/packets between IPs, traffic trends, egress analysis |
| Firewall Logs | DENY events, verifying ALLOW rules, audit of who hit which rule |
| Cloud NAT Logs | Port exhaustion, source NAT translation auditing |
| Threat Logs | Cloud Firewall Plus / Cloud IDS — malicious patterns from deep packet inspection |
| Networking Metrics | Time-series throughput, RTT, packet loss for performance dashboards |
| Connectivity Tests | Static reachability analysis between two endpoints |
Enabling VPC Flow Logs
# Enable flow logs on a subnet (5% sampling, full metadata)
gcloud compute networks subnets update prod-subnet \
--region=us-central1 \
--enable-flow-logs \
--logging-aggregation-interval=interval-5-sec \
--logging-flow-sampling=0.5 \
--logging-metadata=include-all
# Route flow logs to BigQuery via a Log Sink (recommended for analysis)
gcloud logging sinks create vpc-flow-sink \
bigquery.googleapis.com/projects/my-project/datasets/network_logs \
--log-filter='resource.type="gce_subnetwork" AND log_id("compute.googleapis.com/vpc_flows")' \
--use-partitioned-tables
Top-Talker Analysis (BigQuery)
Always prefer BigQuery on _AllLogs datasets for volume-based queries. Cloud Logging's Logs Explorer is for spot-checking, not aggregation.
-- Top 20 source→destination IP pairs by bytes (last 24 hours)
SELECT
jsonPayload.connection.src_ip AS src,
jsonPayload.connection.dest_ip AS dst,
jsonPayload.connection.dest_port AS dst_port,
SUM(CAST(jsonPayload.bytes_sent AS INT64)) AS total_bytes,
COUNT(*) AS flows
FROM `my-project.network_logs._AllLogs`
WHERE log_id = 'compute.googleapis.com/vpc_flows'
AND timestamp >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 24 HOUR)
GROUP BY src, dst, dst_port
ORDER BY total_bytes DESC
LIMIT 20;
-- Find external egress (to non-RFC1918) by VM
SELECT
jsonPayload.src_instance.vm_name AS vm,
jsonPayload.connection.dest_ip AS external_dst,
SUM(CAST(jsonPayload.bytes_sent AS INT64)) / POW(1024, 3) AS gb_sent
FROM `my-project.network_logs._AllLogs`
WHERE log_id = 'compute.googleapis.com/vpc_flows'
AND NOT NET.IP_IN_NET(jsonPayload.connection.dest_ip, '10.0.0.0/8')
AND NOT NET.IP_IN_NET(jsonPayload.connection.dest_ip, '172.16.0.0/12')
AND NOT NET.IP_IN_NET(jsonPayload.connection.dest_ip, '192.168.0.0/16')
AND DATE(timestamp) = CURRENT_DATE()
GROUP BY vm, external_dst
ORDER BY gb_sent DESC
LIMIT 50;
If the query returns NULL VM names, the subnet has EXCLUDE_ALL_METADATA set. Retry using jsonPayload.connection.src_ip as the join key.
Firewall DENY Analysis
-- Top denied connection attempts (firewall rule + source IP)
SELECT
jsonPayload.rule_details.reference AS rule,
jsonPayload.connection.src_ip AS src,
jsonPayload.connection.dest_port AS port,
COUNT(*) AS hits
FROM `my-project.network_logs._AllLogs`
WHERE log_id = 'compute.googleapis.com/firewall'
AND jsonPayload.disposition = 'DENIED'
AND timestamp >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)
GROUP BY rule, src, port
ORDER BY hits DESC
LIMIT 25;
Connectivity Tests (Static Path Analysis)
# Test reachability between a VM and an external IP
gcloud network-management connectivity-tests create vm-to-api \
--source-instance=projects/my-project/zones/us-central1-a/instances/web-1 \
--destination-ip-address=203.0.113.10 \
--destination-port=443 \
--protocol=TCP
# Run and read the result
gcloud network-management connectivity-tests run vm-to-api
gcloud network-management connectivity-tests describe vm-to-api \
--format='value(reachabilityDetails.result,reachabilityDetails.traces)'
Connectivity Tests answer reachability questions deterministically — no log digging. If the result is REACHABLE, the path works; UNREACHABLE includes the failing hop and rule.
Cloud NAT Port Exhaustion
-- Find which VMs are saturating NAT ports
SELECT
jsonPayload.endpoint.vm_name AS vm,
COUNT(*) AS allocations,
COUNTIF(jsonPayload.allocation_status = 'DROPPED') AS dropped
FROM `my-project.network_logs._AllLogs`
WHERE log_id = 'compute.googleapis.com/nat_flows'
AND timestamp >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 30 MINUTE)
GROUP BY vm
ORDER BY dropped DESC
LIMIT 10;
If dropped > 0, increase min-ports-per-vm on the Cloud NAT config or add more NAT IPs.
Networking Metrics (Cloud Monitoring)
# Pull RTT/latency time series via Monitoring API
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://monitoring.googleapis.com/v3/projects/my-project/timeSeries?\
filter=metric.type%3D%22networking.googleapis.com/vm_flow/rtt%22&\
interval.startTime=2026-04-15T00:00:00Z&\
interval.endTime=2026-04-15T01:00:00Z"
For dashboards, link the Flow Analyzer — it's the fastest way to view top-N traffic without writing SQL.
Investigation Workflow
- Identify the right primary source for the question:
- "Why is connection failing?" → Connectivity Tests + firewall logs
- "Who is sending the most data?" → VPC Flow Logs (BigQuery)
- "What changed in latency?" → Networking metrics (Monitoring)
- Run one query against the primary source.
- Present the answer — even if the answer is
0,null, or "no traffic." Stop there. - Never run a second source to "verify" — different tools have different sampling and aggregation, comparing them creates rabbit holes.
Examples
Example 1 — App can't reach a third-party API
User reports their service in us-central1 can't connect to a payments API. Run a Connectivity Test from the Cloud Run service to the API IP on port 443 — the result names the failing hop (e.g., firewall-rule deny-egress-public). Update the rule, rerun the test, confirm REACHABLE. No need to dig through firewall logs.
Example 2 — Surprise egress bill
User sees a $4k spike in egress charges for the month. Query VPC Flow Logs in BigQuery grouped by source VM and external destination IP, ordered by bytes. Top result: a VM exfiltrating 800 GB to a single IP. Cross-check the destination IP against threat intel, kill the VM, file an incident. One query — done.
Guidelines
- Pick one source per question — never query a second tool to "double-check" the first
- Always use BigQuery on
_AllLogsfor volume/aggregation queries; Logs Explorer is for spot-checks - Print the SQL before running it — the user should see what you're querying
- Time-range upfront — calculate "last 1 hour" / "yesterday" once, don't re-derive
- Treat
0/null/no trafficas a conclusive answer — don't search for "more interesting" data - For routine reachability questions, Connectivity Tests beat log mining every time
- Enable VPC Flow Logs at 0.5–1.0 sampling for active troubleshooting; 0.05–0.1 for baseline
- Route to BigQuery via Log Sink — Cloud Logging retention costs add up at high volume
- Watch
EXCLUDE_ALL_METADATAsubnets — VM names will be NULL, fall back to IPs - For NAT port exhaustion, increase
min-ports-per-vmor scale NAT IPs before app changes
当前收录版本
1.0.0
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Google Cloud 网络可观测性的完整解决方案,涵盖多种日志和指标分析
- 适用于排查连接失败、延迟、丢包或流量占用最高的应用等实际问题
- 包含具体命令、SQL 查询和工作流,实用性强
亮点
- 触发词精准完整,覆盖 VPC Flow Logs、firewall logs、Cloud NAT logs 等多种数据源
- 明确列出适用场景,边界清晰,不易误触或漏触
亮点
- 文档结构清晰,包含 Overview、Instructions、Examples、Guidelines 等完整章节
- 步骤划分明确,有出口条件,含端到端示例
- frontmatter 完整,单文件未超过 500 行
亮点
- 工具来源明确(gcloud, bq, BigQuery, Cloud Logging, Cloud Monitoring)
- 参数正确,覆盖主要异常(如 NULL VM names、NAT port exhaustion)
- 不可逆操作有确认机制(如 Connectivity Tests 的结果确认)
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
账号、密钥或授权
使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。
主文档提及 · 第 159 行 -
云资源与可能的费用
先预览变更,核对账号、区域、资源权限与费用;创建、部署或删除前单独确认。
主文档提及 · 第 56, 123 行
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- console.cloud.google.com
- monitoring.googleapis.com
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。