Difference between revisions of "Pushgateway windows"
Jump to navigation
Jump to search
Line 6: | Line 6: | ||
$cred = Get-Credential | $cred = Get-Credential | ||
$r=(invoke-webrequest http://localhost:9182/metrics) | $r=(invoke-webrequest http://localhost:9182/metrics) | ||
− | |||
− | |||
$metrics = ($r.content.tostring()) | $metrics = ($r.content.tostring()) | ||
Invoke-WebRequest -uri https://pushgateway.example.com/metrics/job/windows-node/instance/winhost -cred $cred -Body $metrics -Method Post | Invoke-WebRequest -uri https://pushgateway.example.com/metrics/job/windows-node/instance/winhost -cred $cred -Body $metrics -Method Post |
Revision as of 01:18, 12 January 2024
Windows
Not working
$ErrorActionPreference = "Stop" $cred = Get-Credential $r=(invoke-webrequest http://localhost:9182/metrics) $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