-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.jsonnet
119 lines (118 loc) · 2.96 KB
/
sample.jsonnet
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
113
114
115
116
117
118
119
local grafana = import 'grafonnet/grafana.libsonnet';
local dashboard = grafana.dashboard;
local row = grafana.row;
local singlestat = grafana.singlestat;
local prometheus = grafana.prometheus;
local template = grafana.template;
dashboard.new(
'Scaphandre example dashboard',
tags=['scaphandre', 'energy', 'power'],
editable=true
)
.addTemplate(
template.datasource(
'PROMETHEUS_DS',
'prometheus',
'Prometheus',
hide='label',
)
)
.addTemplate(
template.text(
name='process_filter',
)
)
.addRow(
row.new(
title='Per hosts',
)
.addPanel(
grafana.graphPanel.new(
title='Hosts power consumption',
datasource='${PROMETHEUS_DS}',
format='W',
span=6,
min=0
)
.addTarget(
grafana.prometheus.target(
'scaph_host_power_microwatts / 1000000',
legendFormat='{{instance}}',
)
)
)
.addPanel(
grafana.graphPanel.new(
title='Hosts power consumption total (dynamic time range)',
datasource='${PROMETHEUS_DS}',
span=4,
bars=true,
format='Wh',
x_axis_mode='series',
min=0
)
.addTarget(
grafana.prometheus.target(
'sum(avg_over_time(scaph_host_power_microwatts[1h]))/1000000',
legendFormat='total of hosts, during displayed time window',
interval='1h'
)
)
)
)
.addRow(
row.new(
title='Per CPU Sockets'
)
.addPanel(
grafana.graphPanel.new(
title='Socket power consumption',
datasource='${PROMETHEUS_DS}',
format='W',
span=6,
min=0
)
.addTarget(
grafana.prometheus.target(
'scaph_socket_power_microwatts / 1000000',
legendFormat='{{instance}} Socket {{socket_id}}',
)
)
)
)
.addRow(
row.new(
title='Per process',
)
.addPanel(
grafana.statPanel.new(
title='Top process consumers',
datasource='${PROMETHEUS_DS}',
)
.addTarget(
grafana.prometheus.target(
'sort_desc(topk(3, sum by (exe) (scaph_process_power_consumption_microwatts/1000000)))',
legendFormat='{{exe}}',
)
)
)
.addPanel(
grafana.graphPanel.new(
title='Filtered process (process_filter) power, by exe',
datasource='${PROMETHEUS_DS}',
span=8,
format='W',
legend_rightSide=false,
legend_alignAsTable=true,
legend_sideWidth='30%',
stack=true,
min=0
)
.addTarget(
grafana.prometheus.target(
'scaph_process_power_consumption_microwatts{exe=~".*${process_filter}.*"}/1000000',
legendFormat='{{ cmdline }}',
)
)
)
)