How to check vetting state from API (PowerShell)

Thx @moby for info
I’m new to Storj and wanted to know vetting state, thanks to people here I made a small powershell, hope it can help (sorry for posting in this old thread :wink: )

$IP = "127.0.0.1" #or remote ip if permitted

$SatellitesListe = ((Invoke-WebRequest ("http://" + $IP + ":14002/api/sno/")).Content | ConvertFrom-Json).satellites

$Res = @()
$Res2 = @()
foreach ($Satellites in $SatellitesListe) {
    $Temp = ((Invoke-WebRequest ("http://" + $IP + ":14002/api/sno/satellite/" + $Satellites.ID)).Content | ConvertFrom-Json).auditHistory.windows | Select-Object @{Name="Satellite";Expression={$Satellites.url}},*
    $Res += $Temp
    $Res2 += New-Object -TypeName PSObject -Property @{
                Satellite = $Satellites.url
                totalCount = ($Temp | Measure-Object totalCount -Sum).Sum 
                onlineCount = ($Temp | Measure-Object onlineCount -Sum).Sum
            }

}

$Res | Select-Object *,@{Name="Good";Expression={if ($_.totalCount -eq $_.onlineCount) {"Good"} else {"Not good"}}} | ft -AutoSize

$Res2 | Select-Object *,@{Name="Good";Expression={if ($_.totalCount -eq $_.onlineCount) {"Good"} else {"Not good"}}} | ft Satellite,totalCount,onlineCount,Good -AutoSize

$Res.Count
1 Like