client

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcadockClient added in v0.6.0

type AcadockClient interface {
	AllContainersUsage() (ContainersUsage, error)
	Memory(dockerId string) (*MemoryUsage, error)
	CpuUsage(dockerId string) (*CpuUsage, error)
	NetUsage(dockerId string) (*NetUsage, error)
	Usage(dockerId string, net bool) (*Usage, error)
	HostUsage(opts HostUsageOpts) (HostUsage, error)
}

type Client

type Client struct {
	Endpoint string
	Username string
	Password string
}

func NewClient

func NewClient(endpoint string, opts ...ClientOpts) (*Client, error)

func (*Client) AllContainersUsage added in v0.3.2

func (c *Client) AllContainersUsage() (ContainersUsage, error)

func (*Client) CpuUsage

func (c *Client) CpuUsage(dockerId string) (*CpuUsage, error)

func (*Client) HostUsage added in v0.6.0

func (c *Client) HostUsage(opts HostUsageOpts) (HostUsage, error)

func (*Client) Memory

func (c *Client) Memory(dockerId string) (*MemoryUsage, error)

func (*Client) NetUsage added in v0.3.0

func (c *Client) NetUsage(dockerId string) (*NetUsage, error)

func (*Client) Usage added in v0.3.0

func (c *Client) Usage(dockerId string, net bool) (*Usage, error)

type ClientOpts added in v0.6.0

type ClientOpts func(*Client) *Client

func WithAuthentication added in v0.6.0

func WithAuthentication(user, pass string) ClientOpts

type ContainersUsage added in v0.3.1

type ContainersUsage map[string]Usage

func NewContainersUsage added in v0.3.1

func NewContainersUsage() ContainersUsage

type CpuUsage added in v0.3.0

type CpuUsage struct {
	UsageInPercents int `json:"usage_in_percents"`
}

type HostCpuUsage added in v0.6.0

type HostCpuUsage struct {
	Usage                            float64 `json:"usage"`
	Amount                           int     `json:"amount"`
	QueueLengthExponentiallySmoothed float64 `json:"queue_length_exponentially_smoothed"`
}

type HostMemoryUsage added in v0.6.0

type HostMemoryUsage struct {
	Free            uint64 `json:"free"`
	Total           uint64 `json:"total"`
	Swap            uint64 `json:"swap"`
	MemoryUsage     uint64 `json:"memory_usage"`
	MemoryCommitted uint64 `json:"memory_committed"`
	MaxMemoryUsage  uint64 `json:"max_memory_usage"`
	SwapUsage       uint64 `json:"swap_usage"`
	SwapCommitted   uint64 `json:"swap_committed"`
	MaxSwapUsage    uint64 `json:"max_swap_usage"`
}

type HostUsage added in v0.6.0

type HostUsage struct {
	CPU    HostCpuUsage    `json:"cpu"`
	Memory HostMemoryUsage `json:"memory"`
}

type HostUsageOpts added in v0.6.0

type HostUsageOpts struct {
	IncludeContainerIfLabel string
}

type MemoryUsage

type MemoryUsage struct {
	MemoryUsage    int64 `json:"memory_usage"`
	SwapUsage      int64 `json:"swap_usage"`
	MemoryLimit    int64 `json:"memory_limit"`
	SwapLimit      int64 `json:"swap_limit"`
	MaxMemoryUsage int64 `json:"max_memory_usage"`
	MaxSwapUsage   int64 `json:"max_swap_usage"`
}

type NetUsage added in v0.3.0

type NetUsage struct {
	netstat.NetworkStat
	RxBps int64 `json:"rx_bps"`
	TxBps int64 `json:"tx_bps"`
}

type Usage added in v0.3.0

type Usage struct {
	Memory *MemoryUsage      `json:"memory"`
	Cpu    *CpuUsage         `json:"cpu"`
	Net    *NetUsage         `json:"net,omitempty"`
	Labels map[string]string `json:"labels,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL