REST API Monitoring Examples
Customers can follow these procedures to obtain detailed statistics, including the popular request for tunnel metrics such as loss, latency, and jitter, as well as interface and flow statistics.
As a best practice, it is essential to retrieve statistics directly from the appliances. Accessing the appliances is important because you will need to log in, request the minute statistics, and then log out to terminate the session. This procedure is necessary for all appliances.
It is recommended to create a single user account with a password and use this account across all appliances. This approach simplifies the process of requesting statistics, especially when using scripts for automation.
Additionally, configuring loopback interfaces on the appliances is advisable. Methods like loopback orchestration can assist in configuring multiple appliances using the Orchestrator, thereby avoiding the need for manual configuration of loopback adapters.
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
unzip
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
Specific to 9.3, the Statistics ZIP file content contains the following:
- tunnel.csv, tunnel_peak.csv, tunnel_v2.txt
- interface.csv, interface_peak.csv, interface_v2.txt
- flow.csv, flow_peak.csv, flow_v2.txt
- dscp.csv, dscp_peak.csv, dscp_v2.txt
- tclass.csv, tclass_peak.csv, tclass_v2.txt
- shaper.csv, shaper_v2.txt
- jitter.csv, mos.csv
- zone_pair.csv, zone_pair_v2.txt
- boost.csv, boost_v2.txt
- drops.csv, drops_v2.txt
- drc.csv
- ftype.csv, ftype_peak.csv, ftype_v2.txt
- interface_overlay.csv, interface_overlay_v2.txt
- health_v2.txt
- tunnel_availability_v2.txt
- interface_availability_v2.txt
- appliance_reachability_v2.txt
- probe.csv, probe_v2.txt
- inet_bkout.csv, inet_bkout_v2.txt
- appperf.csv, appperf_v2.txt
These files are in two different formats:
The two formats are .csv and _v2.txt files is the new format optimized for new StatsCollector. Customers are also recommended to use this file format.
Updated about 1 month ago