Difference between revisions of "Pushgateway windows"

From UVOO Tech Wiki
Jump to navigation Jump to search
(Created page with "# Windows ## Not working ``` $cred = Get-Credential $r=(invoke-webrequest http://localhost:9182/metrics).content; $r.tostring() -split "[`r`n]" | select-string -pattern "go_|...")
 
Line 3: Line 3:
 
## Not working
 
## Not working
 
```
 
```
 +
$ErrorActionPreference = "Stop"
 
$cred = Get-Credential
 
$cred = Get-Credential
$r=(invoke-webrequest http://localhost:9182/metrics).content; $r.tostring() -split "[`r`n]" | select-string -pattern "go_|http_request|http_requests|http_response|process" -NotMatch | ConvertTo-Json | Invoke-WebRequest -Method POST -Uri https://pushgateway.example/metrics/job/windowsnode/instance/foo -cred $cred -ContentType 'application/json'
+
$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
 
```
 
```

Revision as of 01:08, 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