Taryel Kazimov (Customer) asked a question.

WUG API Call to View Custom Powershell Performance Monitor LastPulled Value

Hi Dear Comunity members,

 

I am trying to build Grafana dashboard which pull data from WUG.

For this i planing to use WUG RestApi.

 

Before staring with grafana i am trying pull data from WUG with powershell to see last value in my custom performance monitor and uderstand how return query is looking.

 

I already can connect to WUG API and obtain token.

and with this line of i can see the CPU utilization:

Invoke-RestMethod -Method Get -Uri "http://gold.mydomain.com:9644/api/v1/devices/3823/reports/cpu-utilization?range=today" -Headers $headers | ConvertTo-Json

 

What is the option in this line of code to see the last returned value from custom performance monitor. Value is integer.


  • Mike Rockwell (Progress Software)

    You will need to set the Invoke-RestMethod to a variable which which if you use ConvertFrom-Json instead of the convert to, the return is already in JSON form. Then you can just use the "." (dot) notation to drill down to get the value you want. If it returns more than on item, you may have to loop through the items "foreach (x in Y) { }" Then you would do, for example, $result.data.avgPercent" to return the average Percentage value returned.

    Selected as Best
  • Mike Rockwell (Progress Software)

    You will need to set the Invoke-RestMethod to a variable which which if you use ConvertFrom-Json instead of the convert to, the return is already in JSON form. Then you can just use the "." (dot) notation to drill down to get the value you want. If it returns more than on item, you may have to loop through the items "foreach (x in Y) { }" Then you would do, for example, $result.data.avgPercent" to return the average Percentage value returned.

    Selected as Best