status

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtServiceResp added in v0.2.0

type ExtServiceResp struct {
	Name         string                 `json:"name"`
	StatusCode   int                    `json:"status_code"`
	ResponseTime int64                  `json:"response_time"` // milliseconds
	Body         map[string]interface{} `json:"body"`
}

ExtServiceResp contains extended service information

type ExtServices added in v0.2.0

type ExtServices struct {
	// contains filtered or unexported fields
}

ExtServices is a service that retrieves data from external services via HTTP GET calls

func NewExtServices added in v0.2.0

func NewExtServices(httpTimeout time.Duration, concurrency int, ss ...string) *ExtServices

NewExtServices returns a new instance of ExtServices for a list of name:url pairs

func (*ExtServices) Status added in v0.2.0

func (es *ExtServices) Status() []ExtServiceResp

Status returns extended service information, request timeout is 5 seconds and runs concurrently

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]ExtServiceResp `json:"ext_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

Jump to

Keyboard shortcuts

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