3. Graph Data Request API
What This Chapter Does
It queries metric data. This is the core of the guide, and the values used in the graphs on the console screen can be received exactly as they are.
How the Request Address Is Built
The address is a matter of writing what, from which target, and how to aggregate into the path in turn.
Writing several columns receives several metrics in one request. It reduces the number of
requests when drawing several graphs on one screen.
The query period and interval are given as query parameters. They appear in the request examples of each section.
Below are the queries used most often, organized by purpose. Look up only the one you need.
Requesting Statistics for an Application Group
These are the values seen with the whole group treated as one. When a group has several
instances, the values come combined by the aggregate function -- with mean, for example, it is the
average across the instances.
To see them broken down by instance, use Requesting Statistics for an Instance in the next section.
The following is the request format common to every metric query. Actual query examples are organized by purpose later in this chapter, so learn the format here and look up the example you need.
| Item | Value |
|---|---|
| URL | /monitoring/api/metrics/apps/{appName}/{ns}/{name}/{columns}/{aggregate} |
| HTTP METHOD | GET |
| Content-Type | application/json |
Path parameters
| Position | Description |
|---|---|
{appName} | The application group name (obtained in chapter 2) |
{ns} | The metric namespace |
{name} | The metric name |
{columns} | The column names to receive. Separate with : to request several at once |
{aggregate} | The aggregate function -- mean, sum, max, min. Separate with : and give as many as there are columns; giving only one applies the same function to every column |
Query parameters
| Name | Default | Description |
|---|---|---|
start | Required | The query start time. Unix epoch milliseconds (from 1970-01-01 00:00:00 UTC) |
end | Required | The query end time. Same format |
interval | — | The data interval (milliseconds). 5000 (5 seconds) is usual |
fill | — | Fills gaps with no value with null |
merge | — | Merges several values into one series |
persec | — | Calculates per second rather than per interval. Use only for metrics counted per second, such as TPS (dashboard only) |
history | false | Use when the data is history data |
clientTime | false | The default is server time. Set it to true to use the times written in the request as they are |
downGrade | false | Set it to true to pull from raw data rather than statistics data |
exclusion | true | Looks for the group in the list with hidden agents removed. If every agent in the group is hidden or stopped, that group disappears from the list and the query fails -- set it to false in that case |
When the server cannot find the group given in {appName}, HTTP 500 comes back. Besides a typo
in the name, the group being dropped from the list because of the exclusion default (true) is
common -- that happens when every agent in the group is hidden or stopped.
Check whether the name exists first with GET /monitoring/api/metrics/APP?exclusion=true, and if it
does not, add &exclusion=false to the query request.
Requesting Statistics for an Instance
These are the values for a single instance. Apart from the host IP and instance name added to the address, it is the same as above.
Putting * in {ipAddr} and {instanceId} means every target, and the results come back split
by instance in one response. To choose several targets, join them with : -- for example,
192.168.0.1:192.168.0.2.
| Item | Value |
|---|---|
| URL | /monitoring/api/metrics/graphs/{ipAddr}/{agentType}/{instanceId}/{ns}/{name}/{columns}/{aggregate} |
| HTTP METHOD | GET |
| Content-Type | application/json |
Path parameters
| Position | Description |
|---|---|
{ipAddr} | The target server IP. Several can be written, separated with : |
{agentType} | The agent type -- WAS (a WAS instance), WEB (a web server), SYS (a system) |
{instanceId} | The instance ID. Several can be written, separated with : |
{ns} | The metric namespace |
{name} | The metric name |
{columns} | The column names to receive. Separate with : to request several at once |
{aggregate} | The aggregate function -- mean, sum, max, min. Separate with : and give as many as there are columns; giving only one applies the same function to every column |
Query parameters
| Name | Default | Description |
|---|---|---|
start | Required | The query start time. Unix epoch milliseconds (from 1970-01-01 00:00:00 UTC) |
end | Required | The query end time. Same format |
interval | — | The data interval (milliseconds). 5000 (5 seconds) is usual |
fill | — | Fills gaps with no value with null |
merge | — | Merges several values into one series |
persec | — | Calculates per second rather than per interval. Use only for metrics counted per second, such as TPS (dashboard only) |
history | false | Use when the data is history data |
clientTime | false | The default is server time. Set it to true to use the times written in the request as they are |
downGrade | false | Set it to true to pull from raw data rather than statistics data |
Statistics Response
| Key | |
|---|---|
| Response Body | The content of the response JSON string is as follows. |
| Statistics | [{"name":"*___*___*___*___apdex___maxRT:avgRT:minRT:count","start":1493457870000,"end":1493457880000,"interval":"5s","columns":["time","maxRT","avgRT","minRT","count"],"points":[[1493457870000,1493457875000],[7877.0,5752.0],[4436.5,2851.667],[0.0,0.0],[7.0,5.0]]}] |
- Explanation of the JSON data items
[
{
"name": "*___*___*___*___apdex___maxRT:avgRT:minRT:count", ← the name
"start": 1493457870000, ← the start time (milliseconds)
"end": 1493457880000, ← the end time (milliseconds)
"interval": "5s", ← the data interval
"columns": [ ← the data column names
"time",
"maxRT",
"avgRT",
"minRT",
"count"
],
"points": [ ← the data items
[ ← time column data (milliseconds)
1493457870000,
1493457875000
],
[ ← first column, maxRT data
7877,
5752
],
[ ← second column, avgRT data
4436.5,
2851.667
],
[ ← third column, minRT data
0,
0
],
[ ← fourth column, count data
7,
5
]
]
}
]
Average Response Time and Call Count per Application Group
This is the first value to look at when a report of slowness comes in. The maximum (maxRT),
average (avgRT), and minimum (minRT) response times and the call count (count) are received
together in one request.
All four have to be read together to narrow the cause. If the average is unchanged but only the maximum spikes, only some requests are slow (a particular screen or a particular query condition); if the average rises too, the whole thing has slowed. If the call count rose with it, it is load; if the call count is unchanged and it is still slow, look at the application or the systems it calls.