Panel JSON 配置示例
# 完整 Panel JSON 配置
以下是最终的 Panel JSON,可以导入 Grafana 直接复现 Demo:
{
"id": 2,
"gridPos": {
"h": 9,
"w": 12,
"x": 0,
"y": 0
},
"type": "timeseries",
"title": "Panel Title",
"datasource": {
"uid": "d1JEgHXHz",
"type": "yesoreyeram-infinity-datasource"
},
"fieldConfig": {
"defaults": {
"custom": {
"drawStyle": "line",
"lineInterpolation": "linear",
"barAlignment": 0,
"lineWidth": 1,
"fillOpacity": 0,
"gradientMode": "none",
"spanNulls": false,
"showPoints": "auto",
"pointSize": 5,
"stacking": {
"mode": "none",
"group": "A"
},
"axisPlacement": "auto",
"axisLabel": "",
"axisColorMode": "text",
"scaleDistribution": {
"type": "linear"
},
"axisCenteredZero": false,
"hideFrom": {
"tooltip": false,
"viz": false,
"legend": false
},
"thresholdsStyle": {
"mode": "off"
}
},
"color": {
"mode": "palette-classic"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"options": {
"tooltip": {
"mode": "single",
"sort": "none"
},
"legend": {
"showLegend": true,
"displayMode": "list",
"placement": "bottom",
"calcs": []
}
},
"targets": [
{
"datasource": {
"type": "yesoreyeram-infinity-datasource",
"uid": "d1JEgHXHz"
},
"columns": [
{
"selector": "key",
"text": "Time",
"type": "timestamp_epoch"
},
{
"selector": "value",
"text": "cores",
"type": "number"
}
],
"filters": [],
"format": "timeseries",
"global_query_id": "",
"parser": "backend",
"refId": "A",
"root_selector": "metrics[0].metrics ~> $each(function($v, $k) {\n {\n \"key\": $k,\n \"value\": $v\n }\n})\n\n",
"source": "url",
"type": "json",
"url": "/ws/v1/timeline/metrics?appId=HOST&hostname=hadoop1&metricNames=cpu_num&startTime=${__from}&endTime=${__to}",
"url_options": {
"data": "",
"method": "GET"
}
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
- 01
- [/metrics/metadata] — 元数据查询和使用 GET09-12
- 02
- [/metrics/metadata] — 请求完整链路解读09-12
- 03
- [/metrics/metadata] — 缓存数据装载 Phoenix09-12