<< View previous version | view page history | view next version >>
Grid measurements can be fetched from REST API.
Support Functions
The base URI for grid measuremetns REST API is:
/rest/measurements
The support functions are:
URI | Description | Params |
---|---|---|
/rest/grid/measurements/help | Get help for all available functions | NO PARAMS |
/rest/grid/measurements/version | Get current version for the measurements related REST API | NO PARAMS |
/rest/grid/measurements | Query for the measurements you want |
|
Below, we'd like to give some examples for how to query the measurements:
With no params
If you call below query, QuickBuild will return all measurements collected from all nodes in the last one hour.
/rest/grid/measurements
Query for a specified node
Below query will return all measurements from myagent:8811 in the last one hour.
/rest/grid/measurements?source=myagent:8811
Query for a specified metric
Below query will return measurements of disk usage for all nodes in the last one hour.
/rest/grid/measurements?metric=disk.usage
Query for a specific time range
Below query returns all measurements for all nodes in the last 2 hours.
/rest/grid/measurements?period=LAST_2_HOURS
Below query returns all measurements for all nodes from time: 2013-02-25T09:47:00+08:00, note by default, you need format your time in ISO8601 format, that is, in pattern: yyyy-MM-dd'T'HH:mm:ss.SSSZ, we will give a custom date pattern in later sample.
/rest/grid/measurements?start_time=2013-02-25T09:47:00.000%2B08:00
Below query returns all measurements for all nodes in a specified time range with a custom date format pattern:
/rest/grid/measurements?start_time=2013/02/25+09:47&end_time=2013/02/27+09:47&date_pattern=yyyy/MM/dd+HH:mm
Example return result
For all query above, below is an example return result:
<list> <com.pmease.quickbuild.model.MeasurementDataR00> <id>350</id> <timestamp>1361854800000</timestamp> <source>Zhenyu-MBP.local:8811</source> <metricName>memory.usage</metricName> <value>0.743398666381836</value> </com.pmease.quickbuild.model.MeasurementDataR00> <com.pmease.quickbuild.model.MeasurementDataR00> <id>335</id> <timestamp>1361854800000</timestamp> <source>Zhenyu-MBP.local:8810</source> <metricName>web.rpc.oneMinuteRate</metricName> <value>10.3903417298681</value> </com.pmease.quickbuild.model.MeasurementDataR00> <com.pmease.quickbuild.model.MeasurementDataR00> <id>334</id> <timestamp>1361854800000</timestamp> <source>Zhenyu-MBP.local:8810</source> <metricName>web.rpc.fiveMinuteRate</metricName> <value>8.90793420070343</value> </com.pmease.quickbuild.model.MeasurementDataR00> </list>
Here, timestamp is the milliseconds in Java time (the time from midnight, January 1, 1970 UTC.), you can simply create your own Date instance by new Date(timestamp) in Java.