api

package
v0.0.0-...-48273b5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrInternalServerError

func ErrInternalServerError(err error) render.Renderer

func NewQueryable

func NewQueryable(store *store.Store, agentIDFunc func() string) metricQueryable

NewQueryable returns a metricQueryable that only do queries on the main agent.

Types

type API

type API struct {
	BindAddress        string
	StaticCDNURL       string
	LocalUIDisabled    bool
	Endpoints          config.WebEndpoints
	DB                 metricQueryable
	ContainerRuntime   containerInterface
	PsFact             *facts.ProcessProvider
	FactProvider       *facts.FactProvider
	Discovery          *discovery.Discovery
	AgentInfo          agentInterface
	PrometheusExporter http.Handler
	Threshold          *threshold.Registry
	DiagnosticPage     func(ctx context.Context) string
	DiagnosticArchive  func(ctx context.Context, w types.ArchiveWriter) error
	// contains filtered or unexported fields
}

API contains API's port.

func (*API) Run

func (api *API) Run(ctx context.Context) error

Run starts our API.

type AgentInfo

type AgentInfo struct {
	RegistrationAt *time.Time `json:"registrationAt,omitempty"`
	LastReport     *time.Time `json:"lastReport,omitempty"`
	IsConnected    bool       `json:"isConnected"`
}

func (*AgentInfo) Render

func (a *AgentInfo) Render(_ http.ResponseWriter, _ *http.Request) error

type AgentStatus

type AgentStatus struct {
	ServiceName       string  `json:"serviceName"`
	Status            float64 `json:"status"`
	StatusDescription string  `json:"statusDescription"`
}

func (*AgentStatus) Render

func (a *AgentStatus) Render(_ http.ResponseWriter, _ *http.Request) error

type CPUUsage

type CPUUsage struct {
	User      float64 `json:"User"`
	Nice      float64 `json:"Nice"`
	System    float64 `json:"System"`
	Idle      float64 `json:"Idle"`
	IOWait    float64 `json:"IOWait"`
	Guest     float64 `json:"Guest"`
	GuestNice float64 `json:"GuestNice"`
	Irq       float64 `json:"IRQ"`
	SoftIrq   float64 `json:"SoftIRQ"`
	Steal     float64 `json:"Steal"`
}

type Container

type Container struct {
	Command      string     `json:"command"`
	CreatedAt    *time.Time `json:"createdAt,omitempty"`
	ID           string     `json:"id"`
	Image        string     `json:"image"`
	InspectJSON  string     `json:"inspectJSON"`
	Name         string     `json:"name"`
	StartedAt    *time.Time `json:"startedAt,omitempty"`
	State        string     `json:"state"`
	FinishedAt   *time.Time `json:"finishedAt,omitempty"`
	IoWriteBytes float64    `json:"ioWriteBytes"`
	IoReadBytes  float64    `json:"ioReadBytes"`
	NetBitsRecv  float64    `json:"netBitsRecv"`
	NetBitsSent  float64    `json:"netBitsSent"`
	MemUsedPerc  float64    `json:"memUsedPerc"`
	CPUUsedPerc  float64    `json:"cpuUsedPerc"`
}

type Containers

type Containers struct {
	Count        int          `json:"count"`
	CurrentCount int          `json:"currentCount"`
	Containers   []*Container `json:"containers"`
}

func (*Containers) Render

func (c *Containers) Render(_ http.ResponseWriter, _ *http.Request) error

type Data

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

func (*Data) AgentInformation

func (d *Data) AgentInformation(w http.ResponseWriter, r *http.Request)

AgentInformation returns some informations about agent registration to Bleemeo Cloud.

func (*Data) AgentStatus

func (d *Data) AgentStatus(w http.ResponseWriter, r *http.Request)

AgentStatus returns an integer that represent global server status over several metrics.

func (*Data) Containers

func (d *Data) Containers(w http.ResponseWriter, r *http.Request)

Containers have 4 query parameters : - offset (string) : The offset of the first element to return. - limit (string) : The maximum number of elements to return. - allContainers (bool) : If true, return all containers, otherwise only running containers. - search (string) : The search string to filter containers.

func (*Data) Facts

func (d *Data) Facts(w http.ResponseWriter, r *http.Request)

Facts returns a list of facts discovered by agent.

func (*Data) Logs

func (d *Data) Logs(w http.ResponseWriter, _ *http.Request)

func (*Data) Processes

func (d *Data) Processes(w http.ResponseWriter, r *http.Request)

Processes returns a list of topInfo, they have 1 query parameter : - search (string) : The container ID to filter processes.

func (*Data) Services

func (d *Data) Services(w http.ResponseWriter, r *http.Request)

Services returns a list services discovered by agent They can be filtered by active flag.

func (*Data) Tags

func (d *Data) Tags(w http.ResponseWriter, r *http.Request)

Tags returns a list of tags from system.

type ErrResponse

type ErrResponse struct {
	Err            error `json:"-"` // low-level runtime error
	HTTPStatusCode int   `json:"-"` // http response status code

	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}

func (*ErrResponse) Render

func (e *ErrResponse) Render(_ http.ResponseWriter, r *http.Request) error

type Fact

type Fact struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

func (*Fact) Render

func (f *Fact) Render(_ http.ResponseWriter, _ *http.Request) error

type LabelInput

type LabelInput struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type MemoryUsage

type MemoryUsage struct {
	Total   float64 `json:"Total"`
	Used    float64 `json:"Used"`
	Free    float64 `json:"Free"`
	Buffers float64 `json:"Buffers"`
	Cached  float64 `json:"Cached"`
}

type MetricInput

type MetricInput struct {
	Labels []*LabelInput `json:"labels"`
}

type Pagination

type Pagination struct {
	Offset int `json:"offset"`
	Limit  int `json:"limit"`
}

type Process

type Process struct {
	Pid         int       `json:"pid"`
	Ppid        int       `json:"ppid"`
	CreateTime  time.Time `json:"create_time"`
	Cmdline     string    `json:"cmdline"`
	Name        string    `json:"name"`
	MemoryRss   int64     `json:"memory_rss"`
	CPUPercent  float64   `json:"cpu_percent"`
	CPUTime     float64   `json:"cpu_time"`
	Status      string    `json:"status"`
	Username    string    `json:"username"`
	Executable  string    `json:"executable"`
	ContainerID string    `json:"container_id"`
}

type Service

type Service struct {
	Name              string   `json:"name"`
	ContainerID       string   `json:"containerId"`
	IPAddress         string   `json:"ipAddress"`
	ListenAddresses   []string `json:"listenAddresses"`
	ExePath           string   `json:"exePath"`
	Active            bool     `json:"active"`
	Status            float64  `json:"status"`
	StatusDescription *string  `json:"statusDescription,omitempty"`
}

func (*Service) Render

func (s *Service) Render(_ http.ResponseWriter, _ *http.Request) error

type SwapUsage

type SwapUsage struct {
	Total float64 `json:"Total"`
	Used  float64 `json:"Used"`
	Free  float64 `json:"Free"`
}

type Tag

type Tag struct {
	TagName string `json:"tagName"`
}

func (*Tag) Render

func (t *Tag) Render(_ http.ResponseWriter, _ *http.Request) error

type Topinfo

type Topinfo struct {
	Time      time.Time    `json:"Time"`
	Uptime    int          `json:"Uptime"`
	Loads     []float64    `json:"Loads"`
	Users     int          `json:"Users"`
	Processes []*Process   `json:"Processes"`
	CPU       *CPUUsage    `json:"CPU,omitempty"`
	Memory    *MemoryUsage `json:"Memory,omitempty"`
	Swap      *SwapUsage   `json:"Swap,omitempty"`
}

func (*Topinfo) Render

func (t *Topinfo) Render(_ http.ResponseWriter, _ *http.Request) error

Jump to

Keyboard shortcuts

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