GetCapacity
const url = 'https://example.com/hopbox.admin.v1.MonitorService/GetCapacity';const options = { method: 'POST', headers: { 'Connect-Protocol-Version': '1', 'Connect-Timeout-Ms': '1000', 'Content-Type': 'application/json' }, body: '{"range":"HISTORY_RANGE_UNSPECIFIED"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/hopbox.admin.v1.MonitorService/GetCapacity \ --header 'Connect-Protocol-Version: 1' \ --header 'Connect-Timeout-Ms: 1000' \ --header 'Content-Type: application/json' \ --data '{ "range": "HISTORY_RANGE_UNSPECIFIED" }'GetCapacity returns the capacity of each node, what its machines hold and use, and the trend.
Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Define the version of the Connect protocol
Define the version of the Connect protocol
Example
1Define the timeout, in ms
Define the timeout, in ms
Example
1000Request Bodyrequired
Section titled “Request Bodyrequired”GetCapacityRequest selects the range of the trends.
object
Responses
Section titled “Responses”Success
GetCapacityResponse holds the capacity of each node.
object
Sample_time is the time of the newest sample of the leader, or absent without one.
Step is the time between two points of each trend.
Servers are the servers with the node role that are not decommissioned, by ID.
ServerCapacity is the capacity of one node, what its machines hold, and what they use.
object
Server_id is the ID of the server.
Vcpus is the vCPU capacity of the node, with the overcommit of placement.
Vcpus_allocated is the vCPUs of the machines that hold compute on the node.
Memory_bytes is the RAM of the node.
Memory_allocated_bytes is the RAM of the machines that hold compute on the node.
Disk_bytes is the size of the file system of the data dir of the node.
Disk_free_bytes is the free space of that file system.
Disk_allocated_bytes is the disk sizes of the machines on the node.
Cpu_used is the CPU threads that the machines of the node used in the last 5 minutes (hopbox_machines_cpu_seconds_total). It is absent when the history has no recent sample of the node, such as for a node without the control role.
Memory_used_bytes is the host RAM that the machines of the node hold now (hopbox_machines_memory_bytes). It is absent as cpu_used is.
Cpu_used_history is cpu_used in each step of the range.
SamplePoint is a value of a trend at one time.
object
Time is the end of the step of the value.
Memory_used_history is memory_used_bytes at the end of each step of the range.
SamplePoint is a value of a trend at one time.
object
Time is the end of the step of the value.
Vcpus_allocated_history is vcpus_allocated at the end of each step of the range.
SamplePoint is a value of a trend at one time.
object
Time is the end of the step of the value.
Memory_allocated_history is memory_allocated_bytes at the end of each step of the range.
SamplePoint is a value of a trend at one time.
object
Time is the end of the step of the value.
Disk_free_history is disk_free_bytes at the end of each step of the range.
SamplePoint is a value of a trend at one time.
object
Time is the end of the step of the value.
Hostname is the host name of the server, or empty when the control store no longer has the server.
Pool is the name of the pool of the server, or empty as hostname.
Roles are the roles of the server.
State is the state of the server, or unspecified as hostname.
Cpu_threads is the count of CPU threads of the node. vcpus is cpu_threads times the vCPU overcommit of placement, so cpu_used compares with it.
Grafana_url is grafana_url of the install config, or empty.
Example
{ "sampleTime": "2023-01-15T01:30:15.01Z", "servers": [ { "cpuUsedHistory": [ { "time": "2023-01-15T01:30:15.01Z" } ], "memoryUsedHistory": [ { "time": "2023-01-15T01:30:15.01Z" } ], "vcpusAllocatedHistory": [ { "time": "2023-01-15T01:30:15.01Z" } ], "memoryAllocatedHistory": [ { "time": "2023-01-15T01:30:15.01Z" } ], "diskFreeHistory": [ { "time": "2023-01-15T01:30:15.01Z" } ], "state": "SERVER_STATE_UNSPECIFIED" } ]}default
Section titled “default”Error
Error type returned by Connect: https://connectrpc.com/docs/go/errors/#http-representation
object
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
A list of messages that carry the error details. There is no limit on the number of messages.
Contains an arbitrary serialized message along with a @type that describes the type of the serialized message, with an additional debug field for ConnectRPC error details.
object
A URL that acts as a globally unique identifier for the type of the serialized message. For example: type.googleapis.com/google.rpc.ErrorInfo.
The Protobuf message, serialized as bytes and base64-encoded. The specific message type is identified by the type field.
Deserialized error detail payload. The ‘type’ field indicates the schema. This field is for easier debugging and should not be relied upon for application logic.
object
Example
{ "code": "canceled"}