Dashboard Standard#

Grafana dashboard 按服务拆分,不把所有 metrics 放到一个大 dashboard。

Folder:
    按服务类型分组,例如 Infrastructure / Compute / Messaging / Database / Edge

Dashboard:
    一个服务一个 Overview dashboard
    dashboard 里面用 rows / sections 分成四层
    默认不要为 Overview / Drilldown / Capacity / Debug 各建一个 dashboard

Variables:
    每个 dashboard 必须有 service-specific filters
    默认看全部对象集合的总览,例如全部 EC2 instances / 全部 SQS queues
    Top N 表示按指标排序后最异常的前 N 个对象,例如 CPU 最高的 10 台 EC2
    选中某个 instance / queue / table / distribution 后,再查看这个对象的完整 rows

Rows:
    Overview: 值班第一屏,只放健康、流量、错误、延迟、饱和度
    Drilldown: 事故定位,按维度拆开看
    Capacity: 容量趋势、配额、剩余空间、增长速度
    Debug: 低频细节,不放第一屏;只有排查具体问题时查看

Folder Standard#

Grafana folder 按服务类型分,不按团队随意堆。这样 dashboard 多了以后,值班时可以先定位资源类型,再找具体服务。

Folder Put These Dashboards Examples
Infrastructure VM / host / OS / node-level resources EC2 - Overview, Linux Host - Overview
Services business services and application-facing dashboards order-api - Overview, payment-worker - Overview
Compute managed compute runtime / scheduler layer ECS Service - Overview, EKS Workload - Overview
Traffic load balancer / ingress / gateway ALB - Overview, Nginx Ingress - Overview
Messaging queue / stream / event bus SQS - Overview, Kafka - Overview
Database database and cache DynamoDB - Overview, PostgreSQL - Overview, ElastiCache - Overview
Storage object/block/file storage S3 - Overview, EBS - Overview
Edge CDN / public edge / DNS edge CloudFront - Overview, Route53 - Overview
Observability monitoring/logging platform itself VictoriaMetrics - Overview, Grafana - Overview, vmauth - Overview

当前服务建议:

Service Folder Dashboard Name
EC2 Infrastructure EC2 - Overview
ECS Service Compute or Services ECS Service - Overview for platform view; <service-name> - Overview for business service view
SQS Messaging SQS - Overview
ALB Traffic ALB - Overview
DynamoDB Database DynamoDB - Overview
PostgreSQL Database PostgreSQL - Overview
ElastiCache Database ElastiCache - Overview
CloudFront Edge CloudFront - Overview

命名规则:

platform / shared resource:
    <service> - Overview
    examples:
        EC2 - Overview
        ALB - Overview
        DynamoDB - Overview

business service:
    <service-name> - Overview
    examples:
        order-api - Overview
        payment-worker - Overview

avoid:
    prod-dashboard
    aws-dashboard
    misc
    service-monitoring

术语说明:

fleet:
    一组同类资源的集合。本文尽量直接写“全部 EC2 instances / 全部 queues”,避免只写 fleet。

Top N:
    按某个指标排序后最异常的前 N 个对象,例如 CPU 最高的 10 台 EC2。

saturation / pressure:
    资源接近瓶颈,例如 CPU 高、memory 高、disk 快满、EBS queue 变长。

Basic Knowledge#

读这个目录下的 dashboard 文档前,需要先理解这几个关系。

Metrics Path#

node_exporter / YACE / app exporter
    -> vmagent / Prometheus scrape
    -> VictoriaMetrics storage
    -> Grafana Prometheus datasource
    -> dashboard variables and panels

含义:

node_exporter:
    装在 EC2 / Linux VM 上,暴露 OS 指标,例如 CPU、memory、filesystem、network、disk。

YACE:
    从 AWS CloudWatch 拉 AWS 服务指标,然后暴露成 Prometheus 格式。
    例如 aws_ec2_status_check_failed_maximum、aws_sqs_approximate_age_of_oldest_message_maximum。
    discovery 模式依赖 AWS resource tags;tag 标准见 AWS Tags。
    部分 AWS metrics 是 sparse / event-driven,没有发生事件时 CloudWatch 和 YACE 里可能暂时看不到。

VictoriaMetrics:
    Prometheus-compatible metrics storage。
    Grafana 里通常把它配置成 Prometheus datasource。

Grafana dashboard:
    不直接“产生”指标。
    它只是用 PromQL 查询 VictoriaMetrics 里已经存在的 metrics。

Grafana Variables#

Grafana variable 是 dashboard 顶部的 filter。变量名在 PromQL 里用 $name 引用。

例如:

up{job=~"$node_job",instance=~"$node_instance"}

这里:

$node_job:
    Grafana dashboard variable。
    对应 Prometheus label: job。
    通常来自 scrape config 的 job_name,例如 node / node-exporter。

$node_instance:
    Grafana dashboard variable。
    对应 Prometheus label: instance。
    通常来自 scrape target,例如 10.0.1.10:9100。

job:
    Prometheus label,不是 Grafana 自己生成的。
    vmagent / Prometheus scrape config 里 job_name 会变成 job label。

instance:
    Prometheus label,不是 AWS EC2 InstanceId。
    默认通常是 scrape target address,例如 ip:port。

最小 scrape config:

scrape_configs:
  - job_name: node
    static_configs:
      - targets:
          - 10.0.1.10:9100

上面这段会产生:

job="node"
instance="10.0.1.10:9100"

所以 dashboard 里:

$node_job = node
$node_instance = 10.0.1.10:9100

Common Variables#

Variable Usually Maps To Source Example
$node_job job label vmagent / Prometheus job_name node
$node_instance instance label scrape target 10.0.1.10:9100
$mountpoint mountpoint label node_exporter filesystem collector /, /data
$net_device device label node_exporter network collector eth0, ens5
$disk_device device label node_exporter disk collector nvme0n1, xvda
$aws_instance_id instance_id label YACE AWS/EC2 metrics i-0123456789abcdef0
$volume_id volume_id label YACE AWS/EBS metrics vol-0123456789abcdef0
$queue_name queue_name label YACE AWS/SQS metrics prod-order-events
$table_name table_name label YACE AWS/DynamoDB metrics customer_order_status

注意:

node_exporter instance:
    通常是 ip:port。

AWS EC2 InstanceId:
    通常是 i-xxxx。

这两个不是同一个东西。
如果要把 OS 指标和 AWS EC2 指标对应起来,需要统一 label 或在 dashboard 里分别选择。

Metric Name Rules#

node_exporter metrics:

node_cpu_seconds_total
node_memory_MemAvailable_bytes
node_filesystem_size_bytes
node_network_receive_bytes_total
node_disk_read_bytes_total

YACE metrics:

CloudWatch namespace + metric name + statistic

examples:
    AWS/EC2 StatusCheckFailed Maximum
        -> aws_ec2_status_check_failed_maximum

    AWS/EBS VolumeQueueLength Average
        -> aws_ebs_volume_queue_length_average

    AWS/SQS ApproximateAgeOfOldestMessage Maximum
        -> aws_sqs_approximate_age_of_oldest_message_maximum

YACE discovery 前置条件:

AWS resources should follow the standard in:
    /AWS/Tags/

searchTags key is case-sensitive:
    Environment != environment

searchTags value is regex:
    prod|staging matches prod or staging

AWS tags may appear as YACE metric labels:
    Env=uat -> tag_Env="uat"
    ManagedBy=Terraform -> tag_ManagedBy="Terraform"

If dashboards depend on tag_ labels, make them explicit with YACE exportedTagsOnMetrics.
exportedTagsOnMetrics does not discover untagged resources; it only controls exported labels.

YACE customTags can add static labels:
    key: environment, value: uat -> custom_tag_environment="uat"
    useful when one YACE job has a fixed account / region / environment context

If dashboard variables expect environment instead of custom_tag_environment:
    normalize it with Prometheus / vmagent metric_relabel_configs at scrape time

实际名称可能受 exporter 版本和配置影响,落地前先查:

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

Dashboard JSON#

dashboard JSON:
    可以直接在 Grafana Import。

datasource:
    本目录里的 JSON 默认使用 Prometheus-compatible datasource。
    如果你的 Grafana datasource 指向 VictoriaMetrics,导入时选择这个 datasource。

variables:
    JSON 里定义。
    导入后可以在 Dashboard settings -> Variables 查看和修改。

PromQL:
    panel 里定义。
    如果你的 labels 和文档不同,需要改变量或 PromQL label matcher。

Service Pages#

Page Scope
EC2 instance health, CPU, memory, disk, network, EBS
ECS Service service health, task count, CPU, memory, deployment, app signals
SQS backlog, oldest message age, throughput, DLQ
ALB request, target health, errors, latency, connection problems
DynamoDB throttle, latency, capacity, errors, hot key signals
PostgreSQL availability, connections, query health, locks, replication, storage
ElastiCache CPU, memory, eviction, hit rate, replication, connections
CloudFront request, errors, cache hit, origin latency, traffic