Skip to content

Commit b625110

Browse files
committed
Add overview and shards
These rows are pretty close to complete. This starts the work on documents while the sizing is still off. Signed-off-by: Joe Adams <[email protected]>
1 parent afa18e3 commit b625110

File tree

3 files changed

+174
-3
lines changed

3 files changed

+174
-3
lines changed

elasticsearch_mixin/dashboards/cluster.libsonnet

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
local g = import 'g.libsonnet';
22

33
local dashboard = g.dashboard;
4+
local row = g.panel.row;
45

6+
local panels = import './panels.libsonnet';
7+
local queries = import './queries.libsonnet';
58
local variables = import './variables.libsonnet';
69

710
{
@@ -13,8 +16,32 @@ local variables = import './variables.libsonnet';
1316
+ dashboard.time.withFrom(value='now-1h')
1417
+ dashboard.graphTooltip.withSharedCrosshair()
1518
+ dashboard.withVariables([
16-
variables.datasource,
17-
variables.cluster,
19+
variables.datasource,
20+
variables.cluster,
1821
])
19-
}
22+
+ dashboard.withPanels(
23+
g.util.grid.makeGrid([
24+
row.new('Overview')
25+
+ row.withPanels([
26+
panels.stat.nodes('Nodes', queries.runningNodes),
27+
panels.stat.nodes('Data Nodes', queries.dataNodes),
28+
panels.stat.nodes('Pending Tasks', queries.pendingTasks),
29+
]),
30+
row.new('Shards')
31+
+ row.withPanels([
32+
panels.stat.nodes('Active', queries.activeShards),
33+
panels.stat.nodes('Active Primary', queries.activePrimaryShards),
34+
panels.stat.nodes('Initializing', queries.initializingShards),
35+
panels.stat.nodes('Relocating', queries.reloactingShards),
36+
panels.stat.nodes('Unassigned', queries.unassignedShards),
37+
panels.stat.nodes('DelayedUnassigned', queries.delayedUnassignedShards),
38+
]),
39+
row.new('Documents')
40+
+ row.withPanels([
41+
panels.timeSeries.base('Indexed Documents', queries.indexedDocuments),
42+
43+
]),
44+
], panelWidth=4, panelHeight=3),
45+
),
46+
},
2047
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
local g = import 'g.libsonnet';
2+
3+
{
4+
stat: {
5+
local stat = g.panel.stat,
6+
7+
base(title, targets):
8+
stat.new(title)
9+
+ stat.queryOptions.withTargets(targets),
10+
11+
nodes: self.base,
12+
},
13+
14+
timeSeries: {
15+
local timeSeries = g.panel.timeSeries,
16+
17+
base(title, targets):
18+
timeSeries.new(title)
19+
+ timeSeries.queryOptions.withTargets(targets),
20+
21+
ratio(title, targets):
22+
self.base(title, targets)
23+
+ timeSeries.standardOptions.withUnit('percentunit'),
24+
25+
ratioMax1(title, targets):
26+
self.ratio(title, targets)
27+
+ timeSeries.standardOptions.withMax(1),
28+
},
29+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
local g = import './g.libsonnet';
2+
local prometheusQuery = g.query.prometheus;
3+
4+
local variables = import './variables.libsonnet';
5+
6+
{
7+
/*
8+
General overview queries
9+
*/
10+
11+
runningNodes:
12+
prometheusQuery.new(
13+
'$' + variables.datasource.name,
14+
|||
15+
sum(
16+
elasticsearch_cluster_health_number_of_nodes{cluster=~"$cluster"}
17+
)
18+
|||
19+
),
20+
dataNodes:
21+
prometheusQuery.new(
22+
'$' + variables.datasource.name,
23+
|||
24+
sum(
25+
elasticsearch_cluster_health_number_of_data_nodes{cluster=~"$cluster"}
26+
)
27+
|||
28+
),
29+
30+
pendingTasks:
31+
prometheusQuery.new(
32+
'$' + variables.datasource.name,
33+
|||
34+
sum(
35+
elasticsearch_cluster_health_number_of_pending_tasks{cluster=~"$cluster"}
36+
)
37+
|||
38+
),
39+
40+
/*
41+
Shard queries
42+
*/
43+
44+
activeShards:
45+
prometheusQuery.new(
46+
'$' + variables.datasource.name,
47+
|||
48+
sum(
49+
elasticsearch_cluster_health_active_shards{cluster=~"$cluster"}
50+
)
51+
|||
52+
),
53+
54+
activePrimaryShards:
55+
prometheusQuery.new(
56+
'$' + variables.datasource.name,
57+
|||
58+
sum(
59+
elasticsearch_cluster_health_active_primary_shards{cluster=~"$cluster"}
60+
)
61+
|||
62+
),
63+
64+
initializingShards:
65+
prometheusQuery.new(
66+
'$' + variables.datasource.name,
67+
|||
68+
sum(
69+
elasticsearch_cluster_health_initializing_shards{cluster=~"$cluster"}
70+
)
71+
|||
72+
),
73+
74+
reloactingShards:
75+
prometheusQuery.new(
76+
'$' + variables.datasource.name,
77+
|||
78+
sum(
79+
elasticsearch_cluster_health_reloacting_shards{cluster=~"$cluster"}
80+
)
81+
|||
82+
),
83+
84+
unassignedShards:
85+
prometheusQuery.new(
86+
'$' + variables.datasource.name,
87+
|||
88+
sum(
89+
elasticsearch_cluster_health_unassigned_shards{cluster=~"$cluster"}
90+
)
91+
|||
92+
),
93+
94+
delayedUnassignedShards:
95+
prometheusQuery.new(
96+
'$' + variables.datasource.name,
97+
|||
98+
sum(
99+
elasticsearch_cluster_health_delayed_unassigned_shards{cluster=~"$cluster"}
100+
)
101+
|||
102+
),
103+
104+
/*
105+
Documents queries
106+
*/
107+
108+
indexedDocuments:
109+
prometheusQuery.new(
110+
'$' + variables.datasource.name,
111+
|||
112+
elasticsearch_indices_docs{cluster=~"$cluster"}
113+
|||
114+
),
115+
}

0 commit comments

Comments
 (0)