status

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtServices added in v0.2.0

type ExtServices interface {
	Status() []external.Response
}

ExtServices declares interface to get status of all external services

type ExtServicesMock added in v0.3.0

type ExtServicesMock struct {
	// StatusFunc mocks the Status method.
	StatusFunc func() []external.Response
	// contains filtered or unexported fields
}

ExtServicesMock is a mock implementation of ExtServices.

func TestSomethingThatUsesExtServices(t *testing.T) {

	// make and configure a mocked ExtServices
	mockedExtServices := &ExtServicesMock{
		StatusFunc: func() []external.Response {
			panic("mock out the Status method")
		},
	}

	// use mockedExtServices in code that requires ExtServices
	// and then make assertions.

}

func (*ExtServicesMock) Status added in v0.3.0

func (mock *ExtServicesMock) Status() []external.Response

Status calls StatusFunc.

func (*ExtServicesMock) StatusCalls added in v0.3.0

func (mock *ExtServicesMock) StatusCalls() []struct {
}

StatusCalls gets all the calls that were made to Status. Check the length with:

len(mockedExtServices.StatusCalls())

type Info

type Info struct {
	HostName   string            `json:"hostname"`
	Procs      int               `json:"procs"`
	HostID     string            `json:"host_id"`
	CPUPercent int               `json:"cpu_percent"`
	MemPercent int               `json:"mem_percent"`
	Uptime     uint64            `json:"uptime"`
	Volumes    map[string]Volume `json:"volumes,omitempty"`
	Loads      struct {
		One     float64 `json:"one"`
		Five    float64 `json:"five"`
		Fifteen float64 `json:"fifteen"`
	} `json:"load_average"`
	ExtServices map[string]external.Response `json:"services,omitempty"`
}

Info contains disk and cpu utilization results

type Service

type Service struct {
	Volumes     []Volume
	ExtServices ExtServices
}

Service provides disk and cpu utilization

func (Service) Get

func (s Service) Get() (*Info, error)

Get returns the disk and cpu utilization

type Volume

type Volume struct {
	Name         string `json:"name"`
	Path         string `json:"path"`
	UsagePercent int    `json:"usage_percent"`
}

Volume contains input information for a volume and the result for utilization percentage

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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