-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathdashboards.libsonnet
124 lines (123 loc) · 5.83 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
local g = (import 'grafana-builder/grafana.libsonnet');
{
grafanaDashboards+:: {
'memcached-overview.json':
(
g.dashboard('Memcached Overview') +
{
uid: '124d5222454213f748dbfaf69b77ec48',
graphTooltip: $._config.graphTooltip,
}
)
.addMultiTemplate('cluster', 'memcached_commands_total', $._config.clusterLabel, allValue='.*')
.addMultiTemplate('job', 'memcached_commands_total{' + $._config.clusterLabel + '=~"$cluster"}', 'job')
.addMultiTemplate('instance', 'memcached_commands_total{' + $._config.clusterLabel + '=~"$cluster",job=~"$job"}', 'instance')
.addRow(
g.row('Hits')
.addPanel(
g.panel('Hit Rate') +
g.queryPanel('sum(rate(memcached_commands_total{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance", command="get", status="hit"}[$__rate_interval])) / sum(rate(memcached_commands_total{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", command="get"}[$__rate_interval]))', 'Hit Rate') +
{ yaxes: g.yaxes('percentunit') },
)
.addPanel(
g.panel('Top 20 Highest Connection Usage') +
g.queryPanel(|||
topk(20,
max by (%s, job, instance) (
memcached_current_connections{%s=~"$cluster", job=~"$job", instance=~"$instance"} / memcached_max_connections{%s=~"$cluster", job=~"$job", instance=~"$instance"}
))
||| % [$._config.clusterLabel, $._config.clusterLabel, $._config.clusterLabel], '{{ ' + $._config.clusterLabel + ' }} / {{ job }} / {{ instance }}') +
{ yaxes: g.yaxes('percentunit') },
)
)
.addRow(
g.row('Ops')
.addPanel(
g.panel('Commands') +
g.queryPanel('sum by(command, status) (rate(memcached_commands_total{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"}[$__rate_interval]))', '{{command}} {{status}}')
)
.addPanel(
g.panel('Evictions') +
g.queryPanel('sum by(instance) (rate(memcached_items_evicted_total{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"}[$__rate_interval]))', '{{instance}}')
)
.addPanel(
g.panel('Stored') +
g.queryPanel('sum by(instance) (rate(memcached_items_total{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"}[$__rate_interval]))', '{{instance}}')
)
)
.addRow(
g.row('Resources')
.addPanel(
g.panel('CPU') +
g.queryPanel(|||
sum by (instance) (
rate(memcached_process_user_cpu_seconds_total{%(cluster)s=~"$cluster", job=~"$job", instance=~"$instance"}[$__rate_interval]) +
rate(memcached_process_system_cpu_seconds_total{%(cluster)s=~"$cluster", job=~"$job", instance=~"$instance"}[$__rate_interval])
)
||| % { cluster: $._config.clusterLabel }, '{{instance}}') +
g.stack,
)
.addPanel(
g.panel('Memory') +
g.queryPanel('sum by(instance) (memcached_current_bytes{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"})', '{{instance}}') +
g.stack +
{ yaxes: g.yaxes('bytes') },
// TODO add memcached_limit_bytes
)
.addPanel(
g.panel('Items') +
g.queryPanel('sum by(instance) (memcached_current_items{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"})', '{{instance}}') +
g.stack,
)
)
.addRow(
g.row('Network')
.addPanel(
g.panel('Current Connections') +
g.queryPanel([
'sum by(instance) (memcached_current_connections{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"})',
// Be conservative showing the lowest setting for max connections among all selected instances.
'min(memcached_max_connections{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"})',
], [
'{{instance}}',
'Max Connections (min setting across all instances)',
])
)
.addPanel(
g.panel('Connections / sec') +
g.queryPanel([
'sum by(instance) (rate(memcached_connections_total{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"}[$__rate_interval]))',
], [
'{{instance}}',
])
)
.addPanel(
g.panel('Bytes received') +
g.queryPanel('sum by(instance) (rate(memcached_read_bytes_total{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"}[$__rate_interval]))', '{{instance}}') +
{ yaxes: g.yaxes('Bps') },
)
.addPanel(
g.panel('Bytes transmitted') +
g.queryPanel('sum by(instance) (rate(memcached_written_bytes_total{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"}[$__rate_interval]))', '{{instance}}') +
{ yaxes: g.yaxes('Bps') },
)
)
.addRow(
g.row('Memcached Info')
.addPanel(
g.panel('Memcached Info') +
g.tablePanel([
'count by (job, instance, version) (memcached_version{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"})',
'max by (job, instance) (memcached_uptime_seconds{' + $._config.clusterLabel + '=~"$cluster", job=~"$job", instance=~"$instance"})',
], {
job: { alias: 'Job' },
instance: { alias: 'Instance' },
version: { alias: 'Version' },
'Value #A': { alias: 'Count', type: 'hidden' },
'Value #B': { alias: 'Uptime', type: 'number', unit: 'dtdurations' },
})
)
)
{ editable: false },
},
}