Pushgateway windows

From UVOO Tech Wiki
Revision as of 01:17, 12 January 2024 by Busk (talk | contribs)
Jump to navigation Jump to search

Windows

Not working

$ErrorActionPreference = "Stop"
$cred = Get-Credential
$r=(invoke-webrequest http://localhost:9182/metrics)
# filter is not working properly
# $metrics = ($r.content.tostring() -split "[`r`n]" | select-string -pattern "go_|http_request|http_requests|http_response|process" -NotMatch)
$metrics = ($r.content.tostring())
Invoke-WebRequest -uri https://pushgateway.example.com/metrics/job/windows-node/instance/winhost -cred $cred -Body $metrics -Method Post

No working

$ErrorActionPreference = "Stop"
$r=(invoke-webrequest http://localhost:9182/metrics)
# $metrics = ($r.tostring() -split "[`r`n]" | select-string -pattern "go_|http_request|http_requests|http_response|process" -NotMatch)
$metrics = ($r.content.tostring() -split "[`r`n]" | select-string -pattern "go_|http_request|http_requests|http_response|process" -NotMatch)
# $metrics = ($metrics -replace '(?m)^\s*?\n'| out-string )
$metrics = ($metrics -replace '(?m)^\s*?\n')
# echo $metrics | more
# $metrics = ($r.tostring())
Invoke-WebRequest -uri https://example.uvoo.io/metrics/job/windows-nodes/instance/winhost -cred $cred -Body $metrics -Method Post