Grafana Dashboard
Dashboard
grafana-values.yaml
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: <provider>
folder: ""
type: file
allowUiUpdates: false
options:
path: /var/lib/grafana/dashboards/<provider>
dashboards:
<provider>:
<dashboard>: {}
dashboardProviders
dashboardproviders.yaml
providers: []
allowUiUpdates: false
dashboards
<provider>
<dashboard>
url: <url>
gnetId: <gnetId>
: https://grafana.com/grafana/dashboards/ 에 등록된 ID입니다.revision: 1
: https://grafana.com/grafana/dashboards/ 에 등록된 버전입니다.datasource: <string|[]>
- array일 경우
name: <name>
value: <value>
s/${<name>}/<value>/g
로 JSON 내 변수를 치환합니다- Ee)
datasource: [{name: DS_PROMETHEUS, value: <prometheusUID>}]
- array일 경우
Variables
- Dashbaord -> Settings -> Variables
- 사용할 때는
$<name>
,${<name>}
,${<name>:<format>}
형태로 사용합니다
Query
{
"templating": {
"list": [
{
"type": "query",
"name": "<name>",
"label": "<label>",
"description": "<description>",
"datasource": {
"type": "prometheus",
"uid": "<uid>"
},
"query": {
"query": "<query>",
"refId": "<refId>"
},
"regex": "<regex>",
"refresh": 1, // 1: on dashboard load, 2: on time range change
"allValue": "<allValue>"
}
]
}
}
- label: 대시보드에 표시될 이름, 선언하지 않으면 name이 표시됩니다
- query
- query
- datasource가 prometheus인 경우
- https://grafana.com/docs/grafana/latest/datasources/prometheus/template-variables/
- https://prometheus.io/docs/prometheus/latest/querying/api/
label_names()
:/api/v1/labels
label_values(<label>)
:/api/v1/label/<label>/values
label_values(<metric>, <label>)
:/api/v1/series
metrics(<metric>)
:/api/v1/label/__name__/values?match[]=<metric>
query_result(<query>)
:/api/v1/query?query=<query>
- datasource가 prometheus인 경우
- query
- allValue:
ALL
을 선택했을 때 사용될 값