Add CI support for textfile collector

Signed-off-by: Ben Reedy <breed808@breed808.com>
This commit is contained in:
Ben Reedy 2020-12-02 15:10:49 +10:00 committed by Ben Reedy
parent e8ffeaa0d7
commit 433e00a20b
3 changed files with 16 additions and 2 deletions

View File

@ -66,6 +66,9 @@
# TYPE process_start_time_seconds gauge # TYPE process_start_time_seconds gauge
# HELP process_virtual_memory_bytes Virtual memory size in bytes. # HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge # TYPE process_virtual_memory_bytes gauge
# HELP test_alpha_total Some random metric.
# TYPE test_alpha_total counter
test_alpha_total 42
# HELP windows_cpu_clock_interrupts_total Total number of received and serviced clock tick interrupts # HELP windows_cpu_clock_interrupts_total Total number of received and serviced clock tick interrupts
# TYPE windows_cpu_clock_interrupts_total counter # TYPE windows_cpu_clock_interrupts_total counter
# HELP windows_cpu_core_frequency_mhz Core frequency in megahertz # HELP windows_cpu_core_frequency_mhz Core frequency in megahertz
@ -214,6 +217,8 @@ windows_exporter_collector_timeout{collector="textfile"} 0
# TYPE windows_system_system_up_time gauge # TYPE windows_system_system_up_time gauge
# HELP windows_system_threads Current number of threads (WMI source: PerfOS_System.Threads) # HELP windows_system_threads Current number of threads (WMI source: PerfOS_System.Threads)
# TYPE windows_system_threads gauge # TYPE windows_system_threads gauge
# HELP windows_textfile_mtime_seconds Unixtime mtime of textfiles successfully read.
# TYPE windows_textfile_mtime_seconds gauge
# HELP windows_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise # HELP windows_textfile_scrape_error 1 if there was an error opening or reading a file, 0 otherwise
# TYPE windows_textfile_scrape_error gauge # TYPE windows_textfile_scrape_error gauge
windows_textfile_scrape_error 0 windows_textfile_scrape_error 0

4
tools/e2e-textfile.prom Normal file
View File

@ -0,0 +1,4 @@
# HELP test_alpha_total Some random metric.
# TYPE test_alpha_total counter
test_alpha_total 42

View File

@ -12,15 +12,20 @@ Push-Location $working_dir
$temp_dir = Join-Path $env:TEMP $(New-Guid) | ForEach-Object { mkdir $_ } $temp_dir = Join-Path $env:TEMP $(New-Guid) | ForEach-Object { mkdir $_ }
# Create temporary directory for textfile collector
$textfile_dir = "$($temp_dir)/textfile"
mkdir $textfile_dir | Out-Null
Copy-Item 'e2e-textfile.prom' -Destination "$($textfile_dir)/e2e-textfile.prom"
# Omit dynamic collector information that will change after each run # Omit dynamic collector information that will change after each run
$skip_re = "^(go_|windows_exporter_build_info|windows_exporter_collector_duration_seconds|windows_exporter_perflib_snapshot_duration_seconds|process_|windows_textfile_mtime_seconds|windows_cpu|windows_cs|windows_logical_disk|windows_net|windows_os|windows_service|windows_system)" $skip_re = "^(go_|windows_exporter_build_info|windows_exporter_collector_duration_seconds|windows_exporter_perflib_snapshot_duration_seconds|process_|windows_textfile_mtime_seconds|windows_cpu|windows_cs|windows_logical_disk|windows_net|windows_os|windows_service|windows_system|windows_textfile_mtime_seconds)"
# Start process in background, awaiting HTTP requests. # Start process in background, awaiting HTTP requests.
# Use default collectors, port and address: http://localhost:9182/metrics # Use default collectors, port and address: http://localhost:9182/metrics
$exporter_proc = Start-Process ` $exporter_proc = Start-Process `
-PassThru ` -PassThru `
-FilePath .\windows_exporter.exe ` -FilePath .\windows_exporter.exe `
-ArgumentList '--log.level=debug' ` -ArgumentList "--log.level=debug --collector.textfile.directory=$($textfile_dir)" `
-WindowStyle Hidden ` -WindowStyle Hidden `
-RedirectStandardOutput "$($temp_dir)/windows_exporter.log" ` -RedirectStandardOutput "$($temp_dir)/windows_exporter.log" `
-RedirectStandardError "$($temp_dir)/windows_exporter_error.log" -RedirectStandardError "$($temp_dir)/windows_exporter_error.log"