dt-obs-gcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGCP Cloud Infrastructure
GCP云基础设施
Monitor and analyze GCP resources using Dynatrace Smartscape and DQL. Query GCP services, manage organizational hierarchy, audit security posture, and track resource ownership across your GCP infrastructure.
使用Dynatrace Smartscape和DQL监控并分析GCP资源。查询GCP服务、管理组织层级、审计安全态势,并追踪整个GCP基础设施中的资源归属。
When to Use This Skill
何时使用该技能
Use this skill when the user needs to work with GCP resources in Dynatrace. Load the reference file for the task type:
| Task | File to load |
|---|---|
| Inventory and topology queries | (no additional file — use core patterns above) |
| Compute Engine instances, machine types, IP addresses | Load |
| GKE clusters, node pools, pods, deployments, services, RBAC | Load |
| Cloud Run services, revisions, executions | Load |
| VPC networks, subnets, routes, DNS records | Load |
| Pub/Sub topics | Load |
| IAM service accounts, roles, Secret Manager | Load |
| Monitoring dashboards, logging, saved queries | Load |
| GCP projects, regions, organizational hierarchy | Load |
| Resource ownership, GCP labels, organizational structure | Load |
当用户需要在Dynatrace中处理GCP资源时使用本技能。根据任务类型加载参考文件:
| 任务 | 需加载的文件 |
|---|---|
| 资源清单与拓扑查询 | (无需额外文件 — 使用上方核心模式) |
| Compute Engine实例、机器类型、IP地址 | 加载 |
| GKE集群、节点池、Pod、部署、服务、RBAC | 加载 |
| Cloud Run服务、修订版本、执行记录 | 加载 |
| VPC网络、子网、路由、DNS记录 | 加载 |
| Pub/Sub主题 | 加载 |
| IAM服务账号、角色、Secret Manager | 加载 |
| 监控仪表板、日志、已保存查询 | 加载 |
| GCP项目、区域、组织层级 | 加载 |
| 资源归属、GCP标签、组织结构 | 加载 |
Core Concepts
核心概念
Entity Types
实体类型
GCP resources use the prefix and can be queried using the function. All GCP entities are automatically discovered and modeled in Dynatrace Smartscape.
GCP_*smartscapeNodesCompute: ,
Networking: , , ,
Kubernetes (GKE): , , , , , , , , ,
Serverless: , ,
IAM & Security: , ,
Messaging:
Monitoring: ,
Infrastructure:
GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCEGCP_COMPUTE_GOOGLEAPIS_COM_ADDRESSGCP_COMPUTE_GOOGLEAPIS_COM_NETWORKGCP_COMPUTE_GOOGLEAPIS_COM_SUBNETWORKGCP_COMPUTE_GOOGLEAPIS_COM_ROUTEGCP_DNS_GOOGLEAPIS_COM_RESOURCERECORDSETGCP_K8S_IO_PODGCP_K8S_IO_NODEGCP_K8S_IO_SERVICEGCP_K8S_IO_SERVICEACCOUNTGCP_K8S_IO_PERSISTENTVOLUMECLAIMGCP_APPS_K8S_IO_DEPLOYMENTGCP_APPS_K8S_IO_STATEFULSETGCP_CONTAINER_GOOGLEAPIS_COM_NODEPOOLGCP_RBAC_AUTHORIZATION_K8S_IO_CLUSTERROLEBINDINGGCP_RBAC_AUTHORIZATION_K8S_IO_ROLEBINDINGGCP_RUN_GOOGLEAPIS_COM_SERVICEGCP_RUN_GOOGLEAPIS_COM_REVISIONGCP_RUN_GOOGLEAPIS_COM_EXECUTIONGCP_IAM_GOOGLEAPIS_COM_SERVICEACCOUNTGCP_IAM_GOOGLEAPIS_COM_ROLEGCP_SECRETMANAGER_GOOGLEAPIS_COM_SECRETVERSIONGCP_PUBSUB_GOOGLEAPIS_COM_TOPICGCP_MONITORING_GOOGLEAPIS_COM_DASHBOARDGCP_LOGGING_GOOGLEAPIS_COM_SAVEDQUERYGCP_REGIONGCP资源使用前缀,可通过函数查询。所有GCP实体都会被自动发现并在Dynatrace Smartscape中建模。
GCP_*smartscapeNodes计算类: 、
网络类: 、、、
Kubernetes(GKE): 、、、、、、、、、
无服务器类: 、、
IAM与安全类: 、、
消息类:
监控类: 、
基础设施类:
GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCEGCP_COMPUTE_GOOGLEAPIS_COM_ADDRESSGCP_COMPUTE_GOOGLEAPIS_COM_NETWORKGCP_COMPUTE_GOOGLEAPIS_COM_SUBNETWORKGCP_COMPUTE_GOOGLEAPIS_COM_ROUTEGCP_DNS_GOOGLEAPIS_COM_RESOURCERECORDSETGCP_K8S_IO_PODGCP_K8S_IO_NODEGCP_K8S_IO_SERVICEGCP_K8S_IO_SERVICEACCOUNTGCP_K8S_IO_PERSISTENTVOLUMECLAIMGCP_APPS_K8S_IO_DEPLOYMENTGCP_APPS_K8S_IO_STATEFULSETGCP_CONTAINER_GOOGLEAPIS_COM_NODEPOOLGCP_RBAC_AUTHORIZATION_K8S_IO_CLUSTERROLEBINDINGGCP_RBAC_AUTHORIZATION_K8S_IO_ROLEBINDINGGCP_RUN_GOOGLEAPIS_COM_SERVICEGCP_RUN_GOOGLEAPIS_COM_REVISIONGCP_RUN_GOOGLEAPIS_COM_EXECUTIONGCP_IAM_GOOGLEAPIS_COM_SERVICEACCOUNTGCP_IAM_GOOGLEAPIS_COM_ROLEGCP_SECRETMANAGER_GOOGLEAPIS_COM_SECRETVERSIONGCP_PUBSUB_GOOGLEAPIS_COM_TOPICGCP_MONITORING_GOOGLEAPIS_COM_DASHBOARDGCP_LOGGING_GOOGLEAPIS_COM_SAVEDQUERYGCP_REGIONCommon GCP Fields
通用GCP字段
All GCP entities include:
- — GCP project identifier
gcp.project.id - — GCP region (e.g., us-central1)
gcp.region - — GCP zone (e.g., us-central1-a)
gcp.zone - — GCP organization identifier
gcp.organization.id - — Resource name
gcp.resource.name - — Resource type identifier
gcp.resource.type - — GCP asset type
gcp.asset.type - — JSON blob containing full resource configuration
gcp.object
所有GCP实体均包含以下字段:
- — GCP项目标识符
gcp.project.id - — GCP区域(例如:us-central1)
gcp.region - — GCP可用区(例如:us-central1-a)
gcp.zone - — GCP组织标识符
gcp.organization.id - — 资源名称
gcp.resource.name - — 资源类型标识符
gcp.resource.type - — GCP资产类型
gcp.asset.type - — 包含完整资源配置的JSON二进制大对象
gcp.object
GCP Organizational Hierarchy
GCP组织层级
GCP resources are organized in a hierarchy:
- Organization — Top-level container ()
gcp.organization.id - Folder — Logical grouping within an organization
- Project — Resource container ()
gcp.project.id - Region/Zone — Physical location (,
gcp.region)gcp.zone
GCP资源按以下层级组织:
- 组织 — 顶层容器()
gcp.organization.id - 文件夹 — 组织内的逻辑分组
- 项目 — 资源容器()
gcp.project.id - 区域/可用区 — 物理位置(、
gcp.region)gcp.zone
Entity Naming Convention
实体命名规范
GCP entity types follow the pattern :
GCP_<SERVICE_API>_<RESOURCE>- Service API maps to the Google API domain (e.g., →
compute.googleapis.com)COMPUTE_GOOGLEAPIS_COM - Resource is the specific resource type (e.g., ,
INSTANCE)NETWORK
Examples:
- — Compute Engine VM
GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE - — GKE pod
GCP_K8S_IO_POD - — Cloud Run service
GCP_RUN_GOOGLEAPIS_COM_SERVICE
GCP实体类型遵循模式:
GCP_<SERVICE_API>_<RESOURCE>- 服务API对应Google API域名(例如:→
compute.googleapis.com)COMPUTE_GOOGLEAPIS_COM - 资源指具体的资源类型(例如:、
INSTANCE)NETWORK
示例:
- — Compute Engine虚拟机
GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE - — GKE Pod
GCP_K8S_IO_POD - — Cloud Run服务
GCP_RUN_GOOGLEAPIS_COM_SERVICE
Query Patterns
查询模式
All GCP queries build on four core patterns. Master these and adapt them to any entity type.
所有GCP查询都基于四种核心模式。掌握这些模式后可适配至任意实体类型。
Pattern 1: Resource Discovery
模式1:资源发现
List resources by type, filter by project/region/zone, summarize counts:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| fields name, gcp.project.id, gcp.region, gcp.zone, gcp.resource.nameTo list all GCP resource types, replace with and add . Add filters like or to scope results.
"GCP_*"| summarize count = count(), by: {type} | sort count desc| filter gcp.project.id == "<PROJECT_ID>"| filter gcp.region == "<REGION>"按类型列出资源,按项目/区域/可用区筛选,汇总数量:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| fields name, gcp.project.id, gcp.region, gcp.zone, gcp.resource.name若要列出所有GCP资源类型,将上述语句替换为并添加。可添加或等筛选条件来限定结果范围。
"GCP_*"| summarize count = count(), by: {type} | sort count desc| filter gcp.project.id == "<PROJECT_ID>"| filter gcp.region == "<REGION>"Pattern 2: Configuration Parsing
模式2:配置解析
Parse JSON for detailed configuration fields:
gcp.objectdql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| parse gcp.object, "JSON:gcpjson"
| fieldsAdd machineType = gcpjson[configuration][resource][machineType],
status = gcpjson[configuration][resource][status]
| fields name, gcp.project.id, machineType, statusGCP configuration fields are nested under for primary resource attributes and for extended properties.
gcpjson[configuration][resource][...]gcpjson[configuration][additionalAttributes][...]解析 JSON以获取详细配置字段:
gcp.objectdql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| parse gcp.object, "JSON:gcpjson"
| fieldsAdd machineType = gcpjson[configuration][resource][machineType],
status = gcpjson[configuration][resource][status]
| fields name, gcp.project.id, machineType, statusGCP配置字段中,主要资源属性嵌套在下,扩展属性嵌套在下。
gcpjson[configuration][resource][...]gcpjson[configuration][additionalAttributes][...]Pattern 3: Relationship Traversal
模式3:关系遍历
Follow relationships between resources:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| traverse "*", "GCP_COMPUTE_GOOGLEAPIS_COM_SUBNETWORK"
| fields name, gcp.project.idGCP entities use as the relationship name in traversals because GCP entities do not have named relationship types. Use to carry fields through traversals and to access ancestor fields.
"*"fieldsKeepdt.traverse.history[-N]追踪资源间的关系:
dql
smartscapeNodes "GCP_COMPUTE_GOOGLEAPIS_COM_INSTANCE"
| traverse "*", "GCP_COMPUTE_GOOGLEAPIS_COM_SUBNETWORK"
| fields name, gcp.project.idGCP实体在遍历时使用作为关系名称,因为GCP实体没有命名的关系类型。使用在遍历过程中保留字段,使用访问祖先字段。
"*"fieldsKeepdt.traverse.history[-N]Pattern 4: Label-Based Ownership
模式4:基于标签的归属管理
Group resources by GCP labels for ownership and organizational tracking:
dql
smartscapeNodes "GCP_*"
| filter isNotNull(`tags:gcp_labels`)
| fields name, gcp.project.id, `tags:gcp_labels`GCP labels are exposed via the field and must be accessed using backtick syntax. Replace with a specific type to scope to one service.
tags:gcp_labels"GCP_*"按GCP标签对资源进行分组,用于归属和组织追踪:
dql
smartscapeNodes "GCP_*"
| filter isNotNull(`tags:gcp_labels`)
| fields name, gcp.project.id, `tags:gcp_labels`GCP标签通过字段暴露,必须使用反引号语法访问。将替换为特定类型可限定至单个服务。
tags:gcp_labels"GCP_*"Reference Guide
参考指南
Load reference files for detailed queries when the core patterns above need service-specific adaptation.
| Reference | When to load | Key content |
|---|---|---|
| compute-instances.md | Compute Engine VMs, machine types, IP addresses, disks | Instance inventory, machine type distribution, status checks |
| kubernetes-gke.md | GKE clusters, node pools, pods, deployments, services, RBAC | Cluster topology, workload distribution, RBAC bindings |
| serverless-containers.md | Cloud Run services, revisions, executions | Service inventory, revision tracking, execution analysis |
| networking-dns.md | VPC networks, subnets, routes, DNS records | Network topology, subnet analysis, route tables, DNS record sets |
| messaging-pubsub.md | Pub/Sub topics | Topic inventory, messaging topology |
| iam-security.md | IAM service accounts, roles, Secret Manager | Service account audit, role analysis, secret version tracking |
| monitoring-logging.md | Monitoring dashboards, logging, saved queries | Dashboard inventory, saved query analysis |
| resource-management.md | GCP projects, regions, organizational hierarchy | Project inventory, region distribution, hierarchy mapping |
| resource-ownership.md | Resource ownership, GCP labels, organizational structure | Label-based grouping, project-level summaries, chargeback |
当核心模式需要针对特定服务调整时,加载参考文件获取详细查询语句。
| 参考文件 | 加载时机 | 核心内容 |
|---|---|---|
| compute-instances.md | 处理Compute Engine虚拟机、机器类型、IP地址、磁盘时 | 实例清单、机器类型分布、状态检查 |
| kubernetes-gke.md | 处理GKE集群、节点池、Pod、部署、服务、RBAC时 | 集群拓扑、工作负载分布、RBAC绑定 |
| serverless-containers.md | 处理Cloud Run服务、修订版本、执行记录时 | 服务清单、修订版本追踪、执行分析 |
| networking-dns.md | 处理VPC网络、子网、路由、DNS记录时 | 网络拓扑、子网分析、路由表、DNS记录集 |
| messaging-pubsub.md | 处理Pub/Sub主题时 | 主题清单、消息拓扑 |
| iam-security.md | 处理IAM服务账号、角色、Secret Manager时 | 服务账号审计、角色分析、密钥版本追踪 |
| monitoring-logging.md | 处理监控仪表板、日志、已保存查询时 | 仪表板清单、已保存查询分析 |
| resource-management.md | 处理GCP项目、区域、组织层级时 | 项目清单、区域分布、层级映射 |
| resource-ownership.md | 处理资源归属、GCP标签、组织结构时 | 基于标签的分组、项目级汇总、成本分摊 |
Best Practices
最佳实践
Configuration Parsing
配置解析
- Always parse with JSON parser:
gcp.objectparse gcp.object, "JSON:gcpjson" - Access primary resource attributes via
gcpjson[configuration][resource][...] - Access extended properties via
gcpjson[configuration][additionalAttributes][...] - Check for null values after parsing with
isNotNull()
- 始终使用JSON解析器解析:
gcp.objectparse gcp.object, "JSON:gcpjson" - 通过访问主要资源属性
gcpjson[configuration][resource][...] - 通过访问扩展属性
gcpjson[configuration][additionalAttributes][...] - 解析后使用检查空值
isNotNull()
GCP Hierarchy
GCP层级
- Organization → Folder → Project → Region/Zone
- Use as the primary scoping filter
gcp.project.id - Use for cross-project queries
gcp.organization.id - Use and
gcp.regionfor location-based analysisgcp.zone
- 层级顺序:组织 → 文件夹 → 项目 → 区域/可用区
- 使用作为主要范围筛选条件
gcp.project.id - 使用进行跨项目查询
gcp.organization.id - 使用和
gcp.region进行基于位置的分析gcp.zone
Entity Naming
实体命名
- Entity types follow the format
GCP_<SERVICE_API>_<RESOURCE> - Service API maps to the Google API domain with underscores replacing dots and hyphens
- Use specific entity types (avoid wildcards when possible)
"GCP_*"
- 实体类型遵循格式
GCP_<SERVICE_API>_<RESOURCE> - 服务API对应Google API域名,用下划线替换点和连字符
- 使用特定实体类型(尽可能避免通配符)
"GCP_*"
Labels
标签
- GCP labels must be accessed via backtick syntax:
`tags:gcp_labels` - Use tags:gcp_labels
isNotNull(for label-based filtering) - Track label coverage with summarize operations
- GCP标签必须使用反引号语法访问:
`tags:gcp_labels` - 使用tags:gcp_labels
isNotNull(进行基于标签的筛选) - 使用汇总操作追踪标签覆盖率
Relationship Traversal
关系遍历
- Use as the relationship name — GCP entities do not have named relationship types
"*" - Use to maintain important fields through traversal
fieldsKeep - Access traversal history with
dt.traverse.history[-N] - Complex topologies may require multiple traverse operations
- 使用作为关系名称 — GCP实体没有命名的关系类型
"*" - 使用在遍历过程中保留重要字段
fieldsKeep - 使用访问遍历历史
dt.traverse.history[-N] - 复杂拓扑可能需要多次遍历操作
Limitations and Notes
限制与说明
Smartscape Limitations
Smartscape限制
- Smartscape data reflects the most recent scan; there may be a delay between GCP changes and Dynatrace visibility
- Not all GCP services are represented as entity types
- Some configuration fields may be null depending on resource setup
- Resource discovery depends on GCP integration configuration
- Smartscape数据反映最新扫描结果;GCP变更与Dynatrace可见性之间可能存在延迟
- 并非所有GCP服务都以实体类型呈现
- 根据资源设置,部分配置字段可能为空
- 资源发现依赖GCP集成配置
GCP-Specific Notes
GCP特定说明
- GCP labels must be accessed via backtick syntax:
`tags:gcp_labels` - GCP entities use for relationship traversal (no named relationship types)
"*" - GCP object configuration requires parsing with
parse gcp.object, "JSON:gcpjson" - Configuration fields nest under (differs from AWS pattern)
gcpjson[configuration][resource][...]
- GCP标签必须使用反引号语法访问:
`tags:gcp_labels` - GCP实体在关系遍历时使用(无命名关系类型)
"*" - GCP对象配置需要使用解析
parse gcp.object, "JSON:gcpjson" - 配置字段嵌套在下(与AWS模式不同)
gcpjson[configuration][resource][...]
General Tips
通用提示
- Filter early by project and region for better performance
- Use and
isNotNull()for graceful null handlingisNull() - Combine project and region filters for large environments
- Use for unique resource counts
countDistinct() - Limit results with during exploration
| limit N
- 尽早按项目和区域筛选以提升性能
- 使用和
isNotNull()优雅处理空值isNull() - 在大型环境中组合项目和区域筛选条件
- 使用统计唯一资源数量
countDistinct() - 探索时使用限制结果数量
| limit N