host

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPythonVersion

func GetPythonVersion() string

GetPythonVersion returns the version string as provided by the embedded Python interpreter.

func GetStatusInformation

func GetStatusInformation() *host.InfoStat

GetStatusInformation just returns an InfoStat object, we need some additional information that's not

func InitHostMetadata

func InitHostMetadata() error

InitHostMetadata initializes necessary CPU info

Types

type InstallMethod

type InstallMethod struct {
	Tool             *string `json:"tool"`
	ToolVersion      string  `json:"tool_version"`
	InstallerVersion *string `json:"installer_version"`
}

InstallMethod is metadata about the agent's installation

type LogsMeta

type LogsMeta struct {
	Transport string `json:"transport"`
}

LogsMeta is metadata about the host's logs agent

type Meta

type Meta struct {
	SocketHostname string   `json:"socket-hostname"`
	Timezones      []string `json:"timezones"`
	SocketFqdn     string   `json:"socket-fqdn"`
	EC2Hostname    string   `json:"ec2-hostname"`
	Hostname       string   `json:"hostname"`
	HostAliases    []string `json:"host_aliases"`
	InstanceID     string   `json:"instance-id"`
	AgentHostname  string   `json:"agent-hostname,omitempty"`
}

Meta is the metadata nested under the meta key

func GetMeta

func GetMeta(hostnameData util.HostnameData) *Meta

GetMeta grabs the metadata from the cache and returns it, if the cache is empty, then it queries the information directly

type NetworkMeta

type NetworkMeta struct {
	ID string `json:"network-id"`
}

NetworkMeta is metadata about the host's network

type Payload

type Payload struct {
	Os            string            `json:"os"`
	AgentFlavor   string            `json:"agent-flavor"`
	PythonVersion string            `json:"python"`
	SystemStats   *systemStats      `json:"systemStats"`
	Meta          *Meta             `json:"meta"`
	HostTags      *tags             `json:"host-tags"`
	ContainerMeta map[string]string `json:"container-meta,omitempty"`
	NetworkMeta   *NetworkMeta      `json:"network"`
	LogsMeta      *LogsMeta         `json:"logs"`
	InstallMethod *InstallMethod    `json:"install-method"`
}

Payload handles the JSON unmarshalling of the metadata payload

func GetPayload

func GetPayload(hostnameData util.HostnameData) *Payload

GetPayload builds a metadata payload every time is called. Some data is collected only once, some is cached, some is collected at every call.

func GetPayloadFromCache

func GetPayloadFromCache(hostnameData util.HostnameData) *Payload

GetPayloadFromCache returns the payload from the cache if it exists, otherwise it creates it. The metadata reporting should always grab it fresh. Any other uses, e.g. status, should use this

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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