Accessing Metrics
Overview
You may query our HTTP endpoint to get the current state of all the metrics that has been made available for you. The metrics are exposed in the OpenMetrics text format, and can be scraped by Prometheus or other systems that support this format.
These metrics are aimed for providing operational insight, and would not be suitable for billing purposes.
Please reach out to clarify what metrics you would need access to.
Credentials
To use this API, you would need to have a OAuth 2.0 client and be granted the metrics.read
scope.
Get metrics, curl
curl -s --oauth2-bearer $ACCESS_TOKEN https://sandbox.api.wgtwo.com/metrics/v1
Get metrics, Prometheus
The below Prometheus config will scrape the metric endpoint every 30 seconds, fetching all available time series. Note that the configuration will contain secrets.
You may replace client_secret
with client_secret_file
which should contain the path to a file containing the secret.
See: prometheus.io › Configuration
global:
scrape_interval: 30s
evaluation_interval: 30s
scrape_configs:
- job_name: cisco
metrics_path: /metrics/v1
scheme: https
oauth2:
client_id: "CLIENT_ID"
client_secret: "CLIENT_SECRET"
scopes:
- metrics.read
token_url: "https://id.wgtwo.com/oauth2/token"
static_configs:
- targets:
- "api.shamrock.wgtwo.com:443" # Dublin
- "api.sakura.wgtwo.com:443" # Tokyo
- "api.oak.wgtwo.com:443" # Oregon
Example: Run with Docker
If you run the below commands, you should have Prometheus running successfully.
# Store sample configuration to prometheus.yml, including actual credentials
docker run -p 9090:9090 -v prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
Grafana
Many of our customers use Grafana to visualize their metrics.
In order to use Grafana with our metrics, you would need to have a Prometheus server running and scraping the metrics.
An alternative to running this yourself would be to use Grafana Cloud. In that case you would typically run Grafana Agent, which is a Prometheus-compatible agent that can scrape metrics and send them to Grafana Cloud.