agentlocal

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package agentlocal provides facilities for accessing local pmm-agent API.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSetUp = fmt.Errorf("pmm-agent is running, but not set up")

ErrNotSetUp is returned by GetStatus when pmm-agent is running, but not set up.

Functions

func GetRawStatus

func GetRawStatus(ctx context.Context, requestNetworkInfo NetworkInfo) (*agentlocal.StatusOKBody, error)

GetRawStatus returns raw local pmm-agent status. No special cases. Most callers should use GetStatus instead.

func SetTransport

func SetTransport(ctx context.Context, debug bool)

SetTransport configures transport for accessing local pmm-agent API.

Types

type AgentStatus

type AgentStatus struct {
	AgentID   string `json:"agent_id"`
	AgentType string `json:"agent_type"`
	Status    string `json:"status"`
}

type NetworkInfo

type NetworkInfo bool
const (
	RequestNetworkInfo      NetworkInfo = true
	DoNotRequestNetworkInfo NetworkInfo = false
)

type Status

type Status struct {
	AgentID string `json:"agent_id"`
	NodeID  string `json:"node_id"`

	ServerURL         *url.URL `json:"server_url"`
	ServerInsecureTLS bool     `json:"server_insecure_tls"`
	ServerVersion     string   `json:"server_version"`

	Agents []AgentStatus `json:"agents"`

	Connected        bool          `json:"connected"`
	ServerClockDrift time.Duration `json:"server_clock_drift,omitempty"`
	ServerLatency    time.Duration `json:"server_latency,omitempty"`
}

Status represents pmm-agent status.

func GetStatus

func GetStatus(requestNetworkInfo NetworkInfo) (*Status, error)

GetStatus returns local pmm-agent status. As a special case, if pmm-agent is running, but not set up, ErrNotSetUp is returned.

Jump to

Keyboard shortcuts

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