사이드바에서 [모니터링 > 대시보드]로 이동한다. 상단의 [CREATE DASHBOARD]버튼을 눌러 새 대시보드를 생성한다.
도움말에 따라 직관적으로 차트를 추가할 수 있는데, json 값으로 수정할 수도 있다.
나는 다음과 같은 내용의 대시보드를 구성해서 써보고 있다.
INSTANCE_ID라고 적힌 부분을 인스턴스의 ID로 대체하면 된다. 인스턴스 ID는 사이드바에서 [Compute Engine > VM 인스턴스]로 진입해서 인스턴스 목록을 확인한 뒤, 원하는 인스턴스의 이름을 눌러 확인할 수 있다.
{
"category": "CUSTOM",
"displayName": "My Dashboard",
"mosaicLayout": {
"columns": 12,
"tiles": [
{
"height": 3,
"widget": {
"title": "CPU Utilization",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"legendTemplate": "CPU Utilization",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"crossSeriesReducer": "REDUCE_NONE",
"perSeriesAligner": "ALIGN_MEAN"
},
"filter": "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" AND resource.label.instance_id=\"INSTANCE_ID\" AND resource.type=\"gce_instance\""
},
"unitOverride": "percent"
}
}
]
}
},
"width": 6,
"xPos": 0,
"yPos": 3
},
{
"height": 4,
"widget": {
"title": "Disk I/O",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"legendTemplate": "${metric.labels.device_name}: ${shortMetric}",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"crossSeriesReducer": "REDUCE_NONE",
"perSeriesAligner": "ALIGN_RATE"
},
"filter": "metric.type=\"compute.googleapis.com/instance/disk/read_bytes_count\" AND resource.label.instance_id=\"INSTANCE_ID\" AND resource.type=\"gce_instance\""
}
}
},
{
"legendTemplate": "${metric.labels.device_name}: ${shortMetric}",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"crossSeriesReducer": "REDUCE_NONE",
"perSeriesAligner": "ALIGN_RATE"
},
"filter": "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.label.instance_id=\"INSTANCE_ID\" AND resource.type=\"gce_instance\""
}
}
}
]
}
},
"width": 6,
"xPos": 6,
"yPos": 10
},
{
"height": 4,
"widget": {
"title": "Network Traffic",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"legendTemplate": "${shortMetric}",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"crossSeriesReducer": "REDUCE_SUM",
"perSeriesAligner": "ALIGN_RATE"
},
"filter": "metric.type=\"compute.googleapis.com/instance/network/received_bytes_count\" AND resource.label.instance_id=\"INSTANCE_ID\" AND resource.type=\"gce_instance\""
}
}
},
{
"legendTemplate": "${shortMetric}",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"crossSeriesReducer": "REDUCE_SUM",
"perSeriesAligner": "ALIGN_RATE"
},
"filter": "metric.type=\"compute.googleapis.com/instance/network/sent_bytes_count\" AND resource.label.instance_id=\"INSTANCE_ID\" AND resource.type=\"gce_instance\""
}
}
}
]
}
},
"width": 6,
"xPos": 6,
"yPos": 6
},
{
"height": 4,
"widget": {
"title": "Memory",
"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/memory/balloon/ram_used\" resource.type=\"gce_instance\" resource.label.\"instance_id\"=\"INSTANCE_ID\""
}
}
},
{
"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/memory/balloon/ram_size\" resource.type=\"gce_instance\" resource.label.\"instance_id\"=\"INSTANCE_ID\""
}
}
},
{
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_PERCENTILE_99",
"perSeriesAligner": "ALIGN_MAX"
},
"filter": "metric.type=\"compute.googleapis.com/instance/memory/balloon/ram_used\" resource.type=\"gce_instance\" resource.label.\"instance_id\"=\"INSTANCE_ID\""
}
}
}
],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
"width": 6,
"xPos": 6,
"yPos": 2
},
{
"height": 3,
"widget": {
"title": "CPU Usage",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"legendTemplate": "CPU Usage",
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_NONE",
"perSeriesAligner": "ALIGN_RATE"
},
"filter": "metric.type=\"compute.googleapis.com/instance/cpu/usage_time\" resource.type=\"gce_instance\" resource.label.\"instance_id\"=\"INSTANCE_ID\""
}
}
}
],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
"width": 6,
"xPos": 0,
"yPos": 0
},
{
"height": 3,
"widget": {
"title": "Connection Count",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_NONE",
"perSeriesAligner": "ALIGN_COUNT"
},
"filter": "metric.type=\"networking.googleapis.com/vm_flow/connection_count\" resource.type=\"gce_instance\" resource.label.\"instance_id\"=\"INSTANCE_ID\""
}
}
}
],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
"width": 6,
"xPos": 0,
"yPos": 11
},
{
"height": 2,
"widget": {
"scorecard": {
"sparkChartView": {
"sparkChartType": "SPARK_LINE"
},
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_MAX",
"perSeriesAligner": "ALIGN_MAX"
},
"filter": "metric.type=\"compute.googleapis.com/instance/uptime_total\" resource.type=\"gce_instance\" resource.label.\"instance_id\"=\"INSTANCE_ID\""
}
}
},
"title": "Uptime Total"
},
"width": 6,
"xPos": 0,
"yPos": 6
},
{
"height": 2,
"widget": {
"scorecard": {
"gaugeView": {
"upperBound": 1020662906
},
"thresholds": [
{
"color": "RED",
"direction": "ABOVE",
"label": "",
"value": 816530324
},
{
"color": "YELLOW",
"direction": "ABOVE",
"label": "",
"value": 612397743
}
],
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_MEAN",
"perSeriesAligner": "ALIGN_MEAN"
},
"filter": "metric.type=\"compute.googleapis.com/instance/memory/balloon/ram_used\" resource.type=\"gce_instance\" resource.label.\"instance_id\"=\"INSTANCE_ID\""
}
}
},
"title": "Memory Used"
},
"width": 6,
"xPos": 6,
"yPos": 0
},
{
"height": 3,
"widget": {
"title": "Connection Count",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "LINE",
"targetAxis": "Y1",
"timeSeriesQuery": {
"apiSource": "DEFAULT_CLOUD",
"timeSeriesFilter": {
"aggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_NONE",
"perSeriesAligner": "ALIGN_RATE"
},
"filter": "metric.type=\"networking.googleapis.com/vm_flow/connection_count\" resource.type=\"gce_instance\" resource.label.\"instance_id\"=\"INSTANCE_ID\"",
"secondaryAggregation": {
"alignmentPeriod": "60s",
"crossSeriesReducer": "REDUCE_NONE",
"perSeriesAligner": "ALIGN_MEAN"
}
}
}
}
],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
},
"width": 6,
"xPos": 0,
"yPos": 8
}
]
}
}