云监控使用了哪些资源

Which resource is used by Cloud Monitoring

我正在尝试使用 Terraform 和 IaC 自动创建监控仪表板。

我看过 this,我知道我可以按照文档中的说明添加仪表板的 JSON 代码。

我的问题是:在哪里可以找到 GCP 中的仪表板?

谢谢:)

resource "google_monitoring_dashboard" "dashboard" {
  dashboard_json = <<EOF
{
  "displayName": "Grid Layout Example",
  "gridLayout": {
    "columns": "2",
    "widgets": [
      {
        "title": "Widget 1",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "LINE"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      },
      {
        "text": {
          "content": "Widget 2",
          "format": "MARKDOWN"
        }
      },
      {
        "title": "Widget 3",
        "xyChart": {
          "dataSets": [{
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"agent.googleapis.com/nginx/connections/accepted_count\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_RATE"
                }
              },
              "unitOverride": "1"
            },
            "plotType": "STACKED_BAR"
          }],
          "timeshiftDuration": "0s",
          "yAxis": {
            "label": "y1Axis",
            "scale": "LINEAR"
          }
        }
      }
    ]
  }
}

EOF
}

仪表板位于 Monitoring->Dashboards 菜单下的 GCP 控制台中,在 Opertions sub-group 中。 您也可以在下面的 link 中找到它,只需将“YOUR-PROJECT-ID-HERE”替换为您的 GCP 项目 ID。 https://console.cloud.google.com/monitoring/dashboards?project=YOUR-PROJECT-ID-HERE

如果您发布的 terraform 代码创建成功,它将显示一个名为 Grid Layout Example 的仪表板,在为您的 terraform 代码定义的 GCP 项目中。

Google 文档供参考 - https://cloud.google.com/monitoring/charts/predefined-dashboards