t28-live-readonly.ps1 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. $ErrorActionPreference = 'Stop'
  2. $base = 'http://192.168.110.96:8301/api/cockpit/v1'
  3. $results = @()
  4. foreach ($endpoint in @('map-snapshot?pageSize=1000', 'monitoring/overview', 'monitoring/distribution?pageSize=1000')) {
  5. try {
  6. $response = Invoke-WebRequest -Uri "$base/$endpoint" -UseBasicParsing -TimeoutSec 25
  7. $body = $response.Content | ConvertFrom-Json
  8. $data = $body.data
  9. $emptyBucket = @($data.pointStatusDistribution | Where-Object { $_.status -eq 'EMPTY' })
  10. $results += [pscustomobject]@{
  11. endpoint = $endpoint
  12. httpStatus = [int]$response.StatusCode
  13. businessCode = $body.code
  14. monitoringPointCount = $data.counts.monitoringPointCount
  15. pagePointCount = if ($null -eq $data.monitoringPoints) { $null } else { @($data.monitoringPoints).Count }
  16. pagePointCodes = if ($null -eq $data.monitoringPoints) { @() } else { @($data.monitoringPoints | ForEach-Object { $_.pointCode }) }
  17. total = $data.pagination.total
  18. hasMore = $data.pagination.hasMore
  19. emptyCount = if ($emptyBucket.Count -eq 1) { $emptyBucket[0].count } else { $null }
  20. excluded = $data.excluded
  21. freshness = $data.freshness
  22. unrenderablePagePoints = @($data.monitoringPoints | Where-Object { $_.coordinateValidation.renderable -eq $false }).Count
  23. unassociatedPageCount = if ($null -eq $data.unassociatedEquipment) { $null } else { @($data.unassociatedEquipment).Count }
  24. }
  25. } catch {
  26. $results += [pscustomobject]@{ endpoint = $endpoint; error = $_.Exception.Message }
  27. }
  28. }
  29. $output = [pscustomobject]@{
  30. observedAt = (Get-Date -Format o)
  31. baseUrl = $base
  32. method = 'GET only; no authentication, restart or mutation'
  33. results = $results
  34. }
  35. $artifact = Join-Path $PSScriptRoot 'artifacts/t28/live-readonly-verification.json'
  36. New-Item -ItemType Directory -Force -Path (Split-Path $artifact) | Out-Null
  37. $output | ConvertTo-Json -Depth 12 | Set-Content -LiteralPath $artifact -Encoding utf8
  38. $output | ConvertTo-Json -Depth 12