Metrics API
Endpoint:
/metrics-api/v1/gatewaysPerformance metrics including CPU, memory, throughput, and packet drops.Scrape interval: Every 5 minutesStatus API
Endpoint:
/status-api/v1/Availability status for gateways, tunnels, and BGP peerings.Scrape interval: Every 1 minuteAuthentication
Both APIs use the same API key, passed as a Bearer token:Enabling the API
To use the Metrics and Status APIs, enable Network Insights API access in CoPilot and generate an authentication key.The Aviatrix API uses port 443, the same port as the CoPilot UI. Ensure that
port 443 is accessible and not restricted by any security groups.
- In CoPilot, navigate to Settings > Configuration > General.
- Scroll down to the Features section.
- Next to Network Insights API, toggle the switch on.
- In the Network Insights API Key dialog that opens, click Generate API Key.
- Copy the displayed key and save it in a secure place.
- Click Close.
Downloading the Specifications
The Metrics API and Status API each ship with an OpenAPI.yaml specification
that documents endpoints, request and response schemas, and examples. Download
the latest versions from CoPilot rather than relying on external copies, as the
specifications are updated with each CoPilot release.
You can download a specification either from the Generate API Key dialog
(see step 4 in Enabling the API) or from the Features
section at any time after the API is enabled:
- In CoPilot, navigate to Settings > Configuration > General.
- Scroll down to the Features section.
- Under Network Insights API, in the API Specifications dropdown, select Metrics API or Status API.
- Click Download.
Testing API Access
Verify access to your CoPilot instance with acurl command:
200 response with metric data confirms the API is working. A 403 response
indicates an incorrect or expired key.
Metrics API
Endpoints
?format=json for structured JSON
output.
How Data Is Collected
CoPilot collects performance data from every managed gateway once per minute via the Aviatrix Controller. The Metrics API serves a snapshot of the most recent collection, rounded to the nearest 5-minute boundary with a 15-minute lookback window. Values represent point-in-time samples, not averages or aggregations.Gateway-Level Metrics
These metrics are reported once per gateway, with agateway label.
cpu_used_per and memory_used_per are available in CoPilot 4.32+. On older
versions, derive CPU utilization as 100 - cpu_idle. For memory percentage on
older versions, you must know the instance type’s total memory from your cloud
provider.Per-vCPU Metrics
On gateways with multiple virtual CPUs, the API reports per-core utilization withgateway and vcpu_name labels.
These metrics are useful for identifying core imbalance, for example one vCPU
pegged at 100% while others are idle, which may indicate a single-threaded
bottleneck.
Interface-Level Metrics
These metrics are reported per gateway and per network interface, withgateway
and interface labels.
Throughput metrics (
rate_sent, rate_received, rate_total) are reported
in bits per second, not bytes. The pps_limit_exceeded and
bandwidth_ingress_limit_exceeded counters are cumulative counts of packets
throttled by the cloud provider’s instance-type network limits (AWS ENA
driver). These counters are only present on AWS instances.Example Prometheus Output
Status API
Endpoints
How Data Is Collected
CoPilot polls gateway, tunnel, and BGP status every minute. The Status API serves the latest cached state with no windowing or aggregation.Gateway Status
Reported asstatus with a gateway label.
- Prometheus
- JSON
Tunnel Status
Includes both gateway-to-gateway peering tunnels and Site-to-Cloud (S2C) tunnels, reported asstatus with a tunnel label.
BGP Peering Status
Reported asbgp_status with gateway and bgp_neighbor labels.
Network Interface Guidance
Each gateway reports interface-level metrics for every network interface on the instance. Understanding which interfaces to monitor is essential for accurate dashboards and alerts.Interfaces to Monitor
Interfaces to Exclude
Why Exclude Tunnel Interfaces?
Traffic ontun-* interfaces is a subset of traffic already counted on the
underlying eth interface. Including both leads to double-counted bandwidth in
dashboards and inflated throughput numbers.
For example, a packet traversing an IPsec tunnel from spoke-gw to transit-gw is
counted once on eth0 (encrypted) and once on tun-abc123 (decrypted). Summing
both overstates actual bandwidth consumption.
Recommended Filter
In Prometheus-based systems, apply a relabel or query filter:Matching CoPilot’s Built-in Alerts
CoPilot ships with three default alert definitions. This section maps each to the equivalent external alert you can configure in your monitoring platform.Global Control Plane Health
CoPilot monitors Controller and CoPilot CPU, memory, and disk health. Any condition true for 15 minutes triggers the alert.Global Network Health
CoPilot monitors all gateways and their network interfaces. Any condition true for 15 minutes triggers the alert.Global Memory Swap Surge
CoPilot monitors all gateways for unexpected swap usage on instances with sufficient RAM. All conditions must be true for 15 minutes.Recommended Alert Configuration
Tier 1 — Critical Alerts
Configure these in every deployment. They cover the most impactful failure conditions.Tier 2 — Operational Alerts
These provide early warning for capacity issues and performance degradation.Tier 3 — CoPilot Webhook Alerts
The following conditions cannot be monitored via the external APIs. Configure these as CoPilot alert definitions with a webhook notification channel that forwards events to your monitoring platform.
To configure a webhook channel in CoPilot, navigate to Notifications > Alert
Configuration > Channels and create a webhook channel pointing to your
monitoring platform’s ingest URL.
Scrape Configuration
- Prometheus
- Datadog
- Generic HTTP (Splunk, Custom)
Data Freshness and Timing
CoPilot’s built-in alert engine evaluates metrics every 60 seconds against a
real-time internal cache. External monitoring introduces a small lag:
- Status alerts (gateway/tunnel/BGP down): Expect approximately 1-2 minutes of lag compared to CoPilot’s built-in alerting.
- Performance alerts (CPU, memory, drops): Expect approximately 5-10 minutes of lag due to the Metrics API’s 5-minute caching window.
CoPilot Performance Page vs. Metrics API
Values shown on CoPilot’s Monitor > Performance page may not exactly match Metrics API output. This is expected — the two serve different purposes.
Aggregation is the primary cause of differences. The Performance page displays
the average of all 1-minute samples within each time bucket. The Metrics API
returns a single raw sample. Dashboards built from the Metrics API will appear
noisier than CoPilot’s Performance charts. Your external monitoring platform
should apply its own aggregation and smoothing functions.
Trends should align. If CoPilot’s Performance page shows CPU usage climbing
over time, your external dashboards should show the same trend. The individual
data points may differ, but the direction and magnitude of changes will be
consistent.
API Coverage Reference
Resetting the API Key
You can reset the API key from CoPilot. The Reset API Key option appears under Network Insights API only when the feature is enabled.- Navigate to Settings > Configuration > General.
- Scroll to the Features section.
- Under Network Insights API, click Reset API Key.
- Select the checkbox for I understand the implications, and then click Reset.
- Copy the new key and close the confirmation window.
Related Resources
- Metrics Monitored for Aviatrix Resources — complete list of all metrics CoPilot tracks
- Notifications (Alerts) About Network Events — configuring CoPilot’s built-in alerts
- Aviatrix Integration with Prometheus and Grafana — community walkthrough