monitor

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package monitor samples host metrics once and publishes immutable snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Disk

type Disk struct {
	Mount      string `json:"mount"`
	Filesystem string `json:"filesystem"`
	Total      uint64 `json:"total"`
	Used       uint64 `json:"used"`
	Free       uint64 `json:"free"`
}

type GPU

type GPU struct {
	Name        string  `json:"name"`
	MemoryTotal uint64  `json:"memory_total"`
	MemoryUsed  uint64  `json:"memory_used"`
	Utilization float64 `json:"utilization"`
	Temperature float64 `json:"temperature"`
}

type Interface

type Interface struct {
	Name        string   `json:"name"`
	Addresses   []string `json:"addresses"`
	Sent        uint64   `json:"sent"`
	Received    uint64   `json:"received"`
	UploadBPS   float64  `json:"upload_bps"`
	DownloadBPS float64  `json:"download_bps"`
}

type Sampler

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

func New

func New() *Sampler

func (*Sampler) Interval

func (s *Sampler) Interval(d time.Duration)

func (*Sampler) Run

func (s *Sampler) Run(ctx context.Context)

func (*Sampler) Snapshot

func (s *Sampler) Snapshot() Snapshot

type Snapshot

type Snapshot struct {
	Time           time.Time                      `json:"time"`
	ElapsedSeconds float64                        `json:"elapsed_seconds"`
	Host           *host.InfoStat                 `json:"host,omitempty"`
	CPU            []cpu.InfoStat                 `json:"cpu_info,omitempty"`
	CPUUsage       []float64                      `json:"cpu_usage"`
	Load           *load.AvgStat                  `json:"load,omitempty"`
	Memory         *mem.VirtualMemoryStat         `json:"memory,omitempty"`
	Swap           *mem.SwapMemoryStat            `json:"swap,omitempty"`
	Disks          []Disk                         `json:"disks"`
	DiskIO         map[string]disk.IOCountersStat `json:"disk_io,omitempty"`
	Interfaces     []Interface                    `json:"interfaces"`
	TCP            int                            `json:"tcp"`
	UDP            int                            `json:"udp"`
	Processes      int                            `json:"processes"`
	GPU            []GPU                          `json:"gpu,omitempty"`
	Goroutines     int                            `json:"goroutines"`
	GoHeap         uint64                         `json:"go_heap"`
	GCCount        uint32                         `json:"gc_count"`
	GCPauseNanos   uint64                         `json:"gc_pause_nanos"`
	Errors         map[string]string              `json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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