Metrics API
The Metrics API gives you direct POST access to the underlying Elasticsearch indices. You supply the full query body, which lets you filter, aggregate, and shape results in any way the Elasticsearch Query DSL supports.
Network utilization
Because utilization volume is extremely high, query it using aggregates that roll up the data.
- Description: Get all utilization for the entire network for the last 24 hours, split by direction, using 10-minute buckets.
- Endpoint:
POST https://gateway.production.netfoundry.io/rest/v1/elastic/ncutilization/<NETWORK_GROUP_ID>/_search/
Query body
{
"aggs": {
"usage_sums": {
"terms": {
"field": "usage_type.keyword",
"size": 2,
"order": { "usage_bytes": "desc" }
},
"aggs": {
"usage_bytes": {
"sum": { "field": "usage" }
}
}
}
},
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-24h",
"lte": "now",
"format": "epoch_millis"
}
}
},
{
"match_phrase": { "network_id": { "query": "<NETWORK_ID>" } }
},
{
"match_phrase": { "organizationId": { "query": "<NETWORK_GROUP_ID>" } }
}
],
"should": [
{ "match_phrase": { "usage_type.keyword": "usage.ingress.tx" } },
{ "match_phrase": { "usage_type.keyword": "usage.egress.tx" } }
],
"minimum_should_match": 1
}
}
}
Management events
- Description: Get all provisioning activity from the NetFoundry API for the last 24 hours.
- Endpoint:
POST /rest/v1/elastic/ncentityevent/<NETWORK_GROUP_ID>/_search/
Query body
{
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-24h",
"lte": "now",
"format": "epoch_millis"
}
}
},
{
"match_phrase": { "organizationId": { "query": "82d70e3f-deda-469f-be1a-9c40561ede5d" } }
},
{
"match_phrase": { "networkId": { "query": "d3b30838-1dcd-4268-9e7a-4821f58b783e" } }
}
]
}
},
"size": 100,
"sort": [
{ "@timestamp": { "order": "desc", "unmapped_type": "boolean" } }
]
}
Network events
- Description: Get all network events for a specific network over the last 24 hours, including API session activity and router online/offline events.
- Endpoint:
POST /rest/v1/elastic/ncevents/<NETWORK_GROUP_ID>/_search/
Query body
{
"query": {
"bool": {
"must": [
{
"match_phrase": { "organizationId": { "query": "<NETWORK_GROUP_ID>" } }
},
{
"match_phrase": { "network_id": { "query": "<NETWORK_ID>" } }
},
{
"range": {
"timestamp": {
"gte": "now-24h",
"lte": "now",
"format": "epoch_millis"
}
}
}
]
}
},
"size": 500,
"sort": [
{ "@timestamp": { "order": "desc", "unmapped_type": "boolean" } }
]
}
Service dial metrics
- Description: Get service dial metrics for a specific service, bucketed in hourly intervals.
- Endpoint:
POST /rest/v1/elastic/ncserviceevents/<NETWORK_GROUP_ID>/_search/
Query body
{
"aggs": {
"items": {
"date_histogram": {
"field": "timestamp",
"interval": 3600000,
"time_zone": "UTC",
"min_doc_count": 1
},
"aggs": {
"event_types": {
"terms": {
"field": "event_type.keyword",
"size": 10
},
"aggs": {
"sum": {
"sum": { "field": "count" }
}
}
}
}
}
},
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "now-24h",
"lte": "now",
"format": "epoch_millis"
}
}
},
{
"match_phrase": { "network_id": { "query": "<NETWORK ID>" } }
},
{
"match_phrase": { "organizationId": { "query": "<NETWORK GROUP ID>" } }
},
{
"match_phrase": { "nf_service_id": { "query": "<SERVICE ID>" } }
}
]
}
}
}