diff --git a/windows-observ-lib/config.libsonnet b/windows-observ-lib/config.libsonnet index fd2e2a69e..2e201ddf3 100644 --- a/windows-observ-lib/config.libsonnet +++ b/windows-observ-lib/config.libsonnet @@ -14,9 +14,10 @@ dashboardNamePrefix: '', // 'prometheus_pre_0_30' points to old metrics schema prior to breaking changes in windows_exporter v0.30.0, - // 'prometheus' points to current metrics schema. - // Use any of the above or both. - metricsSource: ['prometheus', 'prometheus_pre_0_30'], + // 'prometheus_pre_0_31' points to metrics schema from v0.30.0 to v0.31.0, + // 'prometheus' points to current metrics schema (v0.31.0+, Alloy v1.11+). + // Use any of the above or combination based on your exporter version. + metricsSource: ['prometheus', 'prometheus_pre_0_31', 'prometheus_pre_0_30'], // optional ignoreVolumes: 'HarddiskVolume.*', diff --git a/windows-observ-lib/dashboards_out/disks b/windows-observ-lib/dashboards_out/disks index 0697b79b6..98d7e45b4 100644 --- a/windows-observ-lib/dashboards_out/disks +++ b/windows-observ-lib/dashboards_out/disks @@ -21,7 +21,7 @@ "uid": "${prometheus_datasource}" }, "enable": true, - "expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to", + "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", "hide": true, "iconColor": "light-yellow", "name": "Reboot", diff --git a/windows-observ-lib/dashboards_out/fleet b/windows-observ-lib/dashboards_out/fleet index 43af8a1ba..29e0e4c96 100644 --- a/windows-observ-lib/dashboards_out/fleet +++ b/windows-observ-lib/dashboards_out/fleet @@ -21,7 +21,7 @@ "uid": "${prometheus_datasource}" }, "enable": true, - "expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to", + "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", "hide": true, "iconColor": "light-yellow", "name": "Reboot", @@ -429,7 +429,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "time() - windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\ntime() - windows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}", + "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\"}", "format": "table", "instant": true, "legendFormat": "{{instance}}: Uptime", diff --git a/windows-observ-lib/dashboards_out/logs b/windows-observ-lib/dashboards_out/logs index b65c66f42..03192f52f 100644 --- a/windows-observ-lib/dashboards_out/logs +++ b/windows-observ-lib/dashboards_out/logs @@ -21,7 +21,7 @@ "uid": "${prometheus_datasource}" }, "enable": true, - "expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to", + "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", "hide": true, "iconColor": "light-yellow", "name": "Reboot", diff --git a/windows-observ-lib/dashboards_out/overview b/windows-observ-lib/dashboards_out/overview index ced916fe3..88dd17595 100644 --- a/windows-observ-lib/dashboards_out/overview +++ b/windows-observ-lib/dashboards_out/overview @@ -21,7 +21,7 @@ "uid": "${prometheus_datasource}" }, "enable": true, - "expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to", + "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", "hide": true, "iconColor": "light-yellow", "name": "Reboot", @@ -128,7 +128,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "time() - windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\ntime() - windows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}", + "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\"}", "format": "time_series", "instant": false, "legendFormat": "{{instance}}: Uptime", diff --git a/windows-observ-lib/dashboards_out/system b/windows-observ-lib/dashboards_out/system index f06fcfd25..c67a24294 100644 --- a/windows-observ-lib/dashboards_out/system +++ b/windows-observ-lib/dashboards_out/system @@ -21,7 +21,7 @@ "uid": "${prometheus_datasource}" }, "enable": true, - "expr": "windows_system_boot_time_timestamp_seconds{job=~\"$job\",instance=~\"$instance\"}\nor\nwindows_system_system_up_time{job=~\"$job\",instance=~\"$instance\"}*1000 > $__from < $__to", + "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", "hide": true, "iconColor": "light-yellow", "name": "Reboot", diff --git a/windows-observ-lib/prometheus_rules_out/prometheus_alerts.yaml b/windows-observ-lib/prometheus_rules_out/prometheus_alerts.yaml index 13c3fff29..f71263894 100644 --- a/windows-observ-lib/prometheus_rules_out/prometheus_alerts.yaml +++ b/windows-observ-lib/prometheus_rules_out/prometheus_alerts.yaml @@ -84,10 +84,14 @@ groups: expr: | (time() - windows_system_boot_time_timestamp_seconds{} or + time() - windows_system_boot_time_timestamp{} + or time() - windows_system_system_up_time{}) < 600 and ((time() - windows_system_boot_time_timestamp_seconds{} offset 10m) or + (time() - windows_system_boot_time_timestamp{} offset 10m) + or (time() - windows_system_system_up_time{} offset 10m)) > 600 labels: severity: info diff --git a/windows-observ-lib/signals/memory.libsonnet b/windows-observ-lib/signals/memory.libsonnet index fb6c57739..71ec4135f 100644 --- a/windows-observ-lib/signals/memory.libsonnet +++ b/windows-observ-lib/signals/memory.libsonnet @@ -10,6 +10,7 @@ function(this) aggFunction: 'avg', discoveryMetric: { prometheus: 'windows_memory_physical_total_bytes', + prometheus_pre_0_31: 'windows_cs_physical_memory_bytes', prometheus_pre_0_30: 'windows_cs_physical_memory_bytes', }, signals: { @@ -20,12 +21,16 @@ function(this) description: 'Total physical memory in bytes', unit: 'bytes', sources: { - prometheus_pre_0_30: { + prometheus: { + expr: 'windows_memory_physical_total_bytes{%(queriesSelector)s}', + legendCustomTemplate: 'Memory total', + }, + prometheus_pre_0_31: { expr: 'windows_cs_physical_memory_bytes{%(queriesSelector)s}', legendCustomTemplate: 'Memory total', }, - prometheus: { - expr: 'windows_memory_physical_total_bytes{%(queriesSelector)s}', + prometheus_pre_0_30: { + expr: 'windows_cs_physical_memory_bytes{%(queriesSelector)s}', legendCustomTemplate: 'Memory total', }, }, @@ -37,12 +42,15 @@ function(this) description: 'Free physical memory in bytes', unit: 'bytes', sources: { - prometheus_pre_0_30: { - expr: 'windows_os_physical_memory_free_bytes{%(queriesSelector)s}', - }, prometheus: { expr: 'windows_memory_physical_free_bytes{%(queriesSelector)s}', }, + prometheus_pre_0_31: { + expr: 'windows_os_physical_memory_free_bytes{%(queriesSelector)s}', + }, + prometheus_pre_0_30: { + expr: 'windows_os_physical_memory_free_bytes{%(queriesSelector)s}', + }, }, }, memoryUsed: { @@ -52,12 +60,16 @@ function(this) description: 'Used physical memory in bytes', unit: 'bytes', sources: { - prometheus_pre_0_30: { + prometheus: { + expr: 'windows_memory_physical_total_bytes{%(queriesSelector)s} - windows_memory_physical_free_bytes{%(queriesSelector)s}', + legendCustomTemplate: 'Memory used', + }, + prometheus_pre_0_31: { expr: 'windows_cs_physical_memory_bytes{%(queriesSelector)s} - windows_os_physical_memory_free_bytes{%(queriesSelector)s}', legendCustomTemplate: 'Memory used', }, - prometheus: { - expr: 'windows_memory_physical_total_bytes{%(queriesSelector)s} - windows_memory_physical_free_bytes{%(queriesSelector)s}', + prometheus_pre_0_30: { + expr: 'windows_cs_physical_memory_bytes{%(queriesSelector)s} - windows_os_physical_memory_free_bytes{%(queriesSelector)s}', legendCustomTemplate: 'Memory used', }, @@ -70,12 +82,15 @@ function(this) description: 'Memory usage percentage', unit: 'percent', sources: { - prometheus_pre_0_30: { - expr: '100 - windows_os_physical_memory_free_bytes{%(queriesSelector)s} / windows_cs_physical_memory_bytes{%(queriesSelector)s} * 100', - }, prometheus: { expr: '100 - windows_memory_physical_free_bytes{%(queriesSelector)s} / windows_memory_physical_total_bytes{%(queriesSelector)s} * 100', }, + prometheus_pre_0_31: { + expr: '100 - windows_os_physical_memory_free_bytes{%(queriesSelector)s} / windows_cs_physical_memory_bytes{%(queriesSelector)s} * 100', + }, + prometheus_pre_0_30: { + expr: '100 - windows_os_physical_memory_free_bytes{%(queriesSelector)s} / windows_cs_physical_memory_bytes{%(queriesSelector)s} * 100', + }, }, }, memoryPageTotal: { diff --git a/windows-observ-lib/signals/system.libsonnet b/windows-observ-lib/signals/system.libsonnet index 41981e14e..76188bf7c 100644 --- a/windows-observ-lib/signals/system.libsonnet +++ b/windows-observ-lib/signals/system.libsonnet @@ -34,6 +34,9 @@ function(this) unit: 's', sources: { prometheus: { + expr: 'time() - windows_system_boot_time_timestamp{%(queriesSelector)s}', + }, + prometheus_pre_0_31: { expr: 'time() - windows_system_boot_time_timestamp_seconds{%(queriesSelector)s}', }, prometheus_pre_0_30: { @@ -48,13 +51,15 @@ function(this) description: 'System boot time', unit: 's', sources: { - prometheus_pre_0_30: { - expr: 'windows_system_system_up_time{%(queriesSelector)s}', - }, - // https://github.com/prometheus-community/windows_exporter/releases/tag/v0.30.0 prometheus: { + expr: 'windows_system_boot_time_timestamp{%(queriesSelector)s}', + }, + prometheus_pre_0_31: { expr: 'windows_system_boot_time_timestamp_seconds{%(queriesSelector)s}', }, + prometheus_pre_0_30: { + expr: 'windows_system_system_up_time{%(queriesSelector)s}', + }, }, }, cpuCount: { @@ -186,7 +191,7 @@ function(this) legendCustomTemplate: 'Time adjustments', }, // https://github.com/prometheus-community/windows_exporter/pull/1910 - prometheus_pre_0_30: { + prometheus_pre_0_31: { expr: 'windows_time_clock_frequency_adjustment_ppb_total{%(queriesSelector)s}', legendCustomTemplate: 'Time adjustments', }, @@ -203,6 +208,10 @@ function(this) expr: 'windows_time_timezone{%(queriesSelector)s}', infoLabel: 'timezone', }, + prometheus_pre_0_31: { + expr: 'windows_os_timezone{%(queriesSelector)s}', + infoLabel: 'timezone', + }, prometheus_pre_0_30: { expr: 'windows_os_timezone{%(queriesSelector)s}', infoLabel: 'timezone',