mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-26 14:46:35 +00:00
Fix new-collector wmi members initialization
This commit is contained in:
@@ -17,7 +17,7 @@ else {
|
|||||||
$wmiObject = Get-WMIObject -ComputerName $ComputerName -Class $Class
|
$wmiObject = Get-WMIObject -ComputerName $ComputerName -Class $Class
|
||||||
}
|
}
|
||||||
|
|
||||||
$members = $wmiObject `
|
$members = @($wmiObject `
|
||||||
| Get-Member -MemberType Properties `
|
| Get-Member -MemberType Properties `
|
||||||
| Where-Object { $_.Definition -Match '^u?int' -and $_.Name -NotMatch '_' } `
|
| Where-Object { $_.Definition -Match '^u?int' -and $_.Name -NotMatch '_' } `
|
||||||
| Select-Object Name, @{Name="Type";Expression={$_.Definition.Split(" ")[0]}}
|
| Select-Object Name, @{Name="Type";Expression={$_.Definition.Split(" ")[0]}}
|
||||||
@@ -25,7 +25,7 @@ $input = @{
|
|||||||
"Class"=$Class;
|
"Class"=$Class;
|
||||||
"CollectorName"=$CollectorName;
|
"CollectorName"=$CollectorName;
|
||||||
"Members"=$members
|
"Members"=$members
|
||||||
} | ConvertTo-Json
|
} | ConvertTo-Json)
|
||||||
$outFileName = "..\..\collector\$CollectorName.go".ToLower()
|
$outFileName = "..\..\collector\$CollectorName.go".ToLower()
|
||||||
$input | .\collector-generator.exe | Out-File -NoClobber -Encoding UTF8 $outFileName
|
$input | .\collector-generator.exe | Out-File -NoClobber -Encoding UTF8 $outFileName
|
||||||
go fmt $outFileName
|
go fmt $outFileName
|
||||||
|
|||||||
Reference in New Issue
Block a user