-
Notifications
You must be signed in to change notification settings - Fork 163
/
dashboards.libsonnet
97 lines (94 loc) · 3.19 KB
/
dashboards.libsonnet
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
local g = import 'grafana-builder/grafana.libsonnet';
local row_settings = {
height: '100px',
showTitle: false,
};
local panel_settings = {
repeat: 'instance',
colorBackground: true,
thresholds: '0.5,0.5',
};
{
grafanaDashboards+:: {
'consul-overview.json':
g.dashboard('Consul Overview', std.md5('20210205-consul'))
.addMultiTemplate('job', 'consul_up', 'job')
.addMultiTemplate('instance', 'consul_up{job=~"$job"}', 'instance')
.addRow(
g.row('Up')
.addPanel(
g.panel('$instance') +
g.statPanel('consul_up{job=~"$job",instance=~"$instance"}', 'none') +
panel_settings {
valueMaps: [
{ value: '0', op: '=', text: 'DOWN' },
{ value: '1', op: '=', text: 'UP' },
],
colors: ['#d44a3a', 'rgba(237, 129, 40, 0.89)', '#299c46'],
}
) +
row_settings
)
.addRow(
g.row('Leader')
.addPanel(
g.panel('$instance') +
g.statPanel(|||
(rate(consul_raft_leader_lastcontact_count{job=~"$job",instance=~"$instance"}[$__rate_interval]) > bool 0)
or
(consul_up{job=~"$job",instance=~"$instance"} == bool 0)
|||, 'none') +
panel_settings {
valueMaps: [
{ value: '0', op: '=', text: 'FOLLOWER' },
{ value: '1', op: '=', text: 'LEADER' },
],
colors: ['rgba(237, 129, 40, 0.89)', 'rgba(237, 129, 40, 0.89)', '#299c46'],
}
) +
row_settings
)
.addRow(
g.row('Has Leader')
.addPanel(
g.panel('$instance') +
g.statPanel('consul_raft_leader{job=~"$job",instance=~"$instance"}', 'none') +
panel_settings {
valueMaps: [
{ value: '0', op: '=', text: 'NO LEADER' },
{ value: '1', op: '=', text: 'HAS LEADER' },
],
colors: ['#d44a3a', 'rgba(237, 129, 40, 0.89)', '#299c46'],
}
) +
row_settings
)
.addRow(
g.row('# Peers')
.addPanel(
g.panel('$instance') +
g.statPanel('consul_raft_peers{job=~"$job",instance=~"$instance"}', 'none') +
panel_settings {
thresholds: '1,2',
colors: ['#d44a3a', 'rgba(237, 129, 40, 0.89)', '#299c46'],
}
) +
row_settings
)
.addRow(
g.row('Consul Server')
.addPanel(
g.panel('QPS') +
g.queryPanel('sum(rate(consul_http_request_count{job=~"$job"}[$__rate_interval])) by (instance)', '{{instance}}') +
g.stack
)
.addPanel(
g.panel('Latency') +
g.queryPanel('max(consul_http_request{job=~"$job", quantile="0.99"}) by (instance)', '99th Percentile', '{{instance}}') +
g.queryPanel('max(consul_http_request{job=~"$job", quantile="0.5"}) by (instance)', '50th Percentile', '{{instance}}') +
g.queryPanel('sum(rate(consul_http_request{job=~"$job"}[$__rate_interval])) by (instance) / sum(rate(consul_http_request{job=~"$job"}[$__rate_interval])) by (instance)', 'Average') +
{ yaxes: g.yaxes('ms') }
)
),
},
}