GuidesGitHubAirheads Developer CommunityLog In

REST API Monitoring Examples

Customers can use these procedures to obtain detailed statistics, including the popular request for Tunnels (loss, latency, jitter and so on), interface and flow statistics.


Note: The process for retrieving CPU and memory stats for each EdgeConnect follows a different process and is not file-based.

Getting Statistics Time Range

Appliances generate statistics every minute. Each minute, appliances generate statistics of different types in different CSV files. These CSV files are zipped into a single file for convenience. Appliances are also configured to keep only a certain number of these files. Appliances also retain statistics for a specified time period only. The polling systems (Orchestrator or third-party systems) must get their data before these files age out. Most appliances are configured to keep this data for at least a few
hours. You can configure the length of time appliances keep data in the Orchestrator.

A poller calls the following REST API to get a range of timestamps for which data is present on the appliance:

GET /rest/json/stats/minuteRange

This will return the following output:

{ "newest": "1649778540", "oldest": "1649691900" }

These two numbers are minute boundaries expressed in standard epoch seconds. This example indicates Tuesday, April 12, 2022, 3:49:00 PM to Monday, April 11, 2022, 3:45:00 PM.

Polling for a Specific Minute

Once you obtain the time range, you can iterate over every minute (or start from the last minute not yet retrieved). For example:

for (int i=1649691900; i<=1649778540; i+60) {
 retrieve zip file
 insert stats into your database

The API for retrieving a zip file for a specific minute looks like this:

GET /rest/json/stats/minuteStats/st2-1649691900.tgz

All the file names start with st2- and are followed by a minute timestamp in epoch seconds. The file extension is .tgz

What’s Next