Workload Statistics
This endpoint returns statistics for a workload.
GET /openapi/v1/workload/{uuid}/stats?t0=<t0>&t1=<t1>&td=<td>
Path Parameter |
Description |
---|---|
uuid |
Agent UUID |
The query URL contains the following parameters
Query Parameter |
Description |
---|---|
t0 |
Start time for statistics in epoch time |
t1 |
End time for statistics in epoch time. The end time cannot exceed the start time by more . than a day. |
td |
Granularity for statistic aggregations. An integer specifies number of seconds. Strings may be passed such as “minute”, “hour”, and “day”. |
Response
The response is a JSON object in the body with the following properties.
Name |
Type |
Description |
---|---|---|
timestamp |
string |
Time at which metrics were gathered (epoch or ISO 8601) |
results |
object |
Metrics |
Metrics is a JSON object with the following properties
Name |
Type |
Description |
---|---|---|
flow_count |
integer |
Number of flows. |
rx_byte_count |
integer |
Number of received bytes. |
rx_packet_count |
integer |
Number of received packets. |
tx_byte_count |
integer |
Number of transmitted bytes. |
tx_packet_count |
integer |
Number of transmitted packets. |
Sample Python code
agent_uuid = 'aa28b304f5c79b2f22d87a5af936f4a8fa555894'
td = 15 * 60 # 15 minutes
resp = restclient.get('/workload/%s/stats?t0=1483228800&t1=1485907200&td=%d' % (agent_uuid, td))
# This code queries workload statistics for a week
t0 = 1483228800
for _ in range(7):
t1 = t0 + 24 * 60 * 60
resp = restclient.get('/workload/%s/stats?t0=%d&t1=%d&td=day' % (agent_uuid, t0, t1))
t0 = t1