Statistics Services

The “Get Statistics” API retrieves network statistics for a currently running test. Results can be retrieved from the beginning of the test or for some specific time period depending on the start and end parameters.

To get the current time of the emulator, see Get Emulator Date and Time. Use the returned dateAsLong property as a start or end time in a “Get Statistics” call. The start point of the required time period is defined with the “anchor” parameter and end point is defined with the “endanchor” parameter – see examples below.

To get the different result sets, call "Get Statistics" with the start and end parameters set accordingly. To get:

  • All statistics of the currently running test: Do not define start or end parameters.
  • Statistics from a defined start point to the current time: Define only the start parameter.
  • Statistics from the beginning of the test until the defined end point: Define only the end parameter.
  • Statistics for only a defined time period: Define both the start and end parameters.

You can retrieve statistics in these two formats:

Note: It is recommended that you narrow your request with a specific flow, shape and/or anchor(s) from "Get Statistics", rather than running for all statistics. With no filtering criteria, the response may include a large amount of data.

Shape Statistics

Contains the statistics per shape.

By default the statistics of all the shapes are returned. To request the statistics for specific shapes, pass a list of the relevant shape IDs.

Request

JSON

Gets ’By Shape’ Statistics for all shapes. The anchor defines the time stamp from which to get the statistics, endanchor defines the last timestamp to be retrieved.

URL http://ip:port/shunra/api/statistics/byshape/{testToken}?anchor={anchor}&endanchor={endanchor}
HTTP Method PUT
HTTP Headers

Content-Type: application/json

Accept: application/json

Authorization: See Web Services Authentication.

Body None

Gets ’By Shape’ Statistics for specific shapes.

URL http://ip:port/shunra/api/statistics/byshape/{testToken}?anchor={anchor}
HTTP Method PUT
HTTP Headers

Content-Type: application/xml

Accept: application/xml

Authorization: See Web Services Authentication.

Body
{
    ["ID_CLIENT_GW_NIC_1","ID_SERVER_GW_NIC_2"]	
}

 

Response

The response header contains the X-Shunra-Next anchor which provides the last time stamp for the current statistics data. You can use X-Shunra-Next for future requests to collect statistics data from this time stamp forward in a "Get Statistics" request.

HTTP Response Code 200 - OK
HTTP Headers

Content-Type: application/json

X-Shunra-Next: 1336025450197

HTTP Body
{
    statistics: [{
        "timeStamp": 1361463351807,
        "nics": [{
            "id": "ID_CLIENT_GW_NIC_1_FLOWS_2",
            "bpsIn": 480,
            "bpsOut": 480,
            "totalIn": 360,
            "totalOut": 360,
            "bwUtilIn": 0,
            "bwUtilOut": 0
        }, {
            "id": "ID_SERVER_GW_NIC_2_FLOWS_2",
            "bpsIn": 480,
            "bpsOut": 480,
            "totalIn": 360,
            "totalOut": 360,
            "bwUtilIn": 0,
            "bwUtilOut": 0
        }],
        "clouds": [{
            "id": "ID_WAN_CLOUD_FLOWS_1",
            "minLatency": 500,
            "avgLatency": 500,
            "maxLatency": 500,
            "packetLossCount": 0,
            "packetLossPercent": 0,
            "packetLossTotal": 0
        }, {
            "id": "ID_WAN_CLOUD_FLOWS_2",
            "minLatency": 200,
            "avgLatency": 200,
            "maxLatency": 200,
            "packetLossCount": 0,
            "packetLossPercent": 0,
            "packetLossTotal": 0
        }],
        "packetLists": [{
            "id": "ID_CLIENT_PL_FLOWS_2",
            "currentMemory": 17203,
            "totalMemory": 104857600,
            "enabled": true
        }, {
            "id": "ID_SERVER_PL_FLOWS_2",
            "currentMemory": 17203,
            "totalMemory": 104857600,
            "enabled": true
        }]
    }, {
        "timeStamp": 1361463352814,
        "nics": [
            {
            "id": "ID_CLIENT_GW_NIC_1_FLOWS_2",
            "bpsIn": 480,
            "bpsOut": 480,
            "totalIn": 360,
            "totalOut": 360,
            "bwUtilIn": 0,
            "bwUtilOut": 0
        }, {
            "id": "ID_SERVER_GW_NIC_2_FLOWS_2",
            "bpsIn": 480,
            "bpsOut": 480,
            "totalIn": 360,
            "totalOut": 360,
            "bwUtilIn": 0,
            "bwUtilOut": 0
        }
        ],
        "clouds": [{
            "id": "ID_WAN_CLOUD_FLOWS_1",
            "minLatency": 500,
            "avgLatency": 500,
            "maxLatency": 500,
            "packetLossCount": 0,
            "packetLossPercent": 0,
            "packetLossTotal": 0
        }, {
            "id": "ID_WAN_CLOUD_FLOWS_2",
            "minLatency": 200,
            "avgLatency": 200,
            "maxLatency": 200,
            "packetLossCount": 0,
            "packetLossPercent": 0,
            "packetLossTotal": 0
        }],
        "packetLists": [{
            "id": "ID_CLIENT_PL_FLOWS_2",
            "currentMemory": 17203,
            "totalMemory": 104857600,
            "enabled": true
        }, {
            "id": "ID_SERVER_PL_FLOWS_2",
            "currentMemory": 17203,
            "totalMemory": 104857600,
            "enabled": true
        }]
    }]
}

 

Flow Statistics

This API is only available for flow-based topologies.

By default the statistics of all the flows are returned. To request the statistics for specific flows, pass a list of the relevant flow IDs.

Request

JSON

Gets ’By Flow’ Statistics for all flows. The anchor defines the time stamp from which to get the statistics, endanchor defines the last timestamp to be retrieved.

URL http://ip:port/shunra/api/statistics/byflow/{testToken}?anchor={anchor}&?endanchor={endanchor}
HTTP Method PUT
HTTP Headers

Content-Type: application/json

Accept: application/json

Authorization: See Web Services Authentication.

Body None

Gets ’By Flow’ Statistics for specific flows IDs. The anchor defines the time stamp from which to get the statistics.

URL http://ip:port/shunra/api/statistics/byflow/{testToken}?anchor={anchor}&{endanchor}
HTTP Method PUT
HTTP Headers

Content-Type: application/json

Accept: application/json

Authorization: See Web Services Authentication.

Body
{
    ["flow_id1","flow_id1"]
}

 

Response

The response header contains the X-Shunra-Next anchor which provides the last time stamp for the current statistics data; the X-Shunra-Next can be used for future requests to collect statistics data from this time stamp forward.

HTTP Response Code 200 - OK
HTTP Headers

Content-Type: application/json; charset=UTF-8

X-Shunra-Next: 1336025450197

HTTP Body
{
    statistics: [{
        "timeStamp": 1361528862628,
        "flowStats": [{
            "id": "FLOWS_1",
            "clientDownStats": {
                "bps": 480,
                "total": 300,
                "bwUtil": 0
            },
            "clientUpStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "serverDownStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "serverUpStats": {
                "bps": 480,
                "total": 300,
                "bwUtil": 0
            },
            "cloudStats": {
                "avgLatency": 500,
                "packetLossCount": 0,
                "packetLossPercent": 0,
                "packetLossTotal": 0
            }
        }, {
            "id": "FLOWS_2",
            "clientDownStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "clientUpStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "serverDownStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "serverUpStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "cloudStats": {
                "avgLatency": 200,
                "packetLossCount": 0,
                "packetLossPercent": 0,
                "packetLossTotal": 0
            }
        }]
    }, {
        "timeStamp": 1361528865348,
            "flowStats": [{
            "id": "FLOWS_1",
            "clientDownStats": {
                "bps": 480,
                "total": 300,
                "bwUtil": 0
            },
            "clientUpStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "serverDownStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "serverUpStats": {
                "bps": 480,
                "total": 300,
                "bwUtil": 0
            },
            "cloudStats": {
                "avgLatency": 500,
                "packetLossCount": 0,
                "packetLossPercent": 0,
                "packetLossTotal": 0
            }
        }, {
            "id": "FLOWS_2",
            "clientDownStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "clientUpStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "serverDownStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "serverUpStats": {
                "bps": 480,
                "total": 360,
                "bwUtil": 0
            },
            "cloudStats": {
                "avgLatency": 200,
                "packetLossCount": 0,
                "packetLossPercent": 0,
                "packetLossTotal": 0
            }
        }]
    }]
}