From 3a49f7f624e0d8375c898827f15f27098c92b981 Mon Sep 17 00:00:00 2001 From: panotuco Date: Thu, 9 Apr 2026 11:26:38 +0200 Subject: [PATCH] P --- config.alloy | 4 ++++ get_version_chrome.ps1 | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 get_version_chrome.ps1 diff --git a/config.alloy b/config.alloy index 51eb5e7..638f47b 100644 --- a/config.alloy +++ b/config.alloy @@ -18,7 +18,11 @@ prometheus.exporter.windows "local" { "service", "logon", "update", + "textfile", ] + textfile { + directory = "C:/ProgramData/Alloy/metrics" + } } prometheus.scrape "windows_exporter" { diff --git a/get_version_chrome.ps1 b/get_version_chrome.ps1 new file mode 100644 index 0000000..4f2692d --- /dev/null +++ b/get_version_chrome.ps1 @@ -0,0 +1,12 @@ +# Crear directorio si no existe +$dir = "C:\ProgramData\Alloy\metrics" +if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force } + +# Obtener versión de Chrome +$path = "${env:ProgramFiles}\Google\Chrome\Application\chrome.exe" +if (Test-Path $path) { + $ver = (Get-Item $path).VersionInfo.ProductVersion + # Formato Prometheus: nombre_metrica{labels} valor + # Usamos valor 1 para que la métrica exista + "chrome_version_info{version=`"$ver`",arch=`"x64`"} 1" | Set-Content "$dir\chrome.prom" -Encoding ascii +} \ No newline at end of file