forked from grafana/jsonnet-libs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboards.libsonnet
More file actions
86 lines (84 loc) · 3.74 KB
/
dashboards.libsonnet
File metadata and controls
86 lines (84 loc) · 3.74 KB
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
local g = import './g.libsonnet';
local logslib = import 'github.com/grafana/jsonnet-libs/logs-lib/logs/main.libsonnet';
{
local root = self,
new(this):
local prefix = this.config.dashboardNamePrefix;
local links = this.grafana.links;
local tags = this.config.dashboardTags;
local uid = g.util.string.slugify(this.config.uid);
local vars = this.grafana.variables;
local annotations = this.grafana.annotations;
local refresh = this.config.dashboardRefresh;
local period = this.config.dashboardPeriod;
local timezone = this.config.dashboardTimezone;
local panels = this.grafana.panels;
{
overview:
g.dashboard.new(prefix + 'OpenLDAP overview')
+ g.dashboard.withPanels(
g.util.grid.wrapPanels(
[
panels.uptime { gridPos+: { w: 8 } },
panels.referrals { gridPos+: { w: 8 } },
panels.alerts { gridPos+: { w: 8 } },
panels.connections { gridPos+: { w: 8 } },
panels.waiters { gridPos+: { w: 8 } },
panels.directoryEntries { gridPos+: { w: 8 } },
panels.networkConnectivity { gridPos+: { w: 8 } },
panels.pduProcessed { gridPos+: { w: 8 } },
panels.authenticationAttempts { gridPos+: { w: 8 } },
panels.coreOperations { gridPos+: { w: 12 } },
panels.auxiliaryOperations { gridPos+: { w: 12 } },
panels.primaryThreadActivity { gridPos+: { w: 12 } },
panels.threadQueueManagement { gridPos+: { w: 12 } },
], 12, 6
)
)
+ root.applyCommon(vars.singleInstance, uid + '-overview', tags, links { openldapOverview+:: {} }, annotations, timezone, refresh, period),
}
+
(if this.config.enableLokiLogs then
{
logs:
logslib.new(prefix + 'OpenLDAP logs',
datasourceName=this.grafana.variables.datasources.loki.name,
datasourceRegex=this.grafana.variables.datasources.loki.regex,
filterSelector=this.config.filteringSelector,
labels=this.config.logLabels + this.config.extraLogLabels,
formatParser=null,
showLogsVolume=this.config.showLogsVolume,
logsVolumeGroupBy=this.config.logsVolumeGroupBy)
{
dashboards+:
{
logs+:
// reference to self, already generated variables, to keep them, but apply other common data in applyCommon
root.applyCommon(super.logs.templating.list, uid=uid + '-logs', tags=tags, links=links { logs+:: {} }, annotations=annotations, timezone=timezone, refresh=refresh, period=period),
},
panels+:
{
// modify log panel
logs+:
g.panel.logs.options.withEnableLogDetails(true)
+ g.panel.logs.options.withShowTime(false)
+ g.panel.logs.options.withWrapLogMessage(false),
},
variables+: {
// add prometheus datasource for annotations processing
toArray+: [
this.grafana.variables.datasources.prometheus { hide: 2 },
],
},
}.dashboards.logs,
} else {}),
applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period):
g.dashboard.withTags(tags)
+ g.dashboard.withUid(uid)
+ g.dashboard.withLinks(std.objectValues(links))
+ g.dashboard.withTimezone(timezone)
+ g.dashboard.withRefresh(refresh)
+ g.dashboard.time.withFrom(period)
+ g.dashboard.withVariables(vars)
+ g.dashboard.withAnnotations(std.objectValues(annotations)),
}