Consul
Usage Operator HTTP API
The /operator/usage endpoint returns usage information about the number of
services, service instances and mesh-enabled service instances by datacenter.
| Method | Path | Produces |
|---|---|---|
GET | /operator/usage | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
| Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
|---|---|---|---|
YES | all | none | operator:read |
The corresponding CLI command is consul operator usage instances.
Query Parameters
global(bool: false)- If present, usage information for all known datacenters will be returned. By default, only the local datacenter's usage information is returned.stale(bool: false)- If the cluster does not currently have a leader, an error will be returned. You can use the?stalequery parameter to read the Raft configuration from any of the Consul servers.
Sample Request
$ curl \
http://127.0.0.1:8500/v1/operator/usage
Sample Response
{
"Usage": {
"dc1": {
"Services": 1,
"ServiceInstances": 1,
"ConnectServiceInstances": {
"connect-native": 0,
"connect-proxy": 0,
"ingress-gateway": 0,
"mesh-gateway": 0,
"terminating-gateway": 0
},
"BillableServiceInstances": 0,
"Nodes": 1
}
},
"Index": 13,
"LastContact": 0,
"KnownLeader": true,
"ConsistencyLevel": "leader",
"NotModified": false,
"Backend": 0,
"ResultsFilteredByACLs": false
}
Servicesis the total number of unique service names registered in the datacenter.ServiceInstancesis the total number of service instances registered in the datacenter.ConnectServiceInstancesis the total number of mesh service instances registered in the datacenter.BillableServiceInstancesis the total number of billable service instances registered in the datacenter. This is only relevant in Consul Enterprise and is the total service instance count, not including any mesh service instances or any Consul server instances.PartitionNamespaceServicesEnterprise is the total number of unique service names registered in the datacenter, by partition and namespace.PartitionNamespaceServiceInstancesEnterprise is the total number of service instances registered in the datacenter, by partition and namespace.PartitionNamespaceBillableServiceInstancesEnterprise is the total number of billable service instances registered in the datacenter, by partition and namespace.PartitionNamespaceConnectServiceInstancesEnterprise is the total number of mesh service instances registered in the datacenter, by partition and namespace.