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
Next Next commit
Add initial structure for windows modular mixin
  • Loading branch information
v-zhuravlev committed Oct 18, 2023
commit aeb54051f7d2b03b0c4e5386e0708f459fb2bdb7
14 changes: 12 additions & 2 deletions windows-mixin/dashboards/dashboards.libsonnet
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
(import 'windows_exporter.libsonnet') +
(import 'windows_logs.libsonnet')
// (import 'windows_exporter.libsonnet') +
// (import 'windows_logs.libsonnet')
local winlib = import '../lib/windows-lib/main.libsonnet';
{
local windows = winlib.new(
prefix="My ",
uid="windows",
filterSelector='job="windows"',
),
grafanaDashboards+::
windows.dashboards
}
8 changes: 8 additions & 0 deletions windows-mixin/jsonnetfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
}
},
"version": "master"
},
{
"source": {
"local": {
"directory": "lib/windows-lib"
}
},
"version": ""
}
],
"legacyImports": true
Expand Down
34 changes: 34 additions & 0 deletions windows-mixin/lib/windows-lib/dashboards.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
local g = import './g.libsonnet';

{
local this = self,
new(
prefix,
links,
tags,
uid,
vars):
{
fleet:
local title=prefix+"Windows fleet overview";
g.dashboard.new(title)
// hide link to self
+ this.applyCommon(vars.multiInstance, uid+'-fleet', tags, links + { backToFleet+:: {}, backToOverview+:: {} }),
overview: g.dashboard.new(prefix+"Windows overview")
+ g.dashboard.withUid('overview')
+ this.applyCommon(vars.singleInstance, uid+'-overview', tags, links + { backToOverview+:: {} }),
network: g.dashboard.new(prefix+"Windows network")
+ this.applyCommon(vars.singleInstance, uid+'-network', tags, links),

disks: g.dashboard.new(prefix+"Windows disks and filesystems")
+ this.applyCommon(vars.singleInstance, uid+'-disks', tags, links),

logs: g.dashboard.new(prefix+"Windows logs")
+ this.applyCommon(vars.multiInstance, uid+'-logs', tags, links),
},
applyCommon(vars, uid, tags, links):
g.dashboard.withTags(tags)
+ g.dashboard.withUid(g.util.string.slugify(uid))
+ g.dashboard.withLinks(std.objectValues(links))
+ g.dashboard.withVariables(vars)
}
1 change: 1 addition & 0 deletions windows-mixin/lib/windows-lib/g.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'github.com/grafana/grafonnet/gen/grafonnet-v10.0.0/main.libsonnet'
23 changes: 23 additions & 0 deletions windows-mixin/lib/windows-lib/jsonnetfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": 1,
"dependencies": [
{
"source": {
"local": {
"directory": "../../../../jl-common-lib/common-lib/common"
}
},
"version": ""
},
{
"source": {
"git": {
"remote": "https://github.com/grafana/grafonnet.git",
"subdir": "gen/grafonnet-v10.0.0"
}
},
"version": "main"
}
],
"legacyImports": true
}
92 changes: 92 additions & 0 deletions windows-mixin/lib/windows-lib/main.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
local dashboards = import './dashboards.libsonnet';
local panels = import './panels.libsonnet';
local targets = import './targets.libsonnet';
local variables = import './variables.libsonnet';
local g = import './g.libsonnet';
local commonlib = import 'common/main.libsonnet';

{

// any modular library should inlcude as inputs:
// 'prefix' - Use as prefix for all Dashboards and (optional) rule groups
// 'filterSelector' - 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'.

new(
prefix="",
filterSelector,
tags=[uid],
uid,
// filterSelector,
groupLabels=['job'],
instanceLabels=['instance']
// datasourceRegex,
// datasourceName='datasource',
// formatParser=null,
// showLogsVolume=true,
// logsVolumeGroupBy='level',
// extraFilters='',
): {

local this = self,
variables: variables.new(
// datasourceName,
// datasourceRegex,
filterSelector,
groupLabels,
instanceLabels,
),

// targets: targets.new(
// this.variables,
// // formatParser,
// // logsVolumeGroupBy,
// // extraFilters,
// ),
// annotations: {
// reboot: commonlib.annotations.reboot.new(
// title="Reboot",
// target=c.commonPromTarget(
// 'windows_system_system_up_time{%(nodeQuerySelector)s}*1000 > $__from < $__to' % config { nodeQuerySelector: nodeQuerySelector },
// legendFormat='',
// ),
// instanceLabels="instance",
// ),
// },

// 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', tags)
+ link.dashboards.options.withIncludeVars(true)
+ link.dashboards.options.withKeepTime(true)
+ link.dashboards.options.withAsDropdown(true),
},

panels: panels.new(
// this.targets.logsVolumeTarget,
// this.targets.logsTarget,
),

dashboards: dashboards.new(
prefix,
this.links,
tags,
uid,
// this.panels,
this.variables,
),

alerts: {},
recordingRules: {},
},

}
Empty file.
Empty file.
38 changes: 38 additions & 0 deletions windows-mixin/lib/windows-lib/utils.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
local this = self,

labelsToURLvars(labels, prefix)::
std.join('&', ['var-%s=${%s%s}' % [label, prefix, label] for label in labels]),

// For PromQL or LogQL
labelsToPromQLSelector(labels): std.join(',', ['%s=~"$%s"' % [label, label] for label in labels]),
labelsToLogQLSelector: self.labelsToPromQLSelector,

labelsToPanelLegend(labels): std.join('/', ['{{%s}}' % [label] for label in labels]),

// Generate a chain of labels. Useful to create chained variables
chainLabels(labels, additionalFilters=[]):
local last(arr) = std.reverse(arr)[0];
local chainSelector(chain) =
std.join(
',',
additionalFilters
+ (if std.length(chain) > 0
then [this.labelsToPromQLSelector(chain)]
else [])
);
std.foldl(
function(prev, label)
prev
+ [{
label: label,
chainSelector: chainSelector(self.chain),
chain::
if std.length(prev) > 0
then last(prev).chain + [last(prev).label]
else [],
}],
labels,
[]
),
}
57 changes: 57 additions & 0 deletions windows-mixin/lib/windows-lib/variables.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// variables.libsonnet
local g = import './g.libsonnet';
local var = g.dashboard.variable;
local utils = import './utils.libsonnet';

{
new(
filterSelector,
groupLabels,
instanceLabels,
): {

local this = self,
local varMetric = 'windows_os_info',
local variablesFromLabels(groupLabels, instanceLabels, filterSelector, multiInstance=true) =
local chainVarProto(index, chainVar) =
var.query.new(chainVar.label)
+ var.query.withDatasourceFromVariable(this.datasource)
+ var.query.queryTypes.withLabelValues(
chainVar.label,
'%s{%s}' % [varMetric, chainVar.chainSelector],
)

+ var.query.selectionOptions.withIncludeAll(
value=if (!multiInstance && std.member(instanceLabels, chainVar.label)) then false else true,
customAllValue=if index>0 then '.+' else null,
)
+ var.query.selectionOptions.withMulti(
if (!multiInstance && std.member(instanceLabels, chainVar.label)) then false else true,
)
+ var.query.withRefresh(2)
+ var.query.withSort(
i=1,
type='alphabetical',
asc=true,
caseInsensitive=false
);
std.mapWithIndex(chainVarProto, utils.chainLabels(groupLabels+instanceLabels, [filterSelector])),

datasource:
var.datasource.new('datasource', 'prometheus')
+ var.datasource.generalOptions.withLabel('Data Source'),

multiInstance:
[self.datasource]
+ variablesFromLabels(groupLabels, instanceLabels, filterSelector),
singleInstance:
[self.datasource]
+ variablesFromLabels(groupLabels, instanceLabels, filterSelector, multiInstance=false),

queriesSelector:
'%s,%s' % [
filterSelector,
utils.labelsToPromQLSelector(groupLabels+instanceLabels),
],
}
}