
一句话承诺:两份配置+一段面板 JSON,立刻看到第一个指标图。

apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://localhost:9090
access: proxy
isDefault: trueapiVersion: 1
dashboards:
- name: Default
folders:
- path: /var/lib/grafana/dashboards{
"title": "Up",
"panels": [
{
"type": "graph",
"title": "Instances Up",
"targets": [{ "expr": "sum(up)" }]
}
]
}类型 | 用途 |
|---|---|
Graph | 趋势曲线 |
Stat | 单值展示 |
Gauge | 指标达标度 |
Loki 日志聚合:promtail 抓取与查询基础。