1. Dashboard Rule#

Folder: Infrastructure
Dashboard: EC2 - Overview
Variables: region, account, AutoScalingGroupName, InstanceId

Rows:
    Overview:
        默认展示全部 EC2 instances 的总览和 Top N 异常 instance
        通过 InstanceId filter 选择某台 EC2 后,查看这台 instance 的完整指标

    Drilldown:
        按 instance_id / Auto Scaling Group / volume_id 拆开看

    Capacity:
        CPU credit、disk、memory、EBS burst / queue 的趋势

    Debug:
        process、filesystem、EBS 细节,不放第一屏;只有排查具体 instance 问题时查看

Dashboard JSON:

aws-ec2-overview-dashboard.json:
    使用 Prometheus-compatible datasource,例如 VictoriaMetrics。
    OS metrics 来自 node_exporter。
    AWS native metrics 来自 YACE / CloudWatch exporter 写入 VictoriaMetrics。

aws-ec2-node-exporter-overview-dashboard.json:
    只使用 node_exporter。
    不依赖 CloudWatch / YACE。
    适合只想看 VM OS 层 CPU、memory、filesystem、network、disk。

如果你的 YACE metric name 或 label name 不同,先用下面的查询确认:
    {__name__=~"aws_ec2_.*"}
    {__name__=~"aws_ebs_.*"}

2. Overview#

默认视角:

All instances:
    显示全部 EC2 instances 的健康状态、整体资源压力、Top N 异常 instance
    Top N 表示按指标排序后最异常的前 N 台,例如 CPU 最高、memory 最高、disk 最满、EBS queue 最长

Single instance:
    通过 InstanceId filter 选择一台 EC2
    同一个 dashboard 的 Overview / Drilldown / Capacity / Debug rows 都切换到这台 instance
Panel Metrics Why
Instance health StatusCheckFailed, StatusCheckFailed_Instance, StatusCheckFailed_System EC2 是否已经进入 AWS/system/instance health failure
CPU usage CPUUtilization 判断 CPU 是否接近瓶颈
Memory usage mem_used_percent from CloudWatch Agent EC2 默认不提供 memory,需要 agent
Disk usage disk_used_percent from CloudWatch Agent 最常见 host 级故障之一
Network traffic NetworkIn, NetworkOut 看流量是否异常变化
EBS pressure VolumeQueueLength, BurstBalance pressure 指 EBS 接近瓶颈,例如 queue 变长或 burst credit 耗尽

3. Drilldown#

Panel Metrics Why
CPU by instance CPUUtilization grouped by InstanceId 找到具体高 CPU instance
Network by instance NetworkIn, NetworkOut, NetworkPacketsIn, NetworkPacketsOut 定位异常流量来源
Disk by mount disk_used_percent, disk_inodes_used 区分 root、data、log mount
Memory by instance mem_used_percent, mem_available_percent 判断 OOM 风险
EBS by volume VolumeReadOps, VolumeWriteOps, VolumeReadBytes, VolumeWriteBytes 定位具体 volume 的 I/O

4. Capacity#

Panel Metrics Why
CPU credit trend CPUCreditBalance, CPUSurplusCreditsCharged T family instance 必看,避免 credit 耗尽或额外收费
Disk growth disk_used_percent by mount 估算扩容时间
Memory trend mem_used_percent 识别长期内存增长
EBS burst trend BurstBalance gp2 / st1 / sc1 等 burst 相关 volume 的容量风险
EBS queue trend VolumeQueueLength 长期 queue 偏高通常说明 volume type / size / IOPS 不够

5. Debug#

Panel Metrics Why
Process health procstat_* from CloudWatch Agent 只对关键 process 配置,不放 overview
Filesystem inode disk_inodes_used inode 耗尽会表现为磁盘还有空间但无法写入
Detailed EBS latency VolumeTotalReadTime, VolumeTotalWriteTime 深入 storage latency 时使用

6. YACE Metrics#

如果 dashboard 使用 aws_ec2_* / aws_ebs_* 这类 Prometheus metrics,这些指标需要先由 YACE 从 CloudWatch 拉取,再写入 VictoriaMetrics。

YACE config:

apiVersion: v1alpha1
sts-region: ap-northeast-1
discovery:
  jobs:
    - type: AWS/EC2
      regions:
        - ap-northeast-1
      customTags:
        - key: environment
          value: uat
      period: 300
      length: 600
      nilToZero: true
      metrics:
        - name: StatusCheckFailed
          statistics: [Maximum]
        - name: StatusCheckFailed_Instance
          statistics: [Maximum]
        - name: StatusCheckFailed_System
          statistics: [Maximum]
        - name: CPUUtilization
          statistics: [Average]
        - name: CPUCreditBalance
          statistics: [Average]
        - name: CPUSurplusCreditsCharged
          statistics: [Sum]
        - name: NetworkIn
          statistics: [Sum]
        - name: NetworkOut
          statistics: [Sum]
        - name: NetworkPacketsIn
          statistics: [Sum]
        - name: NetworkPacketsOut
          statistics: [Sum]

    - type: AWS/EBS
      regions:
        - ap-northeast-1
      customTags:
        - key: environment
          value: uat
      period: 300
      length: 600
      nilToZero: true
      metrics:
        - name: VolumeQueueLength
          statistics: [Average]
        - name: BurstBalance
          statistics: [Average]
        - name: VolumeReadOps
          statistics: [Sum]
        - name: VolumeWriteOps
          statistics: [Sum]
        - name: VolumeReadBytes
          statistics: [Sum]
        - name: VolumeWriteBytes
          statistics: [Sum]
        - name: VolumeTotalReadTime
          statistics: [Sum]
        - name: VolumeTotalWriteTime
          statistics: [Sum]

确认 metric name:

{__name__=~"aws_ec2_.*"}
{__name__=~"aws_ebs_.*"}

node_exporter only dashboard 不需要这段 YACE 配置。

7. Do Not Put In Overview#

不要放:
    每个 process 的 CPU / memory 明细
    每个 filesystem 的所有 low-level counters
    所有 EBS byte / ops / time 原始指标

原因:
    overview 只回答服务是否健康和哪里饱和
    debug 面板过多会降低事故时的读取速度