VMware Cloud Community
smuribi
Contributor
Contributor
Jump to solution

Too many data points returned from vrops REST API

After grabbing a token, I hit this url:

 

https://vrops/suite-api/api/resources/stats?resourceId=6787c712-0881-47d2-a46b-8d21ef2bc5c8&statKey=... of all instances|totalWriteLatency_average

 

which returens hundreds of values (i've abreviated the results below.    

 

Which converting to epoch time, the first date is Sat Sep  8 03:39:59 CDT 50057 and the last date in the series is Mon Jun  7 06:39:41 CDT 50060.

 

Any idea how I would just get one value, the current value?  From the doc, I’ve tried adding &rollUpType=LATEST&intervalType=MINUTES but still getting a large time series (and nothing close to the current timestamp?)

 

{

    "values": [

        {

            "resourceId": "6787c712-0881-47d2-a46b-8d21ef2bc5c8",

            "stat-list": {

                "stat": [

                    {

                        "timestamps": [

                            1517501429630,

                            1517501729620,

                            1517502029637,

......

                        ],

                        "statKey": {

                            "key": "datastore:Aggregate of all instances|totalWriteLatency_average"

                        },

                        "intervalUnit": {

                            "quantifier": 1

                        },

                        "data": [

                            0.800000011920929,

                            0.3333333432674408,

                            0.6000000238418579,

........

1 Solution

Accepted Solutions
carvaled
Enthusiast
Enthusiast
Jump to solution

try using:

GET /api/resources/stats/latest

Gets Latest stats of one or more Resources using the query spec that is specified.
Takes the form:

api/resources/stats/latest?resourceId=UUID1&resourceId=UUID2 OR
api/resources/stats/latest?resourceId=UUID2&statKey=cpu|usagemhz&statKey=cpu|demandmhz

also have a look at my script, maybe it can help you get the metrics your after with a little modification http://vman.ch/vrops-suite-api-stats-on-steroids/

View solution in original post

0 Kudos
2 Replies
carvaled
Enthusiast
Enthusiast
Jump to solution

try using:

GET /api/resources/stats/latest

Gets Latest stats of one or more Resources using the query spec that is specified.
Takes the form:

api/resources/stats/latest?resourceId=UUID1&resourceId=UUID2 OR
api/resources/stats/latest?resourceId=UUID2&statKey=cpu|usagemhz&statKey=cpu|demandmhz

also have a look at my script, maybe it can help you get the metrics your after with a little modification http://vman.ch/vrops-suite-api-stats-on-steroids/

0 Kudos
smuribi
Contributor
Contributor
Jump to solution

Thanks. I think i found it on your blog and that works.