Grafana ECS Service YACE Dashboard

验证:未记录
适用版本
未记录
验证范围
尚未登记验证记录。
本文缩写(英文全称与中文含义)
缩写 英文全称/名称 中文含义
ALB Application Load Balancer 应用负载均衡器
AWS Amazon Web Services 亚马逊云服务
CPU Central Processing Unit 中央处理器
ECS Elastic Container Service AWS 容器编排服务
HTTP Hypertext Transfer Protocol 超文本传输协议
JSON JavaScript Object Notation 一种结构化数据格式
YACE Yet Another CloudWatch Exporter 把 CloudWatch 指标转换为 Prometheus 指标的采集器

1. YACE Config#

apiVersion: v1alpha1
sts-region: ap-northeast-1
discovery:
  jobs:
    - type: AWS/ECS
      regions: [ap-northeast-1]
      customTags:
        - key: environment
          value: uat
      period: 300
      length: 600
      nilToZero: true
      metrics:
        - name: CPUUtilization
          statistics: [Average]
        - name: MemoryUtilization
          statistics: [Average]
    - type: ECS/ContainerInsights
      regions: [ap-northeast-1]
      customTags:
        - key: environment
          value: uat
      period: 300
      length: 600
      nilToZero: true
      metrics:
        - name: RunningTaskCount
          statistics: [Average]
        - name: DesiredTaskCount
          statistics: [Average]
        - name: PendingTaskCount
          statistics: [Average]

Dashboard 选择:

多环境共用数据源时必须按真实 environment / Region / cluster labels 筛选;只靠同名 service 会把不同环境聚到一起。

aws-ecs-service-yace-overview-dashboard.json:
    使用 $dimension_ServiceName 过滤。
    适合单一环境,或者同一个 Prometheus 里只有一个环境的 ECS metrics。

aws-ecs-service-yace-env-overview-dashboard.json:
    使用 $environment + $dimension_ServiceName 过滤。
    适合同一个 Prometheus / VictoriaMetrics 里同时存在 uat、prod 等多个环境的 ECS metrics。

2. Dashboard Rows#

Row Panels
Service Health running vs desired tasks, CPU, memory, pending task count
Scaling Signals running / desired / pending by service, CPU / memory trend, desired-running gap with pending

Why only 2 rows:

ECS service 原生 metrics 不多。
如果没有接入 ALB request/error/latency 和应用 Prometheus metrics,拆成 4 层通常只会重复展示 task count、CPU、memory。

所以这个 dashboard 收缩成两行更实用:
    Service Health:
        先看服务是不是在正常运行

    Scaling Signals:
        再看是不是扩容策略、deployment、capacity provider 出了问题

Trend note:

CPU / Memory Trend 不是原始单点值。
当前使用最近 1 小时 rolling average,
用来判断长期资源水位,而不是看短时间 spike。

Metric availability note:

AWS/ECS:
    CPUUtilization
    MemoryUtilization

ECS/ContainerInsights:
    RunningTaskCount
    DesiredTaskCount
    PendingTaskCount

如果要让 dashboard 里的 task count / pending panel 有数据,
需要同时采这两个 namespace。

label note:
    current dashboard uses YACE labels like:
    dimension_ClusterName
    dimension_ServiceName

metric note:
    standard ECS metrics:
    aws_ecs_cpuutilization_average
    aws_ecs_memory_utilization_average

    Container Insights metrics:
    aws_ecs_containerinsights_running_task_count_average
    aws_ecs_containerinsights_desired_task_count_average
    aws_ecs_containerinsights_pending_task_count_average

3. Request / Error / Latency#

ECS namespace 不提供完整 request / error / latency。

HTTP service behind ALB:
    use AWS/ApplicationELB metrics
    RequestCount
    HTTPCode_Target_5XX_Count
    HTTPCode_ELB_5XX_Count
    TargetResponseTime

application-level view:
    use app Prometheus metrics
    http_requests_total
    http_request_duration_seconds
    error counter by route / status / exception

4. Verify#

{__name__=~"aws_ecs_.*"}
{__name__=~"aws_ecs_containerinsights_.*"}

搜索文档

输入关键词,搜索所有文档。

↑ ↓ 选择 · Enter 打开 · Esc 关闭