Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
aeb5405
Add initial structure for windows modular mixin
v-zhuravlev Aug 29, 2023
1756c54
Add panels skeleton for main
v-zhuravlev Sep 1, 2023
0b737c0
Update main
v-zhuravlev Sep 4, 2023
39797eb
Update dashboards
v-zhuravlev Sep 4, 2023
ac17aae
Add new targets and panels
v-zhuravlev Sep 4, 2023
77121c1
Add more panels and targets
v-zhuravlev Sep 6, 2023
e4d13b8
Update to remote
v-zhuravlev Sep 6, 2023
6356289
Add overview panels and targets
v-zhuravlev Sep 7, 2023
e4f7067
Fix to work with latest grafonnet
v-zhuravlev Sep 8, 2023
23eaf04
Add loglib dashboard to pack
v-zhuravlev Sep 8, 2023
2570246
Fix uptime override in fleet table
v-zhuravlev Sep 8, 2023
3237531
Update refresh for vars
v-zhuravlev Sep 20, 2023
25ba2aa
Update windows logs format
v-zhuravlev Sep 20, 2023
e837279
Add optional logs annotations
v-zhuravlev Sep 21, 2023
21661b4
Add datalinks from fleet table
v-zhuravlev Sep 21, 2023
adc3d24
Add number of alertsCritical/alertsWarning to fleet table
v-zhuravlev Sep 21, 2023
17ab90f
Add grouplabels to reboot annotations
v-zhuravlev Sep 21, 2023
138b77b
Add drilldown links to topk panels
v-zhuravlev Sep 21, 2023
0d80c2b
jsonnet format
v-zhuravlev Sep 21, 2023
1106ec8
Update args
v-zhuravlev Sep 21, 2023
c2a43b6
Add system dashboard layout and timezone metric
v-zhuravlev Sep 21, 2023
49b5915
Add osTimezone target
v-zhuravlev Sep 21, 2023
7d6494b
Add cpu usage by mode
v-zhuravlev Sep 21, 2023
370fab5
Add cpuqueu
v-zhuravlev Sep 21, 2023
d6dc77a
Add cpu queue panel
v-zhuravlev Sep 21, 2023
f364d87
fmt main
v-zhuravlev Sep 22, 2023
2d64f40
add system panels
v-zhuravlev Sep 22, 2023
7aff434
Add alerts and refresh,period,timezone
v-zhuravlev Sep 22, 2023
105183e
Move lib to sep dir
v-zhuravlev Sep 22, 2023
393c872
Fmt
v-zhuravlev Sep 22, 2023
d3d2537
Switch mixin to use windows-observ-lib
v-zhuravlev Sep 22, 2023
7364671
Add alerts todo
v-zhuravlev Sep 22, 2023
d40b7c7
Add comments
v-zhuravlev Sep 22, 2023
9df70c8
move config to config.libsonnet (mixin style)
v-zhuravlev Sep 22, 2023
629fe87
Remove unused chart
v-zhuravlev Sep 22, 2023
100ce58
update jsonnetfile
v-zhuravlev Sep 22, 2023
2d6268e
Update links
v-zhuravlev Sep 22, 2023
e45f365
Add grafonnet dep
v-zhuravlev Sep 22, 2023
e4c123f
Add physical drive alert
v-zhuravlev Sep 22, 2023
0dbd65d
Update line format
v-zhuravlev Sep 22, 2023
cb9d5be
Update alerts 'for' durations
v-zhuravlev Sep 22, 2023
4de65df
Add disk and filesystem dashboard
v-zhuravlev Sep 22, 2023
cdcb124
Drop network dashboard
v-zhuravlev Sep 22, 2023
671e942
change default uids
v-zhuravlev Sep 22, 2023
8a05e8e
Update imports
v-zhuravlev Sep 22, 2023
5ee2e13
Add readme
v-zhuravlev Sep 22, 2023
f0a2d59
Update readme
v-zhuravlev Sep 22, 2023
45e21c0
Update logs config
v-zhuravlev Sep 22, 2023
ee8d8f2
fmt
v-zhuravlev Sep 22, 2023
d9d6b0b
Fix typo in readem
v-zhuravlev Sep 22, 2023
7c8dfd9
Add descriptions
v-zhuravlev Sep 27, 2023
09a9a47
Change logs datasource label
v-zhuravlev Sep 27, 2023
fc70723
Sentence case all labels and table column names
v-zhuravlev Sep 27, 2023
ebe8e0a
Fix customAllValue
v-zhuravlev Sep 27, 2023
30da9a6
Fix commonlib import
v-zhuravlev Sep 27, 2023
57877a6
Update jsonnet dep
v-zhuravlev Sep 27, 2023
b57302d
Update panels
v-zhuravlev Sep 27, 2023
3841f9a
Update version
v-zhuravlev Sep 27, 2023
b9708d4
Fmt
v-zhuravlev Sep 28, 2023
1ceebde
Add time collector tip in ntp panels
v-zhuravlev Sep 28, 2023
d4f3351
Revert commonlib link
v-zhuravlev Sep 28, 2023
e38a7fd
Adding NTP alerts.
gaantunes Oct 4, 2023
d66f682
Adding time offset alert
gaantunes Oct 5, 2023
9ca1340
Move utils to commonlib
v-zhuravlev Oct 5, 2023
409ce6a
Suggestions from Vitaly
gaantunes Oct 5, 2023
cb2e270
removing service not running metric.w
gaantunes Oct 5, 2023
e384c2b
lint fix
gaantunes Oct 6, 2023
b319c4a
Update variables
v-zhuravlev Oct 6, 2023
e30cf6f
Remove TODO notes
v-zhuravlev Oct 6, 2023
77994b1
Rename 'all' to 'generic'
v-zhuravlev Oct 10, 2023
e87b429
Rename to generic 2
v-zhuravlev Oct 10, 2023
6d58b00
Remove redundant uid
v-zhuravlev Oct 12, 2023
6fb794e
Drop unused label from reboot annotation
v-zhuravlev Oct 12, 2023
4332de9
Update observ lib 'schema'
v-zhuravlev Oct 13, 2023
c07cc92
Update jsonnet deps to main
v-zhuravlev Oct 18, 2023
1d0eb76
Update regex
v-zhuravlev Oct 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update observ lib 'schema'
  • Loading branch information
v-zhuravlev committed Oct 18, 2023
commit 4332de9296ce091ba562906b50fa75e2050bfd45
14 changes: 8 additions & 6 deletions windows-mixin/mixin.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ local config = (import 'config.libsonnet')._config;
{
config+: config,
},
prometheusAlerts+:: windows.alerts,
prometheusAlerts+:: windows.prometheus.alerts,
grafanaDashboards+::
(windows {
variables+: {
datasources+: {
loki+: var.datasource.withRegex('Loki|.+logs'),
prometheus+: var.datasource.withRegex('Prometheus|Cortex|Mimir|grafanacloud-.+-prom'),
grafana+: {
variables+: {
datasources+: {
loki+: var.datasource.withRegex('Loki|.+logs'),
prometheus+: var.datasource.withRegex('Victoria|Prometheus|Cortex|Mimir|grafanacloud-.+-prom'),
},
},
},
})
.dashboards,
.grafana.dashboards,
}
35 changes: 17 additions & 18 deletions windows-observ-lib/dashboards.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ local g = import './g.libsonnet';
local logslib = import 'github.com/grafana/jsonnet-libs/logs-lib/logs/main.libsonnet';
{
local root = self,
new(
this
):
new(this):
local prefix = this.config.dashboardNamePrefix;
local links = this.links;
local links = this.grafana.links;
local tags = this.config.dashboardTags;
local uid = g.util.string.slugify(this.config.uid);
local vars = this.variables;
local annotations = this.annotations;
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.panels;
local panels = this.grafana.panels;
local stat = g.panel.stat;
{
fleet:
Expand Down Expand Up @@ -110,16 +108,17 @@ local logslib = import 'github.com/grafana/jsonnet-libs/logs-lib/logs/main.libso
then
{
logs:

logslib.new(prefix + 'Windows logs',
datasourceName=this.variables.datasources.loki.name,
datasourceRegex=this.variables.datasources.loki.regex,
filterSelector=this.config.filteringSelector,
labels=this.config.groupLabels + this.config.instanceLabels + this.config.extraLogLabels,
formatParser='json',
showLogsVolume=this.config.showLogsVolume,
logsVolumeGroupBy=this.config.logsVolumeGroupBy,
extraFilters=this.config.logsExtraFilters)
logslib.new(
prefix + 'Windows logs',
datasourceName=this.grafana.variables.datasources.loki.name,
datasourceRegex=this.grafana.variables.datasources.loki.regex,
filterSelector=this.config.filteringSelector,
labels=this.config.groupLabels + this.config.instanceLabels + this.config.extraLogLabels,
formatParser='json',
showLogsVolume=this.config.showLogsVolume,
logsVolumeGroupBy=this.config.logsVolumeGroupBy,
extraFilters=this.config.logsExtraFilters
)
{
dashboards+:
{
Expand All @@ -138,7 +137,7 @@ local logslib = import 'github.com/grafana/jsonnet-libs/logs-lib/logs/main.libso
variables+: {
// add prometheus datasource for annotations processing
toArray+: [
this.variables.datasources.prometheus { hide: 2 },
this.grafana.variables.datasources.prometheus { hide: 2 },
],
},
}.dashboards.logs,
Expand Down
125 changes: 60 additions & 65 deletions windows-observ-lib/main.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,40 @@ local variables = import './variables.libsonnet';
local commonlib = import 'github.com/grafana/jsonnet-libs/common-lib/common/main.libsonnet';

{

// any modular library should inlcude as inputs:
// 'dashboardNamePrefix' - Use as prefix for all Dashboards and (optional) rule groups
// 'filteringSelector' - Static selector to apply to ALL dashboard variables of type query, panel queries, alerts and recording rules.
// 'groupLabels' - one or more labels that can be used to identify 'group' of instances. In simple cases, can be 'job' or 'cluster'.
// 'instanceLabels' - one or more labels that can be used to identify single entity of instances. In simple cases, can be 'instance' or 'pod'.
// 'uid' - UID to prefix all dashboards original uids

new(
filteringSelector,
groupLabels=['job'],
instanceLabels=['instance'],
dashboardNamePrefix='',
dashboardTags=[uid],
uid,

): {

local this = self,
config: {
ignoreVolumes: 'HarddiskVolume.*',
// any modular library should inlcude as inputs:
// 'dashboardNamePrefix' - Use as prefix for all Dashboards and (optional) rule groups
// 'filteringSelector' - Static selector to apply to ALL dashboard variables of type query, panel queries, alerts and recording rules.
// 'groupLabels' - one or more labels that can be used to identify 'group' of instances. In simple cases, can be 'job' or 'cluster'.
// 'instanceLabels' - one or more labels that can be used to identify single entity of instances. In simple cases, can be 'instance' or 'pod'.
// 'uid' - UID to prefix all dashboards original uids
groupLabels: groupLabels,
instanceLabels: instanceLabels,
filteringSelector: filteringSelector,
dashboardTags: dashboardTags,
uid: uid,
dashboardNamePrefix: dashboardNamePrefix,

// optional
ignoreVolumes: 'HarddiskVolume.*',
alertsCPUThresholdWarning: '90',
alertMemoryUsageThresholdCritical: '90',
alertDiskUsageThresholdCritical: '90',
dashboardPeriod: 'now-1h',
dashboardTimezone: 'default',
dashboardRefresh: '1m',

// logs lib related
enableLokiLogs: true,
extraLogLabels: ['channel', 'source', 'keywords', 'level'],
logsVolumeGroupBy: 'level',
Expand All @@ -54,67 +53,63 @@ local commonlib = import 'github.com/grafana/jsonnet-libs/common-lib/common/main
| line_format `{{ if eq "[[instance]]" ".*" }}{{ alignLeft 25 .instance}}|{{end}}{{alignLeft 12 .channel }}| {{ alignLeft 25 .source}}| {{ .message }}`
|||,
},

variables: variables.new(this),

targets: targets.new(this),

annotations:
{
reboot: commonlib.annotations.reboot.new(
title='Reboot',
target=this.targets.reboot,
instanceLabels=std.join(',', instanceLabels),
)
+ commonlib.annotations.base.withTagKeys(std.join(',', groupLabels + instanceLabels)),
}
+
if
this.config.enableLokiLogs
then
grafana: {
variables: variables.new(this),
targets: targets.new(this),
annotations:
{
serviceFailed: commonlib.annotations.serviceFailed.new(
title='Service failed',
target=this.targets.serviceFailed,
)
+ commonlib.annotations.base.withTagKeys(std.join(',', groupLabels + instanceLabels + ['level']))
+ commonlib.annotations.base.withTextFormat('{{message}}'),
criticalEvents: commonlib.annotations.fatal.new(
title='Critical system event',
target=this.targets.criticalEvents,
)
+ commonlib.annotations.base.withTagKeys(std.join(',', groupLabels + instanceLabels + ['level']))
+ commonlib.annotations.base.withTextFormat('{{message}}'),
reboot: commonlib.annotations.reboot.new(
title='Reboot',
target=this.grafana.targets.reboot,
instanceLabels=std.join(',', instanceLabels),
)
+ commonlib.annotations.base.withTagKeys(std.join(',', this.config.groupLabels + this.config.instanceLabels)),
}
else
{},
+
if
this.config.enableLokiLogs
then
{
serviceFailed: commonlib.annotations.serviceFailed.new(
title='Service failed',
target=this.grafana.targets.serviceFailed,
)
+ commonlib.annotations.base.withTagKeys(std.join(',', this.config.groupLabels + this.config.instanceLabels + ['level']))
+ commonlib.annotations.base.withTextFormat('{{message}}'),
criticalEvents: commonlib.annotations.fatal.new(
title='Critical system event',
target=this.grafana.targets.criticalEvents,
)
+ commonlib.annotations.base.withTagKeys(std.join(',', this.config.groupLabels + this.config.instanceLabels + ['level']))
+ commonlib.annotations.base.withTextFormat('{{message}}'),
}
else
{},
// common links here
links: {
local link = g.dashboard.link,
backToFleet:
link.link.new('Back to Windows fleet', '/d/' + this.grafana.dashboards.fleet.uid)
+ link.link.options.withKeepTime(true),
backToOverview:
link.link.new('Back to Windows overview', '/d/' + this.grafana.dashboards.overview.uid)
+ link.link.options.withKeepTime(true),
otherDashboards:
link.dashboards.new('All Windows dashboards', this.config.dashboardTags)
+ link.dashboards.options.withIncludeVars(true)
+ link.dashboards.options.withKeepTime(true)
+ link.dashboards.options.withAsDropdown(true),
},

// common links here
links: {
local link = g.dashboard.link,
backToFleet:
link.link.new('Back to Windows fleet', '/d/' + this.dashboards.fleet.uid)
+ link.link.options.withKeepTime(true),
backToOverview:
link.link.new('Back to Windows overview', '/d/' + this.dashboards.overview.uid)
+ link.link.options.withKeepTime(true),
otherDashboards:
link.dashboards.new('All Windows dashboards', dashboardTags)
+ link.dashboards.options.withIncludeVars(true)
+ link.dashboards.options.withKeepTime(true)
+ link.dashboards.options.withAsDropdown(true),
panels: panels.new(this),
dashboards: dashboards.new(this),
},

panels: panels.new(
this
),

dashboards: dashboards.new(
this
),
prometheus: {
alerts: alerts.new(this),
recordingRules: {},
},

alerts: alerts.new(this),
recordingRules: {},
},

}
14 changes: 7 additions & 7 deletions windows-observ-lib/panels.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local utils = commonlib.utils;
{
new(this):
{
local t = this.targets,
local t = this.grafana.targets,
local table = g.panel.table,
local fieldOverride = g.panel.table.fieldOverride,
local instanceLabel = this.config.instanceLabels[0],
Expand Down Expand Up @@ -66,7 +66,7 @@ local utils = commonlib.utils;
{
targetBlank: false,
title: 'Drill down to ${__field.name} ${__value.text}',
url: 'd/%s?var-%s=${__data.fields.%s}&${__url_time_range}' % [this.dashboards.overview.uid, instanceLabel, instanceLabel],
url: 'd/%s?var-%s=${__data.fields.%s}&${__url_time_range}' % [this.grafana.dashboards.overview.uid, instanceLabel, instanceLabel],
},
]),
fieldOverride.byRegexp.new(std.join('|', std.map(utils.toSentenceCase, this.config.groupLabels)))
Expand All @@ -75,7 +75,7 @@ local utils = commonlib.utils;
{
targetBlank: false,
title: 'Filter by ${__field.name}',
url: 'd/%s?var-${__field.name}=${__value.text}&${__url_time_range}' % [this.dashboards.fleet.uid],
url: 'd/%s?var-${__field.name}=${__value.text}&${__url_time_range}' % [this.grafana.dashboards.fleet.uid],
},
]),
fieldOverride.byName.new('CPU count')
Expand Down Expand Up @@ -221,7 +221,7 @@ local utils = commonlib.utils;
target=t.cpuUsage,
topk=25,
instanceLabels=this.config.instanceLabels,
drillDownDashboardUid=this.dashboards.overview.uid,
drillDownDashboardUid=this.grafana.dashboards.overview.uid,
),
cpuUsageStat: commonlib.panels.cpu.stat.usage.new(targets=[t.cpuUsage]),
cpuUsageByMode: commonlib.panels.cpu.timeSeries.utilizationByMode.new(
Expand Down Expand Up @@ -259,7 +259,7 @@ local utils = commonlib.utils;
target=t.memoryUsagePercent,
topk=25,
instanceLabels=this.config.instanceLabels,
drillDownDashboardUid=this.dashboards.overview.uid,
drillDownDashboardUid=this.grafana.dashboards.overview.uid,
),
memoryUsageTsBytes: commonlib.panels.memory.timeSeries.usageBytes.new(targets=[t.memoryUsedBytes, t.memoryTotalBytes]),
diskTotalC:
Expand Down Expand Up @@ -288,7 +288,7 @@ local utils = commonlib.utils;
target=t.diskUsagePercent,
topk=25,
instanceLabels=this.config.instanceLabels + ['volume'],
drillDownDashboardUid=this.dashboards.overview.uid,
drillDownDashboardUid=this.grafana.dashboards.overview.uid,
),
diskIOBytesPerSec: commonlib.panels.disk.timeSeries.ioBytesPerSec.new(
targets=[t.diskIOreadBytesPerSec, t.diskIOwriteBytesPerSec, t.diskIOutilization]
Expand All @@ -299,7 +299,7 @@ local utils = commonlib.utils;
target=t.diskIOutilization,
topk=25,
instanceLabels=this.config.instanceLabels + ['volume'],
drillDownDashboardUid=this.dashboards.overview.uid,
drillDownDashboardUid=this.grafana.dashboards.overview.uid,
),
diskIOps:
commonlib.panels.disk.timeSeries.iops.new(
Expand Down
2 changes: 1 addition & 1 deletion windows-observ-lib/targets.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local lokiQuery = g.query.loki;

{
new(this): {
local variables = this.variables,
local variables = this.grafana.variables,
local config = this.config,
uptimeQuery:: 'windows_system_system_up_time',

Expand Down
8 changes: 5 additions & 3 deletions windows-observ-lib/variables.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ local utils = commonlib.utils;
datasources: {
prometheus:
var.datasource.new('datasource', 'prometheus')
+ var.datasource.generalOptions.withLabel('Data source'),
+ var.datasource.generalOptions.withLabel('Data source')
+ var.datasource.withRegex(''),
loki:
var.datasource.new('loki_datasource', 'loki')
+ var.datasource.generalOptions.withLabel('Loki data source')
+ var.datasource.withRegex('')
+ var.datasource.generalOptions.showOnDashboard.withNothing(),
},
// Use on dashboards where multiple entities can be selected, like fleet dashboards
Expand All @@ -64,7 +66,7 @@ local utils = commonlib.utils;
}
+ if this.config.enableLokiLogs then self.withLokiLogs(this) else {},
withLokiLogs(this): {
multiInstance+: [this.variables.datasources.loki],
singleInstance+: [this.variables.datasources.loki],
multiInstance+: [this.grafana.variables.datasources.loki],
singleInstance+: [this.grafana.variables.datasources.loki],
},
}