대시보드 및 레이아웃 예시

이 페이지에서는 Cloud Monitoring API를 사용하여 대시보드를 만드는 방법을 보여줍니다. 각 예시에는 JSON의 대시보드 정의와 해당 대시보드가 표시됩니다.

Cloud Monitoring에서는 GitHub에서 선별된 대시보드 정의 집합도 제공합니다. Google Cloud 프로젝트에서 이러한 정의를 커스텀 대시보드로 설치할 수 있습니다. 이 저장소와 이러한 대시보드를 설치하는 방법은 샘플 대시보드 설치를 참조하세요.

API를 사용해야 하는 경우

Cloud Monitoring API를 사용하면 여러 대시보드를 한 번에 관리할 수 있습니다. Google Cloud 콘솔을 사용하여 대시보드를 관리할 수 있지만 API를 사용하여 커스텀 대시보드를 일괄 관리하는 것이 더 쉬울 수 있습니다.

또한 대시보드에 빈 자리표시자 위젯을 추가하려면 API를 사용해야 합니다.

API로 MQL 또는 PromQL 사용

dashboards.create 메서드를 사용하여 대시보드를 만듭니다. 대시보드에 표시되는 위젯마다 항목 하나를 포함하는 Dashboard 객체를 API 메서드에 전달합니다.

차트 위젯과 같이 위젯이 시계열 데이터를 표시하는 경우 Dashboard 객체의 해당 항목에 TimeSeriesQuery 객체가 포함됩니다. 이 객체는 차트로 작성할 시계열 데이터를 설명하며 Monitoring 필터, MQL 쿼리 또는 PromQL 쿼리를 사용하여 해당 데이터를 지정합니다.

  • Monitoring 필터를 사용하려면 timeSeriesField 필드를 채웁니다. 이 페이지의 예시에서는 Cloud Monitoring 필터를 사용합니다.

  • MQL 쿼리를 사용하려면 timeSeriesQueryLanguage 필드를 채웁니다. 자세한 내용은 차트 작성을 참조하세요.

  • PromQL 쿼리를 사용하려면 prometheusQuery 필드를 채웁니다. 일반적인 정보는 Cloud Monitoring의 PromQL을 참조하세요.

대시보드 레이아웃

이 섹션에는 사용 가능한 여러 대시보드 레이아웃에 대한 정보가 포함되어 있습니다.

GridLayout의 대시보드

이 대시보드에는 세 개의 위젯이 있는 GridLayout이 표시됩니다.

{
  "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"
        }
      },
      {
        "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"
          }
        }
      }
    ]
  }
}

대시보드는 다음 예시와 비슷합니다.

그리드 레이아웃이 있는 대시보드 예시

MosaicLayout의 대시보드

이 대시보드에는 두 개의 위젯이 있는 MosaicLayout이 표시됩니다.

{
  "displayName": "Mosaic Layout Example",
  "mosaicLayout": {
    "columns": 12,
    "tiles": [
      {
        "xPos": 2,
        "yPos": 2,
        "width": 7,
        "height": 2,
        "widget": {
          "title": "CPU utilization in us-central1-a",
          "scorecard": {
            "timeSeriesQuery": {
              "timeSeriesFilter": {
                "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\" resource.label.zone=\"us-central1-a\"",
                "aggregation": {
                  "perSeriesAligner": "ALIGN_MEAN",
                  "crossSeriesReducer": "REDUCE_MAX"
                }
              },
              "unitOverride": "1"
            },
            "gaugeView": {
              "upperBound": 1.5
            },
            "thresholds": [
              {
                "value": 0.8,
                "color": "YELLOW",
                "direction": "ABOVE"
              },
              {
                "value": 1,
                "color": "RED",
                "direction": "ABOVE"
              }
            ]
          }
        }
      },
      {
        "xPos": 1,
        "yPos": 5,
        "width": 4,
        "height": 4,
        "widget": {
          "title": "My Chart",
          "xyChart": {
            "dataSets": [
              {
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\"",
                    "aggregation": {
                      "perSeriesAligner": "ALIGN_MEAN",
                      "crossSeriesReducer": "REDUCE_MAX",
                      "groupByFields": [
                        "resource.label.zone"
                      ]
                    }
                  },
                  "unitOverride": "'1'"
                },
                "plotType": "LINE",
                "minAlignmentPeriod": "60s"
              }
            ],
            "yAxis": {
              "label": "y1Axis",
              "scale": "LINEAR"
            }
          }
        }
      }
    ]
  }
}

대시보드는 다음 예시와 비슷합니다.

모자이크 레이아웃이 있는 대시보드 예시

RowLayout의 대시보드

이 대시보드에는 세 개의 위젯이 있는 RowLayout이 표시됩니다.

{
  "displayName": "Row Layout Example",
  "rowLayout": {
    "rows": [
      {
        "weight": "1",
        "widgets": [
          {
            "text": {
              "content": "Widget 1",
              "format": "MARKDOWN"
            }
          },
          {
            "text": {
              "content": "Widget 2",
              "format": "MARKDOWN"
            }
          },
          {
            "text": {
              "content": "Widget 3",
              "format": "MARKDOWN"
            }
          }
        ]
      }
    ]
  }
}

대시보드는 다음 예시와 비슷합니다.

행 레이아웃이 있는 대시보드 예시

ColumnLayout의 대시보드

이 대시보드에는 세 개의 위젯이 있는 ColumnLayout이 표시됩니다.

{
  "displayName": "Column Layout Example",
  "columnLayout": {
    "columns": [
      {
        "weight": "1",
        "widgets": [
          {
            "text": {
              "content": "Widget 1",
              "format": "MARKDOWN"
            }
          },
          {
            "text": {
              "content": "Widget 2",
              "format": "MARKDOWN"
            }
          },
          {
            "text": {
              "content": "Widget 3",
              "format": "MARKDOWN"
            }
          }
        ]
      }
    ]
  }
}

대시보드는 다음 예시와 비슷합니다.

열 레이아웃이 있는 대시보드 예시

Widgets이 있는 대시보드

XyChart가 있는 대시보드

이 대시보드에는 기본 XyChart가 있는 대시보드가 표시됩니다. Google Cloud 콘솔을 사용하여 대시보드에 차트를 만든 적이 있으면 해당 차트는 XyChart 위젯의 인스턴스입니다.

Google Cloud 콘솔에서 제공하는 기능과 마찬가지로 API는 차트의 PlotType을 변경하거나 차트의 보기 모드를 구성하는 옵션을 제공합니다.

{
  "dashboardFilters": [],
  "displayName": "Example line chart",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "title": "VM Instance - CPU utilization [MEAN]",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "plotType": "LINE",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "crossSeriesReducer": "REDUCE_MEAN",
                      "groupByFields": [
                        "resource.label.\"zone\""
                      ],
                      "perSeriesAligner": "ALIGN_MEAN"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "thresholds": [],
            "yAxis": {
              "label": "",
              "scale": "LINEAR"
            }
          }
        },
        "width": 24
      }
    ]
  }
}

대시보드의 차트는 다음 예시와 비슷합니다.

XyChart의 예시

다음 섹션에서는 로그 애널리틱스 차트 위젯을 만드는 방법, 차트에 임곗값을 표시하는 방법, 차트에서 왼쪽 Y축, 오른쪽 Y축 또는 둘 다를 사용할지 여부를 구성하는 방법을 설명합니다.

로그 애널리틱스 차트가 있는 대시보드

이 대시보드에는 로그 애널리틱스 차트가 있는 대시보드가 표시됩니다. 샘플 JSON에는 SQL 쿼리가 포함되어 있습니다.

{
  "displayName": "Example Log Analytics",
  "dashboardFilters": [],
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "width": 24,
        "height": 16,
        "widget": {
          "title": "Sample Log Analytics chart",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "breakdowns": [],
                "dimensions": [
                  {
                    "column": "location",
                    "columnType": "STRING",
                    "maxBinCount": 5,
                    "sortColumn": "location",
                    "sortOrder": "SORT_ORDER_ASCENDING"
                  }
                ],
                "measures": [
                  {
                    "aggregationFunction": {
                      "parameters": [],
                      "type": "count"
                    },
                    "column": ""
                  }
                ],
                "plotType": "STACKED_BAR",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "opsAnalyticsQuery": {
                    "queryHandle": "",
                    "sql": "SELECT\n  CAST(JSON_VALUE(resource.labels.location) AS STRING) AS location,\n  severity,\nFROM\n  `TABLE`"
                  }
                }
              }
            ],
            "thresholds": [],
            "yAxis": {
              "label": "",
              "scale": "LINEAR"
            }
          }
        }
      }
    ]
  },
  "labels": {}
}

대시보드의 차트는 다음 예시와 비슷합니다.

로그 애널리틱스 SQL 쿼리가 있는 XyChart 예시

XyChart 및 임곗값이 있는 대시보드

이 대시보드는 기본 XyChart, 임곗값, 왼쪽 Y축이 구성된 대시보드를 보여줍니다.

{
  "dashboardFilters": [],
  "displayName": "Example line with threshold",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "title": "VM Instance - CPU utilization [MEAN]",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "plotType": "LINE",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "crossSeriesReducer": "REDUCE_MEAN",
                      "groupByFields": [
                        "resource.label.\"zone\""
                      ],
                      "perSeriesAligner": "ALIGN_MEAN"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "thresholds": [
              {
                "label": "",
                "targetAxis": "Y1",
                "value": 0.2
              }
            ],
            "yAxis": {
              "label": "",
              "scale": "LINEAR"
            }
          }
        },
        "width": 24
      }
    ]
  }
}

위 예시에서 JSON은 y2Axis 구조를 포함하고 있기 때문에 왼쪽 Y축을 사용하도록 지정합니다. targetAxis 필드에서 오른쪽 Y축에는 'Y1'을 사용하고 왼쪽 Y축에는 'Y2'를 사용합니다. targetAxis 필드를 생략하면 오른쪽 Y축이 사용됩니다.

이 대시보드의 차트는 다음 예시와 비슷합니다.

왼쪽 Y축을 사용하고 임곗값이 있는 XyChart 예시

여러 측정항목 유형을 표시하고 왼쪽 및 오른쪽 축을 사용하는 차트를 구성할 수 있습니다. 앞의 예시에서는 단일 측정항목 유형, 즉 dataSets 배열에 요소가 하나 있는 차트를 보여줍니다. 두 가지 측정항목 유형을 차트로 작성할 때 dataSets 배열에는 요소 두 개가 포함되며 각 요소에서 targetAxis를 지정합니다.

STACKED_AREA PlotType을 사용한 XyChart가 있는 대시보드

이 대시보드는 STACKED_AREA PlotType이 있는 XyChart를 표시합니다.

{
  "dashboardFilters": [],
  "displayName": "Example stacked area",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "title": "VM Instance - CPU utilization [MEAN]",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "plotType": "STACKED_AREA",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "crossSeriesReducer": "REDUCE_MEAN",
                      "groupByFields": [
                        "resource.label.\"zone\""
                      ],
                      "perSeriesAligner": "ALIGN_MEAN"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "thresholds": [],
            "yAxis": {
              "label": "",
              "scale": "LINEAR"
            }
          }
        },
        "width": 24
      }
    ]
  }
}

대시보드의 차트는 다음 예시와 비슷합니다.

누적 영역 도표가 있는 XyChart 예시

STACKED_BAR PlotType을 사용한 XyChart가 있는 대시보드

이 대시보드는 STACKED_BAR PlotType이 있는 XyChart를 표시합니다.

{
  "dashboardFilters": [],
  "displayName": "Example stacked bar",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "title": "VM Instance - CPU utilization [MEAN]",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "plotType": "STACKED_BAR",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "crossSeriesReducer": "REDUCE_MEAN",
                      "groupByFields": [
                        "resource.label.\"zone\""
                      ],
                      "perSeriesAligner": "ALIGN_MEAN"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "thresholds": [],
            "yAxis": {
              "label": "",
              "scale": "LINEAR"
            }
          }
        },
        "width": 24
      }
    ]
  }
}

대시보드는 다음 예시와 비슷합니다.

누적 막대 도표가 있는 XyChart 예시

기본 Scorecard이 있는 대시보드

이 대시보드에는 게이지 또는 스파크라인이 없는 Scorecard가 표시됩니다. 예시에서는 Compute Engine CPU 사용률을 보여주며 스코어카드에는 두 개의 임곗값이 있습니다. 한 임곗값은 노란색을 사용하여 CPU 사용률이 70% 이상임을 나타내고, 다른 임곗값은 빨간색을 사용하여 CPU 사용률이 90% 이상임을 나타냅니다.

현재 CPU 사용률이 지정된 임곗값보다 낮으므로 색상은 녹색입니다.

{
  "dashboardFilters": [],
  "displayName": "Example-basic scorecard",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 8,
        "widget": {
          "scorecard": {
            "thresholds": [
              {
                "color": "YELLOW",
                "direction": "ABOVE",
                "label": "",
                "value": 0.7
              },
              {
                "color": "RED",
                "direction": "ABOVE",
                "label": "",
                "value": 0.9
              }
            ],
            "timeSeriesQuery": {
              "outputFullDuration": true,
              "timeSeriesFilter": {
                "aggregation": {
                  "alignmentPeriod": "60s",
                  "crossSeriesReducer": "REDUCE_MEAN",
                  "groupByFields": [],
                  "perSeriesAligner": "ALIGN_MEAN"
                },
                "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
              }
            }
          },
          "title": "VM Instance - CPU utilization [MEAN]"
        },
        "width": 16
      }
    ]
  }
}

대시보드는 다음 예시와 비슷합니다.

스코어카드 위젯이 있는 대시보드 예시

GaugeView를 사용한 Scorecard가 있는 대시보드

이 대시보드는 이전 예시의 기본 스코어카드에 게이지를 추가합니다. GaugeView 객체는 상한값과 하한값을 지정하여 게이지에 표시할 값의 범위를 지정할 수 있습니다. 스코어카드는 0에서 1 사이의 값을 표시하므로 상한과 하한이 적절합니다. 게이지를 추가하려면 기본 스코어카드의 JSON에 다음을 추가합니다.

  "gaugeView": {
    "lowerBound": 0,
    "upperBound": 1,
  },

다음은 전체 수정된 대시보드 사양을 보여줍니다. 현재 값이 임곗값보다 낮으며 이 값은 게이지에 적절하게 색이 지정됩니다.

{
  "dashboardFilters": [],
  "displayName": "Example-Gauge",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 8,
        "widget": {
          "scorecard": {
            "gaugeView": {
              "lowerBound": 0,
              "upperBound": 1
            },
            "thresholds": [
              {
                "color": "YELLOW",
                "direction": "ABOVE",
                "label": "",
                "value": 0.7
              },
              {
                "color": "RED",
                "direction": "ABOVE",
                "label": "",
                "value": 0.9
              }
            ],
            "timeSeriesQuery": {
              "outputFullDuration": true,
              "timeSeriesFilter": {
                "aggregation": {
                  "alignmentPeriod": "60s",
                  "crossSeriesReducer": "REDUCE_MEAN",
                  "groupByFields": [],
                  "perSeriesAligner": "ALIGN_MEAN"
                },
                "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
              }
            }
          },
          "title": "VM Instance - CPU utilization [MEAN]"
        },
        "width": 16
      }
    ]
  }
}

이 대시보드의 차트는 다음 예시와 비슷합니다.

GaugeView를 사용한 스코어카드 위젯이 있는 대시보드 예시

SparkChartView를 사용한 Scorecard가 있는 대시보드

이 대시보드는 이전 예시의 게이지를 스파크라인으로 대체합니다. SparkChartView 객체는 스코어카드에 선 차트 또는 막대 그래프를 만들 수 있습니다. 이 예시에서는 줄을 사용하며, 값이 임곗값을 위반하지 않는 한 녹색입니다. 스파크라인을 추가하려면 이전 차트의 gaugeView JSON 객체를 다음으로 바꿉니다.

  "sparkChartView": {
    "sparkChartType": "SPARK_LINE"
  },

스코어카드는 다음 예시와 비슷합니다.

SparkChartView가 포함된 스코어카드 위젯이 있는 대시보드 예시

PieChart 위젯이 있는 대시보드

대시보드에는 원형 차트를 사용하여 데이터를 표시할 수 있습니다. 각 시계열은 원형 차트의 한 조각에 해당합니다. 원형 차트에는 시간 경과에 따른 데이터가 표시되지 않고 대신 최신 값만 표시됩니다.

모든 원형 차트는 PieChart 위젯으로 지정됩니다. 최신 측정 항목의 합계를 표시하도록 차트를 구성하려면 chartType 필드를 DONUT으로 설정합니다. 그렇지 않으면 이 필드를 PIE 값으로 설정합니다.

"pieChart": {
  "chartType": "DONUT",
},

다음 예시에서는 원형 차트 두 개가 있는 대시보드를 구성하는데, 원형 차트 하나는 도넛으로 구성됩니다.

{
  "dashboardFilters": [],
  "displayName": "Example Pie Donut",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "pieChart": {
            "chartType": "DONUT",
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_RATE"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/disk/read_bytes_count\" resource.type=\"gce_instance\"",
                    "secondaryAggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_MEAN"
                    }
                  }
                }
              }
            ]
          },
          "title": "VM Instance - Disk read bytes [MEAN]"
        },
        "width": 24
      },
      {
        "height": 16,
        "widget": {
          "pieChart": {
            "chartType": "PIE",
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_RATE"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/disk/read_bytes_count\" resource.type=\"gce_instance\"",
                    "secondaryAggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_MEAN"
                    }
                  }
                }
              }
            ]
          },
          "title": "VM Instance - Disk read bytes [MEAN]"
        },
        "width": 24,
        "xPos": 24
      },
    ]
  }
}

다음 스크린샷에 표시된 것처럼 두 위젯 모두 데이터를 원형 차트로 표시하고 하나의 위젯은 최근 값의 합계를 표시합니다.

**PieChart** 위젯 예시

TimeSeriesTable 위젯이 있는 대시보드

대시보드는 모니터링 시계열마다 행이 하나씩 있는 테이블 형식으로 데이터를 표시할 수 있습니다. 테이블에는 시간 경과에 따른 데이터가 표시되지 않고 대신 최신 값만 표시됩니다.

TimeSeriesTable 위젯에서 모든 테이블을 지정합니다.

  • 표시할 최대 행 수를 구성하려면 pickTimeSeriesFilter 필드를 설정합니다. 예를 들어 이전 10분 동안의 평균 값이 가장 큰 시계열 두 개만 표시하려면 다음을 포함합니다.

    "pickTimeSeriesFilter": {
        "direction": "TOP",
        "numTimeSeries": 2,
        "rankingMethod": "METHOD_MEAN"
    },
    

    pickTimeSeriesFilter 필드를 생략하면 테이블에 행이 최대 300개까지 표시됩니다.

  • 테이블에 데이터가 표시되는 방법을 구성하려면 metricVisualization 필드를 사용합니다.

    • '25%'와 같은 값만 표시하려면 이 필드를 생략하거나 값을 "NUMBER"로 설정합니다. 이 구성을 사용하면 Google Cloud 콘솔에서 위젯이 테이블 위젯으로 표시됩니다.
    • 값과 값의 시각적 표시를 가능한 값의 범위와 비교하여 표시하려면 이 필드의 값을 "BAR"로 설정합니다. 이 구성을 사용하면 Google Cloud 콘솔에서 위젯이 상위 목록 위젯으로 표시합니다.
  • 표시할 열을 구성하려면 columnSettings 필드를 사용합니다. 다음 예시에서는 2개의 열이 있는 테이블을 만듭니다. 하나는 필수 열인 Latest Value이고 다른 하나는 Name (from instance_id)입니다.

    "columnSettings": [
      {
        "column": "Name (from instance_id)",
        "visible": true
      }
    ],
    

    columnSettings 필드를 생략하면 테이블에 각 라벨당 하나의 열이 표시됩니다.

다음 예시는 테이블 위젯과 상위 목록 위젯이 있는 대시보드를 보여줍니다.

{
  "dashboardFilters": [],
  "displayName": "Example",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "timeSeriesTable": {
            "columnSettings": [
              {
                "column": "value",
                "visible": false
              }
            ],
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_MEAN"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "metricVisualization": "NUMBER"
          },
          "title": "Table"
        },
        "width": 24,
        "yPos": 16
      },
      {
        "height": 16,
        "widget": {
          "timeSeriesTable": {
            "columnSettings": [
              {
                "column": "value",
                "visible": false
              }
            ],
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_MEAN"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "metricVisualization": "BAR"
          },
          "title": "Top List"
        },
        "width": 24
      }
    ]
  }
}

다음 스크린샷과 같이 두 위젯 모두 데이터를 표 형식으로 표시하고 필터 표시줄을 포함합니다. 그러나 두 위젯은 서로 다른 열을 표시하고 숫자 값을 다르게 나타내도록 사전 구성됩니다.

테이블 위젯이 있는 대시보드 예시

표의 열은 라벨에 해당합니다. 각 행은 시계열에 해당합니다.

Text 위젯이 있는 대시보드

이 예시에서는 Text 위젯이 있는 대시보드를 보여줍니다.

{
  "dashboardFilters": [],
  "displayName": "DB2+TE",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
    ...
      {
        "height": 16,
        "widget": {
          "text": {
            "content": "# Support information\n\n\nContact information: my-support-team@example.com\nOnline help: [Playbooks](https://example.com)\n\n",
            "format": "MARKDOWN",
            "style": {
              "backgroundColor": "",
              "fontSize": "FS_LARGE",
              "horizontalAlignment": "H_LEFT",
              "padding": "P_EXTRA_SMALL",
              "textColor": "",
              "verticalAlignment": "V_TOP"
            }
          }
        },
        "width": 24,
        "yPos": 14
      }
    ]
  }
}

텍스트 위젯은 다음 예시와 비슷합니다.

텍스트 위젯 예시

AlertChart 위젯이 있는 대시보드

이 대시보드에서는 AlertChart 위젯이 있는 대시보드를 보여줍니다.

{
  "category": "CUSTOM",
  "displayName": "Alert chart example",
  "mosaicLayout": {
    "columns": 12,
    "tiles": [
      {
        "height": 4,
        "widget": {
          "alertChart": {
            "name": "projects/my-project/alertPolicies/14205854094151528373"
          }
        },
        "width": 6,
      }
    ]
  }
}

다른 대시보드 위젯과 달리 이 위젯에 대해서는 제목 또는 측정항목 필터를 지정하지 않습니다. 대신 알림 정책에 대해 리소스 이름을 지정합니다. name 필드의 마지막 항목이 알림 정책 식별자입니다.

대시보드의 차트는 다음 예시와 비슷합니다.

알림 차트의 예시

이 예시에서 알림 정책은 두 가지 서로 다른 가상 머신의 CPU 사용을 모니터링합니다. 점선은 50%로 설정된 조건 기준을 나타냅니다. No incidents 라벨이 있는 녹색 칩은 알림 정책에 대해 미해결된 이슈가 없음을 나타냅니다. 포인터를 이슈 칩에 배치하면 기본 알림 정책과 연결된 대화상자가 열립니다.

ErrorReportingPanel 위젯이 있는 대시보드

이 대시보드에서는 ErrorReportingPanel 위젯이 있는 대시보드를 보여줍니다.

{
  "dashboardFilters": [],
  "displayName": "Error reporting widget",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "errorReportingPanel": {
            "projectNames": [
              "projects/my-project"
            ],
            "services": [],
            "versions": []
          },
          "title": "Error Reporting Panel"
        },
        "width": 24,
      }
    ]
  }
}

Error Reporting 패널의 높이는 최소 16단위로, 너비는 최소 24단위로 구성하는 것이 좋습니다. 이전 예시에서 위젯의 높이는 16단위, 너비는 24단위입니다.

Error Reporting 패널에는 선택한 프로젝트의 오류 그룹이 표시되며 이 패널은 오류 그룹을 특정 리소스 유형, 서비스, 서비스 버전으로 제한할 수 있습니다. 다음 예시에서는 Error Reporting 패널을 보여줍니다.

Error Reporting 패널 구성 창의 예시

IncidentList 위젯이 있는 대시보드

이 대시보드에서는 IncidentList 위젯이 있는 대시보드를 보여줍니다.

{
  "category": "CUSTOM",
  "dashboardFilters": [],
  "displayName": "Incident widget",
  "labels": {},
  "mosaicLayout": {
    "columns": 12,
    "tiles": [
      {
        "height": 5,
        "widget": {
          "incidentList": {
            "monitoredResources": [],
            "policyNames": []
          },
          "title": "Incidents"
        },
        "width": 8,
        "xPos": 0,
        "yPos": 0
      }
    ]
  }
}

앞의 예시에서는 title 필드를 Incidents로 설정하고 gce_instance 유형의 리소스에 대한 모든 이슈를 표시하도록 위젯을 구성합니다. 이 위젯을 구성할 때 여러 알림 정책 또는 여러 리소스 유형을 선택할 수 있습니다.

대시보드의 이슈 위젯은 다음 예시와 비슷합니다.

이슈 위젯의 예시

LogsPanel 위젯이 있는 대시보드

이 예시에서는 LogsPanel 위젯이 있는 대시보드를 보여줍니다.

{
  "category": "CUSTOM",
  "displayName": "Logs Panel",
  "mosaicLayout": {
    "columns": 12,
    "tiles": [
      {
        "height": 4,
        "widget": {
          "logsPanel": {
            "filter": "",
            "resourceNames": [
              "projects/012012012012"
            ]
          },
          "title": "Logs Panel"
        },
        "width": 6,
        "xPos": 0,
        "yPos": 0
      }
    ]
  }
}

로그 패널의 높이는 최소 3단위로, 너비는 최소 4단위로 구성하는 것이 좋습니다. 이전 예시에서 위젯의 높이는 4단위, 너비는 6단위입니다.

로그 패널에는 resourceNames 필드에 나열된 Google Cloud 프로젝트의 로그가 표시됩니다. 위의 예시에서는 하나의 프로젝트만 지정합니다. 하지만 이 목록에 여러 프로젝트를 포함할 수도 있습니다.

로그 패널은 다음 예시와 비슷하게 표시됩니다.

로그 패널 위젯이 있는 대시보드 예시

문제 해결 정보는 로그 패널이 있는 대시보드를 만들기 위한 API 호출 실패를 참조하세요.

CollapsibleGroup 위젯이 있는 대시보드

이 예시에서는 CollapsibleGroup 위젯이 있는 대시보드를 보여줍니다.

{
  "category": "CUSTOM",
  "displayName": "Group testing",
  "mosaicLayout": {
    "columns": 12,
    "tiles": [
      {
        "height": 4,
        "widget": {
          "collapsibleGroup": {
            "collapsed": false
          },
          "title": "My group"
        },
        "width": 12,
        "xPos": 0,
        "yPos": 0
      },
      {
        "height": 4,
        "widget": {
          "title": "VM Instance - CPU utilization [MEAN]",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "plotType": "LINE",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "apiSource": "DEFAULT_CLOUD",
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "crossSeriesReducer": "REDUCE_NONE",
                      "perSeriesAligner": "ALIGN_MEAN"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" resource.type=\"gce_instance\"",
                    "secondaryAggregation": {
                      "alignmentPeriod": "60s",
                      "crossSeriesReducer": "REDUCE_NONE",
                      "perSeriesAligner": "ALIGN_NONE"
                    }
                  }
                }
              }
            ],
            "thresholds": [],
            "timeshiftDuration": "0s",
            "yAxis": {
              "label": "y1Axis",
              "scale": "LINEAR"
            }
          }
        },
        "width": 6,
        "xPos": 0,
        "yPos": 0
      }
    ]
  }
}

이전 예시에서 접을 수 있는 그룹 위젯에는 VM 인스턴스의 CPU 사용률을 표시하는 단일 차트가 포함되어 있습니다. 접을 수 있는 그룹 위젯은 테이블의 전체 행을 포함합니다. 그룹의 (x,y) 위치 및 높이 사양에 위젯의 (x,y) 위치가 포함되어 있으면 위젯이 그룹에 포함됩니다. 위의 예시에서 그룹은 (0,0) 위치에 있고 높이는 4입니다. xyChart는 (0,0) 위치에 있으므로 그룹에 포함됩니다. 그러나 차트의 위치가 (0,5)로 변경되면 차트가 그룹에서 제외됩니다. 마지막으로 위젯의 (x,y) 위치로 인해 위젯이 그룹에 포함되는 경우 접을 수 있는 그룹 위젯의 높이가 확장될 수 있습니다.

대시보드에 그룹 위젯을 포함하려면 대시보드에 MosaicLayout이 있어야 합니다.

축소형 그룹 위젯은 다음 예시와 비슷하게 표시됩니다.

축소형 그룹 위젯이 있는 대시보드 예시

SingleViewGroup 위젯이 있는 대시보드

SingleViewGroup 위젯은 그룹의 구성원을 한 번에 한 명씩 표시합니다. 그룹의 구성원인 차트와 기타 위젯을 지정합니다. 또한 SingleViewGroup 위젯의 메뉴를 사용하여 그룹에 표시되는 위젯을 제어할 수 있습니다.

이 대시보드에는 SingleViewGroup 위젯이 있는 대시보드를 보여줍니다.

{
  "dashboardFilters": [],
  "displayName": "Example",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "singleViewGroup": {},
          "title": "Untitled group"
        },
        "width": 24,
        "yPos": 16
      },
      {
        "height": 16,
        "widget": {
          "title": "VM Instance - Disk read bytes [RATE]",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "plotType": "LINE",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_RATE"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/disk/read_bytes_count\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "thresholds": [],
            "yAxis": {
              "label": "",
              "scale": "LINEAR"
            }
          }
        },
        "width": 24,
        "yPos": 16
      },
      {
        "height": 16,
        "widget": {
          "title": "VM Instance - Disk write bytes [RATE]",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "plotType": "LINE",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_RATE"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "thresholds": [],
            "yAxis": {
              "label": "",
              "scale": "LINEAR"
            }
          }
        },
        "width": 24,
        "yPos": 16
      }
    ]
  }
}

이전 예시와 같이 tiles 배열에는 하나의 SingleViewGroup 객체가 포함되어 있지만 해당 객체에 어떤 객체가 포함되는지 지정하지 않습니다. 대신 SingleViewGroup 객체의 멤버십은 widthyPos 필드의 값에 따라 결정됩니다. width 객체와 yPos 필드의 값이 SingleViewGroup 객체의 값과 일치하는 객체는 SingleViewGroup 객체에 포함됩니다. 이전 예시에서 SingleViewGroup 객체에는 차트 두 개가 포함되어 있습니다.

SectionHeader 위젯이 있는 대시보드

SectionHeader 위젯은 대시보드에 가로 구분선을 만들고 대시보드의 목차에 항목을 만듭니다. 목차의 항목을 맞춤설정하고 위젯에 추가 정보를 포함할 수 있습니다. 목차에서 섹션 헤더 항목 뒤에 구분선을 추가하도록 위젯을 구성할 수도 있습니다.

다음은 단일 차트와 SectionHeader 위젯이 있는 대시보드입니다.

{
  "dashboardFilters": [],
  "displayName": "Example",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "title": "VM Instance - Disk write bytes [RATE]",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "minAlignmentPeriod": "60s",
                "plotType": "LINE",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "alignmentPeriod": "60s",
                      "perSeriesAligner": "ALIGN_RATE"
                    },
                    "filter": "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" resource.type=\"gce_instance\""
                  }
                }
              }
            ],
            "thresholds": [],
            "yAxis": {
              "label": "",
              "scale": "LINEAR"
            }
          }
        },
        "width": 24,
        "yPos": 4
      },
      {
        "height": 4,
        "widget": {
          "sectionHeader": {
            "dividerBelow": true,
            "subtitle": "Instance metrics"
          },
          "title": "Metrics"
        },
        "width": 48
      }
    ]
  }
}

SectionHeader 객체에서 title 필드의 값은 위젯과 목차에 모두 표시됩니다. subtitle 필드의 값은 위젯에서만 표시됩니다. dividerBelow 값이 true이면 목차에 구분선이 추가됩니다.

SLO 위젯이 있는 대시보드

이 예시에서는 SLO 위젯이 있는 대시보드를 보여줍니다.

{
  "dashboardFilters": [],
  "displayName": "Example",
  "labels": {},
  "mosaicLayout": {
    "columns": 48,
    "tiles": [
      {
        "height": 16,
        "widget": {
          "title": "SLO Error Budget: 99.5% - Distribution Cut - Calendar month",
          "xyChart": {
            "chartOptions": {
              "mode": "COLOR"
            },
            "dataSets": [
              {
                "breakdowns": [],
                "dimensions": [],
                "legendTemplate": "Remaining error requests before SLO is burned",
                "measures": [],
                "plotType": "LINE",
                "targetAxis": "Y1",
                "timeSeriesQuery": {
                  "timeSeriesFilter": {
                    "aggregation": {
                      "perSeriesAligner": "ALIGN_NEXT_OLDER"
                    },
                    "filter": "select_slo_budget(\"projects/Project_Number/services/SERVICE_ID/serviceLevelObjectives/SLO_ID\")",
                  },
                  "unitOverride": "1"
                }
              }
            ],
            "thresholds": []
          }
        },
        "width": 24
      }
    ]
  }
}

이전 JSON에 표시된 것처럼 SLO 차트는 XyChart 객체로 표현됩니다. 이러한 객체는 모든 집계 필드, 임곗값을 지정하며 filter 필드의 값은 시계열 선택기입니다. 이러한 선택기에 대한 자세한 내용은 SLO 데이터 검색을 참조하세요.

SLO 위젯은 다음 예시와 비슷합니다.

SLO 위젯이 있는 대시보드 예시

빈 위젯이 있는 대시보드

이 예시는 빈 자리표시자 위젯이 있는 대시보드를 보여줍니다. displayName 필드의 값이 위젯에 표시됩니다.

{
  "displayName": "Demo Dashboard",
  "gridLayout": {
    "widgets": [
      {
        "blank": {}
      }
    ]
  }
}

대시보드는 다음 예시와 비슷합니다.

빈 위젯이 있는 대시보드 예시

영구 필터가 있는 대시보드

영구 필터가 있는 대시보드의 예시는 대시보드 필터를 참조하세요.