Metricbeat GCP模块采集BigQuery等GCP服务指标异常问题咨询
问题描述
BigQuery指标采集报错
运行时抛出如下错误:
2021-12-06T09:51:10.206Z ERROR [gcp.metrics] metrics/metricset.go:294 bigquery.googleapis.com/storage/table_count" metric descriptor is empty, this metric will not be collected
原有配置如下:
- module: gcp region: "us-central1" metricsets: - metrics project_id: "ProjectName" credentials_file_path: "/root/xyz.json" exclude_labels: false period: 1h metrics: - aligner: ALIGN_NONE service: bigquery service_metric_prefix: bigquery.googleapis.com/ metric_types: - "bigquery.googleapis.com/storage/table_count"
Compute/Billing指标有字段无数据
Kibana发现页已显示对应字段名,但无实际数据返回,原有配置如下:
- module: gcp region: "us-central1" metricsets: - metrics project_id: "projectname" credentials_file_path: "/root/xyz.json" exclude_labels: false period: 1 metrics: - aligner: ALIGN_NONE service: compute metric_types: - "instance/cpu/reserved_cores" - "instance/cpu/usage_time" - "instance/cpu/utilization" - "instance/uptime"
配置调整方案
BigQuery配置修改
报错核心原因是service_metric_prefix配置和metric_types的全路径重复拼接,导致无法匹配到正确的指标描述符。调整后配置如下:
- module: gcp region: "us-central1" metricsets: - metrics project_id: "ProjectName" credentials_file_path: "/root/xyz.json" exclude_labels: false period: 3h # BigQuery存储类指标上报延迟高,建议拉长采集周期 metrics: - aligner: ALIGN_MEAN # GAUGE类型指标用均值对齐更合理 service: bigquery metric_types: - "storage/table_count" # 无需加前缀,service为bigquery时会自动补全官方前缀
Compute配置修改
无数据核心原因是period配置未加单位,默认按1秒处理,远小于GCP Compute指标最小60秒的上报粒度,无法拉取到数据。调整后配置如下:
- module: gcp region: "us-central1" metricsets: - metrics project_id: "projectname" credentials_file_path: "/root/xyz.json" exclude_labels: false period: 1m # 最低设为60秒,和Compute指标上报粒度匹配 metrics: - aligner: ALIGN_MEAN service: compute metric_types: - "instance/cpu/reserved_cores" - "instance/cpu/usage_time" - "instance/cpu/utilization" - "instance/uptime"
通用检查项
- 确认GCP项目已启用
Cloud Monitoring API - 确认服务账号已绑定
roles/monitoring.viewer权限,BigQuery采集还需额外授予bigquery.tables.list权限 - Billing指标需先在GCP控制台开启账单导出到Cloud Monitoring,默认不开启无法采集
- 首次配置完成后等待5-10分钟再到Kibana查询,GCP指标上报存在天然延迟
内容的提问来源于stack exchange,提问作者deev
相关产品推荐
相关产品推荐

