Hi,
I'm trying SCOM Retrieve Performance Data Rest API but I'm unable to pass performance counters as it's unclear in their official documentation.
https://learn.microsoft.com/en-us/rest/api/operationsmanager/data/retrieve%20performance%20data
Example :-
## Get performances for the given server
$myObject = [PSCustomObject]@{
objectname = 'Memory'
countername = 'Available MBytes'
}
$uriPerf = "http://$MS/OperationsManager/data/performance"
$perfFilter = @"
{
"duration": 100,
"id": "103c21b9-1dd1-e6ff-ede8-1091e0111abc",
"peformanceCounters":[$myObject]
}"@
$PerfResponse = Invoke-WebRequest `
-Method POST `
-Uri $uriPerf `
-Body $perfFilter `
-Headers $scomHeaders `
-Credential $cred `
-WebSession $websession `
#-AllowUnencryptedAuthentication
$perf = ConvertFrom-Json -InputObject $PerfResponse.Content
Write-Host "Timestamp after get all get performance data for $($server.id) call $(Get-Date)"
Write-Host "----------------"
This is the error I'm getting
Invoke-WebRequest : {"errorMessage":"Passed parameter cannot be null","errorTrace":""}