get_test_statistics
Retrieves pre-aggregated network test statistics over time so you can analyze trends, averages, percentiles, jitter, and MOS in configurable time buckets.
Instructions
Get pre-aggregated test statistics over time (Legacy API: GET /nb_test_statistics.json). Use this — instead of the raw test result endpoints — when you want trend analysis over a long window: averages, percentiles, variability, jitter, or MOS already bucketed into time windows.
How the response is shaped:
Each row is one (time-window, metric_type) pair for one matched test.
The unit/scale of 'value' depends on metric_type (ms for mean / percentile_mean / stdev / jitter; 1.0–5.0 for mos).
Omitting metric_type returns every type the matched test(s) produce; one row per (window, metric_type).
Scoping the query (combine as needed; all narrow the same set of underlying tests):
nb_test_id — exactly one test instance.
nb_test_template_id — every test instance derived from a template (one per agent).
agent_id — restrict to tests run by this agent.
nb_target_id — restrict to tests against this target.
test_type_id — restrict to a class of tests (Ping/DNS/HTTP/Traceroute/etc.).
Time range (mutually exclusive — pick one):
from + to — explicit interval (epoch ms, epoch seconds, or ISO 8601; normalized to ms).
last — the most recent N data points (no from/to needed).
Aggregation control:
window_size sets the bucket size in seconds (e.g. 60 = 1-minute buckets, 300 = 5-minute, 3600 = 1-hour).
granularity is an alternative aggregation hint accepted by the upstream API; pass either window_size OR granularity, not both.
grouping changes how rows are grouped within the response. Known value: 'nb_test_id' (per-test breakdown — useful when scoped to a template to get one series per agent). Other values are passed through to the API.
Value (watermark) filtering:
value_operator + value_watermark together filter rows by the aggregated 'value' (e.g. value_operator='>' with value_watermark=200 returns only buckets whose aggregated value exceeds 200). Both must be supplied for the filter to apply.
To retrieve jitter or MOS: scope to a test that produces them (a VoIP test, or a Ping test with jitter/MOS enabled) via nb_test_id, nb_test_template_id, or test_type_id, then either set metric_type='jitter' / metric_type='mos', or omit metric_type and pick rows whose metric_type field equals 'jitter' / 'mos'. If the matched test does not produce that metric, no rows are returned for it.
Response: { nb_test_statistics: [{ id, nb_test_id, timestamp, value, metric_type, window_size, datapoint_count, error_count }] }
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_test_statistics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | End of the time range. Accepts Unix epoch ms, Unix epoch seconds, or ISO 8601; the client normalizes to ms. Use together with 'from'. Mutually exclusive with 'last'. | |
| from | No | Start of the time range. Accepts Unix epoch ms, Unix epoch seconds, or ISO 8601; the client normalizes to ms. Use together with 'to'. Mutually exclusive with 'last'. | |
| last | No | Return the most recent N data points. Mutually exclusive with from/to. | |
| sort_by | No | Field to sort the response by (e.g. a column from the row schema such as 'timestamp' or 'value'). Pair with sort_by_order to choose direction. Refer to the NetBeez API docs for the exact list of sortable fields. | |
| agent_id | No | Filter to tests run by this agent. Combinable with the other ID filters as an AND. | |
| grouping | No | Group result rows by the named field. Known value: 'nb_test_id' (per-test breakdown — when scoped to a template, this yields one series per agent running the template). Other values are passed through to the upstream API; refer to the NetBeez API docs for the full list. | |
| ts_order | No | Order rows by timestamp. 'asc' = oldest first, 'desc' = newest first. | |
| nb_test_id | No | Filter by a single test instance ID (one agent + one template). Combinable with the other ID filters as an AND. | |
| granularity | No | Alternative aggregation control accepted by the upstream API; passed through verbatim. Use this OR window_size, not both. Refer to the NetBeez API docs for accepted values. | |
| metric_type | No | Which statistical view or derived metric to retrieve. 'mean' / 'percentile_mean' / 'stdev' are computed from the test's primary measurement (e.g. RTT for Ping, lookup time for DNS, response time for HTTP). 'jitter' and 'mos' are only emitted by tests that produce them (VoIP tests, and Ping tests with the jitter/MOS option enabled). Omit to receive all types available for the matched test(s). Determines the unit/scale of the row's 'value'. | |
| window_size | No | Aggregation bucket size in seconds (e.g. 60 = 1-minute buckets, 300 = 5-minute, 3600 = 1-hour). Pass either window_size OR granularity, not both. | |
| nb_target_id | No | Filter to tests targeting this target (hostname/IP/URL). Combinable with the other ID filters as an AND. | |
| test_type_id | No | Filter by test type ID — restricts to one class of tests (e.g. Ping, DNS, HTTP, Traceroute). The integer mapping is defined by the upstream API. | |
| sort_by_order | No | Sort direction for sort_by. 'asc' = ascending, 'desc' = descending. | |
| value_operator | No | Comparison operator used together with value_watermark to filter rows by their aggregated 'value' (a watermark filter). Conventionally one of '>', '<', '>=', '<=', '='. Has no effect unless value_watermark is also provided. | |
| value_watermark | No | Threshold value compared against each row's aggregated 'value' using value_operator (e.g. value_operator='>' + value_watermark=200 returns only buckets whose value exceeds 200). Has no effect unless value_operator is also provided. Units match the metric_type (e.g. ms for latency-like metrics, MOS scale 1.0–5.0 for 'mos'). | |
| nb_test_template_id | No | Filter to all tests derived from this template (one test per agent assigned to the template). Combinable with the other ID filters as an AND. |