Skip to content

Commit 816f083

Browse files
authored
Bugfix - Update metrics from the new Windows exporter (#1556)
* Fix broken metrics from v0.31.0 exporter * Address PR comments.
1 parent 181a552 commit 816f083

File tree

9 files changed

+45
-30
lines changed

9 files changed

+45
-30
lines changed

windows-observ-lib/config.libsonnet

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
dashboardNamePrefix: '',
1515

1616
// 'prometheus_pre_0_30' points to old metrics schema prior to breaking changes in windows_exporter v0.30.0,
17-
// 'prometheus' points to current metrics schema.
18-
// Use any of the above or both.
19-
metricsSource: ['prometheus', 'prometheus_pre_0_30'],
17+
// 'prometheus_pre_0_31' points to metrics schema from v0.30.0 to v0.31.0,
18+
// 'prometheus' points to current metrics schema (v0.31.0+, Alloy v1.11+).
19+
// Use any of the above or combination based on your exporter version.
20+
metricsSource: ['prometheus', 'prometheus_pre_0_31', 'prometheus_pre_0_30'],
2021

2122
// optional
2223
ignoreVolumes: 'HarddiskVolume.*',

windows-observ-lib/dashboards_out/disks

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"uid": "${prometheus_datasource}"
2222
},
2323
"enable": true,
24-
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
24+
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_boot_time_timestamp{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
2525
"hide": true,
2626
"iconColor": "light-yellow",
2727
"name": "Reboot",

windows-observ-lib/dashboards_out/fleet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"uid": "${prometheus_datasource}"
2222
},
2323
"enable": true,
24-
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
24+
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_boot_time_timestamp{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
2525
"hide": true,
2626
"iconColor": "light-yellow",
2727
"name": "Reboot",
@@ -429,7 +429,7 @@
429429
"type": "prometheus",
430430
"uid": "${prometheus_datasource}"
431431
},
432-
"expr": "time() - windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\ntime() - windows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}",
432+
"expr": "time() - windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\ntime() - windows_system_boot_time_timestamp{job=~\"$job\",instance=~\"$instance\"}\nor\ntime() - windows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}",
433433
"format": "table",
434434
"instant": true,
435435
"legendFormat": "{{instance}}: Uptime",

windows-observ-lib/dashboards_out/logs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"uid": "${prometheus_datasource}"
2222
},
2323
"enable": true,
24-
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
24+
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_boot_time_timestamp{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
2525
"hide": true,
2626
"iconColor": "light-yellow",
2727
"name": "Reboot",

windows-observ-lib/dashboards_out/overview

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"uid": "${prometheus_datasource}"
2222
},
2323
"enable": true,
24-
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
24+
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_boot_time_timestamp{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
2525
"hide": true,
2626
"iconColor": "light-yellow",
2727
"name": "Reboot",
@@ -128,7 +128,7 @@
128128
"type": "prometheus",
129129
"uid": "${prometheus_datasource}"
130130
},
131-
"expr": "time() - windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\ntime() - windows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}",
131+
"expr": "time() - windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\ntime() - windows_system_boot_time_timestamp{job=~\"$job\",instance=~\"$instance\"}\nor\ntime() - windows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}",
132132
"format": "time_series",
133133
"instant": false,
134134
"legendFormat": "{{instance}}: Uptime",

windows-observ-lib/dashboards_out/system

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"uid": "${prometheus_datasource}"
2222
},
2323
"enable": true,
24-
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
24+
"expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_boot_time_timestamp{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to",
2525
"hide": true,
2626
"iconColor": "light-yellow",
2727
"name": "Reboot",

windows-observ-lib/prometheus_rules_out/prometheus_alerts.yaml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

windows-observ-lib/signals/memory.libsonnet

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function(this)
1111
discoveryMetric: {
1212
prometheus: 'windows_memory_physical_total_bytes',
1313
prometheus_pre_0_30: 'windows_cs_physical_memory_bytes',
14+
prometheus_pre_0_31: self.prometheus_pre_0_30,
1415
},
1516
signals: {
1617
memoryTotal: {
@@ -20,14 +21,15 @@ function(this)
2021
description: 'Total physical memory in bytes',
2122
unit: 'bytes',
2223
sources: {
23-
prometheus_pre_0_30: {
24-
expr: 'windows_cs_physical_memory_bytes{%(queriesSelector)s}',
25-
legendCustomTemplate: 'Memory total',
26-
},
2724
prometheus: {
2825
expr: 'windows_memory_physical_total_bytes{%(queriesSelector)s}',
2926
legendCustomTemplate: 'Memory total',
3027
},
28+
prometheus_pre_0_30: {
29+
expr: 'windows_cs_physical_memory_bytes{%(queriesSelector)s}',
30+
legendCustomTemplate: 'Memory total',
31+
},
32+
prometheus_pre_0_31: self.prometheus_pre_0_30,
3133
},
3234
},
3335
memoryFree: {
@@ -37,12 +39,13 @@ function(this)
3739
description: 'Free physical memory in bytes',
3840
unit: 'bytes',
3941
sources: {
40-
prometheus_pre_0_30: {
41-
expr: 'windows_os_physical_memory_free_bytes{%(queriesSelector)s}',
42-
},
4342
prometheus: {
4443
expr: 'windows_memory_physical_free_bytes{%(queriesSelector)s}',
4544
},
45+
prometheus_pre_0_30: {
46+
expr: 'windows_os_physical_memory_free_bytes{%(queriesSelector)s}',
47+
},
48+
prometheus_pre_0_31: self.prometheus_pre_0_30,
4649
},
4750
},
4851
memoryUsed: {
@@ -52,15 +55,15 @@ function(this)
5255
description: 'Used physical memory in bytes',
5356
unit: 'bytes',
5457
sources: {
55-
prometheus_pre_0_30: {
56-
expr: 'windows_cs_physical_memory_bytes{%(queriesSelector)s} - windows_os_physical_memory_free_bytes{%(queriesSelector)s}',
57-
legendCustomTemplate: 'Memory used',
58-
},
5958
prometheus: {
6059
expr: 'windows_memory_physical_total_bytes{%(queriesSelector)s} - windows_memory_physical_free_bytes{%(queriesSelector)s}',
6160
legendCustomTemplate: 'Memory used',
6261
},
63-
62+
prometheus_pre_0_30: {
63+
expr: 'windows_cs_physical_memory_bytes{%(queriesSelector)s} - windows_os_physical_memory_free_bytes{%(queriesSelector)s}',
64+
legendCustomTemplate: 'Memory used',
65+
},
66+
prometheus_pre_0_31: self.prometheus_pre_0_30,
6467
},
6568
},
6669
memoryUsagePercent: {
@@ -70,12 +73,13 @@ function(this)
7073
description: 'Memory usage percentage',
7174
unit: 'percent',
7275
sources: {
73-
prometheus_pre_0_30: {
74-
expr: '100 - windows_os_physical_memory_free_bytes{%(queriesSelector)s} / windows_cs_physical_memory_bytes{%(queriesSelector)s} * 100',
75-
},
7676
prometheus: {
7777
expr: '100 - windows_memory_physical_free_bytes{%(queriesSelector)s} / windows_memory_physical_total_bytes{%(queriesSelector)s} * 100',
7878
},
79+
prometheus_pre_0_30: {
80+
expr: '100 - windows_os_physical_memory_free_bytes{%(queriesSelector)s} / windows_cs_physical_memory_bytes{%(queriesSelector)s} * 100',
81+
},
82+
prometheus_pre_0_31: self.prometheus_pre_0_30,
7983
},
8084
},
8185
memoryPageTotal: {

windows-observ-lib/signals/system.libsonnet

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ function(this)
3434
unit: 's',
3535
sources: {
3636
prometheus: {
37+
expr: 'time() - windows_system_boot_time_timestamp{%(queriesSelector)s}',
38+
},
39+
prometheus_pre_0_31: {
3740
expr: 'time() - windows_system_boot_time_timestamp_seconds{%(queriesSelector)s}',
3841
},
3942
prometheus_pre_0_30: {
@@ -48,13 +51,15 @@ function(this)
4851
description: 'System boot time',
4952
unit: 's',
5053
sources: {
51-
prometheus_pre_0_30: {
52-
expr: 'windows_system_system_up_time{%(queriesSelector)s}',
53-
},
54-
// https://github.com/prometheus-community/windows_exporter/releases/tag/v0.30.0
5554
prometheus: {
55+
expr: 'windows_system_boot_time_timestamp{%(queriesSelector)s}',
56+
},
57+
prometheus_pre_0_31: {
5658
expr: 'windows_system_boot_time_timestamp_seconds{%(queriesSelector)s}',
5759
},
60+
prometheus_pre_0_30: {
61+
expr: 'windows_system_system_up_time{%(queriesSelector)s}',
62+
},
5863
},
5964
},
6065
cpuCount: {
@@ -186,7 +191,7 @@ function(this)
186191
legendCustomTemplate: 'Time adjustments',
187192
},
188193
// https://github.com/prometheus-community/windows_exporter/pull/1910
189-
prometheus_pre_0_30: {
194+
prometheus_pre_0_31: {
190195
expr: 'windows_time_clock_frequency_adjustment_ppb_total{%(queriesSelector)s}',
191196
legendCustomTemplate: 'Time adjustments',
192197
},
@@ -207,6 +212,7 @@ function(this)
207212
expr: 'windows_os_timezone{%(queriesSelector)s}',
208213
infoLabel: 'timezone',
209214
},
215+
prometheus_pre_0_31: self.prometheus_pre_0_30,
210216
},
211217
},
212218
},

0 commit comments

Comments
 (0)