scheduled_task: do not report windows_scheduled_task_last_result for task that never run before (#1562)

This commit is contained in:
Jan-Otto Kröpke
2024-08-11 15:47:59 +02:00
committed by GitHub
parent dd956c986b
commit ca4ad46e2d
4 changed files with 42 additions and 24 deletions

View File

@@ -25,7 +25,7 @@ $skip_re = "^(go_|windows_exporter_build_info|windows_exporter_collector_duratio
$exporter_proc = Start-Process `
-PassThru `
-FilePath ..\windows_exporter.exe `
-ArgumentList "--log.level=debug --web.disable-exporter-metrics --collectors.enabled=[defaults],textfile --collector.textfile.directories=$($textfile_dir)" `
-ArgumentList "--log.level=debug --web.disable-exporter-metrics --collectors.enabled=[defaults],textfile,scheduled_task --collector.scheduled_task.include=.*WinSAT --collector.textfile.directories=$($textfile_dir)" `
-WindowStyle Hidden `
-RedirectStandardOutput "$($temp_dir)/windows_exporter.log" `
-RedirectStandardError "$($temp_dir)/windows_exporter_error.log"
@@ -36,7 +36,7 @@ for ($i=1; $i -le 5; $i++) {
$netstat_output = netstat -anp tcp | Select-String 'listening'
if ($netstat_output -like '*:9182*') {
break
break
}
Write-Host "Waiting for exporter to start"
}
@@ -64,5 +64,6 @@ if (-not ($null -eq $output_diff)) {
Get-Content "$($temp_dir)/windows_exporter.log"
Write-Host "STDERR"
Get-Content "$($temp_dir)/windows_exporter_error.log"
exit 1
}