Skip to main content
The Aviatrix Metrics and Status APIs allow you to integrate CoPilot with third-party monitoring platforms such as Datadog, Splunk, Grafana, or Prometheus. This guide covers which APIs to use, what data is available, how to configure alerting that stays consistent with CoPilot’s built-in monitoring, and how to avoid common pitfalls like double-counted traffic or noisy metrics. CoPilot exposes two complementary APIs for external consumption:

Metrics API

Endpoint: /metrics-api/v1/gatewaysPerformance metrics including CPU, memory, throughput, and packet drops.Scrape interval: Every 5 minutes

Status API

Endpoint: /status-api/v1/Availability status for gateways, tunnels, and BGP peerings.Scrape interval: Every 1 minute
Both APIs support Prometheus text format and JSON output. All data transmissions are encrypted using industry-standard protocols.

Authentication

Both APIs use the same API key, passed as a Bearer token:
The API key is generated in CoPilot under Settings > Configuration > General > Features. A single key grants access to both endpoints. See Enabling the API for the steps.

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.
The API key shown when you generate it will not be accessible again. Copy it and save it in a secure place. If you lose the key, you must reset it, which invalidates the previous key.
  1. In CoPilot, navigate to Settings > Configuration > General.
  2. Scroll down to the Features section.
  3. Next to Network Insights API, toggle the switch on.
  4. In the Network Insights API Key dialog that opens, click Generate API Key.
  5. Copy the displayed key and save it in a secure place.
  6. Click Close.
The Network Insights API is now enabled, and your scripts can authenticate to the Metrics and Status APIs using the generated key.

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:
  1. In CoPilot, navigate to Settings > Configuration > General.
  2. Scroll down to the Features section.
  3. Under Network Insights API, in the API Specifications dropdown, select Metrics API or Status API.
  4. Click Download.

Testing API Access

Verify access to your CoPilot instance with a curl command:
A 200 response with metric data confirms the API is working. A 403 response indicates an incorrect or expired key.

Metrics API

Endpoints

The default format is Prometheus text. Append ?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.
Recommended scrape interval: 5 minutes. Polling more frequently returns the same cached data.

Gateway-Level Metrics

These metrics are reported once per gateway, with a gateway 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 with gateway 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, with gateway 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.
Recommended scrape interval: 1 minute. The Status API refreshes at this rate, and availability events are time-sensitive.

Gateway Status

Reported as status with a gateway label.

Tunnel Status

Includes both gateway-to-gateway peering tunnels and Site-to-Cloud (S2C) tunnels, reported as status with a tunnel label.

BGP Peering Status

Reported as bgp_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 on tun-* 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.
If you need per-tunnel visibility (for example, to identify which specific S2C tunnel is experiencing packet drops) you may collect tun-* metrics separately. In that case, do not sum them with eth interface metrics.
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.

Tier 1 — Critical Alerts

Configure these in every deployment. They cover the most impactful failure conditions.
Adjust the memory threshold based on your gateway instance sizes. A gateway with 2 GB of RAM should alert at a different absolute threshold than one with 16 GB.

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

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.
This lag is by design. CoPilot’s built-in alerts default to 15-minute evaluation windows to avoid alert fatigue from transient issues. If more granular data is required, you can leverage CoPilot as a drill-down tool, use CoPilot webhook-based alerts, or leverage Syslog via the Aviatrix SIEM connector.

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.
Resetting the key generates a new API key and the current key will no longer work. You must update any scripts that use the old key.
  1. Navigate to Settings > Configuration > General.
  2. Scroll to the Features section.
  3. Under Network Insights API, click Reset API Key.
  4. Select the checkbox for I understand the implications, and then click Reset.
  5. Copy the new key and close the confirmation window.