Skip to content

Commit 3305c6e

Browse files
authored
Use freeTarget in windows-lib (#1091)
This is first class metric available from windows_exporter, not cumbersome substraction of two metrics we had in usedTarget
1 parent 39603de commit 3305c6e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

windows-observ-lib/panels.libsonnet

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,12 @@ local utils = commonlib.utils;
271271
|||
272272
),
273273
diskUsage: commonlib.panels.disk.table.usage.new(
274-
totalTarget=
275-
(t.diskTotal
276-
+ g.query.prometheus.withFormat('table')
277-
+ g.query.prometheus.withInstant(true)),
278-
usageTarget=t.diskUsage
274+
totalTarget=t.diskTotal
279275
+ g.query.prometheus.withFormat('table')
280276
+ g.query.prometheus.withInstant(true),
277+
freeTarget=t.diskFree
278+
+ g.query.prometheus.withFormat('table')
279+
+ g.query.prometheus.withInstant(true),
281280
groupLabel='volume'
282281
),
283282
diskUsagePercent: commonlib.panels.disk.timeSeries.usagePercent.new(

windows-observ-lib/targets.libsonnet

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ local lokiQuery = g.query.loki;
120120
'${' + variables.datasources.prometheus.name + '}',
121121
'100 - windows_logical_disk_free_bytes{volume="C:", %(queriesSelector)s}/windows_logical_disk_size_bytes{volume="C:", %(queriesSelector)s}*100' % variables
122122
),
123+
diskFree:
124+
prometheusQuery.new(
125+
'${' + variables.datasources.prometheus.name + '}',
126+
'windows_logical_disk_free_bytes{volume!~"%(ignoreVolumes)s", %(queriesSelector)s}' % variables { ignoreVolumes: config.ignoreVolumes }
127+
)
128+
+ prometheusQuery.withLegendFormat('{{ volume }} available'),
123129
diskUsage:
124130
prometheusQuery.new(
125131
'${' + variables.datasources.prometheus.name + '}',

0 commit comments

Comments
 (0)