Fetching Metrics

Metrics can be fetched for an entity based using this API. Metrics schema APIs give the available metrics and their intervals for an entity type.

Retrieve Metrics Schema for an Entity Type

Prerequisite
Verify that you have the entity type for which metrics are required.
Procedure
  1. To determine the metrics info for an entity type, make a GET request with the entity type of the application as a path parameter. In the following sample request, metrics info for a FLOW entity type is retrieved.
Request GET https://operations-for-networks.example.com/api/ni/schema/Flow/metrics Response body: { "results": [ { "metric": "flow.dstBytes.delta.summation.bytes", "display_name": "Destination Bytes", "intervals": [ 1800, 7200, 28800 ], "description": "Total bytes sent by the server to client", "unit": "NoUnit" }, { "metric": "flow.srcBytes.delta.summation.bytes", "display_name": "Source Bytes", "intervals": [ 1800, 7200, 28800 ], "description": "Total bytes sent by the client to server", "unit": "NoUnit" }, { "metric": "flow.totalBytes.delta.summation.bytes", "display_name": "Bytes", "intervals": [ 1800, 7200, 28800 ], "description": "Total bytes transferred in both directions", "unit": "NoUnit" }, { "metric": "flow.totalBytesRate.rate.average.bitsPerSecond", "display_name": "Bytes Rate", "intervals": [ 1800, 7200, 28800 ], "description": "Average Bits/sec rate of total traffic in both directions", "unit": "NoUnit" }, { "metric": "flow.totalPackets.delta.summation.number", "display_name": "Packets", "intervals": [ 1800, 7200, 28800 ], "description": "Total packets transferred in both directions", "unit": "NoUnit" }, { "metric": "flow.allowedSessionCount.delta.summation.number", "display_name": "Session Count", "intervals": [ 1800, 7200, 28800 ], "description": "Total number of allowed sessions", "unit": "NoUnit" } ] }

Retrieve Metrics Points for an Entity

Prerequisite
Verify that you have the entity id, metrics name, interval, start, and end time.
Procedure
  1. To fetch metrics points for an entity id and metric for a given time interval , make a GET request as shown in the following example . Maximum number of metrics point returned by API is 300 and a 400 response is returned in case the interval and time period combination have more than 300 metrics points. The client can break the time period to multiple batches to get all the metrics points.
Request GET https://operations-for-networks.example.com/api/ni/metrics?entity_id=12347:515:1787493997 &metric=flow.srcBytes.delta.summation.bytes&interval=1800&start=1523351589&end=1523437989 Response body: { "metric": "flow.srcBytes.delta.summation.bytes", "display_name": "Source Bytes", "interval": 1800, "unit": "NoUnit", "pointlist": [ [ 1523352600, 7141 ], [ 1523354400, 6898 ], [ 1523356200, 7370 ], [ 1523358000, 6898 ] ], "start": 1523351589, "end": 1523437989 }