Difference between revisions of "Pushgateway windows"
Jump to navigation
Jump to search
Line 10: | Line 10: | ||
$metrics = ($r.tostring()) | $metrics = ($r.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 | ||
+ | ``` | ||
+ | |||
+ | 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 | ||
``` | ``` |
Revision as of 01:16, 12 January 2024
Windows
Not working
$ErrorActionPreference = "Stop" $cred = Get-Credential $r=(invoke-webrequest http://localhost:9182/metrics).content # filter is not working properly # $metrics = ($r.tostring() -split "[`r`n]" | select-string -pattern "go_|http_request|http_requests|http_response|process" -NotMatch) $metrics = ($r.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