This documentation relates to QuickBuild 5.0.x
Select here if you are using a different version

Interact with Grid Measurements

You are viewing an old version (v. 1) of this page.
The latest version is v. 9, last edited on Feb 27, 2013 (view differences | )
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
  • source - QUERY_PARAM
    Specify the node you want to query. If not specifed, then all nodes will be used.
  • period - QUERY_PARAM
    Specify the time range you want to query. by default, period is LAST_HOUR, this param can be one of: LAST_HOUR, LAST_2_HOURS, LAST_4_HOURS, LAST_DAY, LAST_WEEK, LAST_MONTH
  • start_time - QUERY_PARAM
    Specify the start time you want to query. If not specified, then an hour ago of to_date will be used.
  • end_time - QUERY_PARAM
    Specify the end time you want to query. If not specified, then current time will be used.
  • metric - QUERY_PARAM
    Specify the metric name you want to query. See below section for all available metric names
  • date_pattern - QUERY_PARAM
    Specify the date pattern you are using for from_date and to_date. By default, ISO 8601 is used.

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 milli-seconds in Java time, you can simply create your own Date instance by new Date(timestamp)

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.