stats

package
v0.0.0-...-46c35f9 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStats

func GetStats() (*stats.Stats, error)

Returns full system stats.

func GetStatsBrief

func GetStatsBrief() (*stats.Stats, error)

Returns brief system stats, enough to identify the machine. For more in-depth metrics, use GetStats.

func Init

func Init(config *koanf.Koanf)

Initializes the reporting system, mainly fetches and copies in memory static information needed by providers.

func IsOnline

func IsOnline() bool

Returns true if the node is connected to the internet (full connectivity, not just a local network connection).

Types

type StatsFS

type StatsFS struct {
	// Disk device name
	Device string `json:"device"`

	// Mount type
	Type string `json:"type"`

	// Mount path
	Mount string `json:"mount"`

	// Free space
	Free uint64 `json:"free"`

	// Used space, for conveniency
	Used uint64 `json:"used"`

	// Available space
	Available uint64 `json:"available"`

	// Total disk size
	Size uint64 `json:"size"`
}

Type StatsFS contains a single disk/mount information parsed from /proc/self/mountinfo.

type StatsLocation

type StatsLocation struct {
	// Name of the location. Not required
	Name string `json:"name,omitempty"`

	// For the purpose of this project, this should always be "Point"
	Type string `json:"type"`

	// Coordinate array for the GeoJSON object. Longitude goes first as per spec
	Coordinates []float64 `json:"coordinates"`

	// Sensor elevation/altitude
	Elevation float64 `json:"elevation"`
}

Type StatsLocation provides static location information as defined in the node local configuration. The type is GeoJSON compatible.

type StatsMemory

type StatsMemory struct {
	// The amount of physical RAM, in kibibytes, left unused by the system
	Free uint64 `json:"free"`

	// Total amount of usable RAM, in kibibytes, which is physical RAM minus a number of reserved bits and the kernel binary code
	Total uint64 `json:"total"`

	// Estimate of how much memory is available for starting new applications, without swapping
	Available uint64 `json:"available"`

	// The amount, in kibibytes, of temporary storage for raw disk blocks
	Buffers uint64 `json:"buffers"`

	// The amount of physical RAM, in kibibytes, used as cache memory
	Cached uint64 `json:"cached"`

	// The total amount of swap free, in kibibytes
	SwapFree uint64 `json:"swap_free"`

	// The total amount of swap available, in kibibytes
	SwapTotal uint64 `json:"swap_total"`
}

Type StatsMemory contains memory status information parsed from /proc/meminfo.

type StatsNetwork

type StatsNetwork struct {
	// List of realized network devices as returned by gonetworkmanager.NetworkManager.GetDevices()
	Devices []gonetworkmanager.Device `json:"devices"`

	// General connection status as reported by gonetworkmanager.NetworkManager.State()
	Status string `json:"status"`
}

Type StatsNetwork contains network device information by using NetworkManager's DBus interface.

type StatsSensor

type StatsSensor struct {
	// General sensing status
	Status sensor.StatusEnum `json:"status"`

	// Current campaign ID (if running) or null (if free)
	CampaignId string `json:"campaignId,omitempty"`
}

Type StatsSensor reports sensor status information (busy/free, campaign ID, etc.).

Jump to

Keyboard shortcuts

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