someta

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidMonitor

func IsValidMonitor(name string) bool

IsValidMonitor returns a bool indicating whether the string is the name of a valid monitor

func Monitors

func Monitors() []string

Monitors returns a slice of monitor names

Types

type CPUMetadata

type CPUMetadata struct {
	Timestamp time.Time          `json:"timestamp"`
	CPU       map[string]float64 `json:"cpuidle"`
}

CPUMetadata encapsulates what it says

type CPUMonitor

type CPUMonitor struct {
	Monitor
	Data []CPUMetadata `json:"data"`
}

CPUMonitor collects cpu usage metadata

func (*CPUMonitor) CheckConfig

func (c *CPUMonitor) CheckConfig(name string, conf MonitorConf)

CheckConfig does some basic sanity checking on the configuration

func (*CPUMonitor) DefaultConfig added in v1.4.0

func (c *CPUMonitor) DefaultConfig() *MonitorConf

DefaultConfig returns a default config or nil if no default

func (*CPUMonitor) Flush

func (c *CPUMonitor) Flush(encoder *json.Encoder) error

Flush will write any current metadata to the writer

func (*CPUMonitor) Init

func (c *CPUMonitor) Init(name string, verbose bool, defaultInterval time.Duration, config MonitorConf) error

Init initializes a CPUMonitor

func (*CPUMonitor) Run

func (c *CPUMonitor) Run(ctx context.Context) error

Run runs the cpu monitor; this should be invoked in a goroutine

type CmdLineToolMetadata added in v1.3.4

type CmdLineToolMetadata struct {
	Timestamp  time.Time `json:"timestamp"`
	ToolOutput string    `json:"tooloutput"`
}

CmdLineToolMetadata encapsulates what it says

type CmdLineToolMonitor added in v1.3.4

type CmdLineToolMonitor struct {
	Monitor
	CmdLineToolOptions []string              `json:"cmdlineoptions"`
	Data               []CmdLineToolMetadata `json:"data"`
}

CmdLineToolMonitor collects metadata from the linux ss tool

func (*CmdLineToolMonitor) CheckConfig added in v1.3.4

func (c *CmdLineToolMonitor) CheckConfig(name string, conf MonitorConf)

CheckConfig does some basic sanity checking on the configuration

func (*CmdLineToolMonitor) DefaultConfig added in v1.4.0

func (c *CmdLineToolMonitor) DefaultConfig() *MonitorConf

DefaultConfig returns a default config or nil if no default

func (*CmdLineToolMonitor) Flush added in v1.3.4

func (c *CmdLineToolMonitor) Flush(encoder *json.Encoder) error

Flush will write any current metadata to the writer

func (*CmdLineToolMonitor) Init added in v1.3.4

func (c *CmdLineToolMonitor) Init(name string, verbose bool, defaultInterval time.Duration, config MonitorConf) error

Init initializes an CmdLineToolMonitor

func (*CmdLineToolMonitor) Run added in v1.3.4

Run runs the netstat monitor; this should be invoked in a goroutine

type IOMetadata

type IOMetadata struct {
	Timestamp time.Time                      `json:"timestamp"`
	Counters  map[string]disk.IOCountersStat `json:"counters"`
}

IOMetadata encapsulates what it says

type IOMonitor

type IOMonitor struct {
	Monitor
	Data []IOMetadata `json:"data"`
	// contains filtered or unexported fields
}

IOMonitor collects io/disk usage metadata

func (*IOMonitor) CheckConfig

func (i *IOMonitor) CheckConfig(name string, conf MonitorConf)

CheckConfig does some basic sanity checking on the configuration

func (*IOMonitor) DefaultConfig added in v1.4.0

func (i *IOMonitor) DefaultConfig() *MonitorConf

DefaultConfig returns a default config or nil if no default

func (*IOMonitor) Flush

func (i *IOMonitor) Flush(encoder *json.Encoder) error

Flush will write any current metadata to the writer

func (*IOMonitor) Init

func (i *IOMonitor) Init(name string, verbose bool, defaultInterval time.Duration, config MonitorConf) error

Init initializes an IOMonitor

func (*IOMonitor) Run

func (i *IOMonitor) Run(ctx context.Context) error

Run runs the memory monitor; this should be invoked in a goroutine

type MemoryMetadata

type MemoryMetadata struct {
	Timestamp   time.Time `json:"timestamp"`
	UsedPercent float64   `json:"percent_used"`
}

MemoryMetadata encapsulates what it says

type MemoryMonitor

type MemoryMonitor struct {
	Monitor
	Data []MemoryMetadata `json:"data"`
}

MemoryMonitor collects memory usage metadata

func (*MemoryMonitor) CheckConfig

func (m *MemoryMonitor) CheckConfig(name string, conf MonitorConf)

CheckConfig does some basic sanity checking on the configuration

func (*MemoryMonitor) DefaultConfig added in v1.4.0

func (m *MemoryMonitor) DefaultConfig() *MonitorConf

DefaultConfig returns a default config or nil if no default

func (*MemoryMonitor) Flush

func (m *MemoryMonitor) Flush(encoder *json.Encoder) error

Flush will write any current metadata to the writer

func (*MemoryMonitor) Init

func (m *MemoryMonitor) Init(name string, verbose bool, defaultInterval time.Duration, config MonitorConf) error

Init initialize a MemoryMonitor

func (*MemoryMonitor) Run

func (m *MemoryMonitor) Run(ctx context.Context) error

Run runs the memory monitor; this should be invoked in a goroutine

type MetadataGenerator

type MetadataGenerator interface {
	Init(string, bool, time.Duration, MonitorConf) error
	Run(context.Context) error
	Flush(*json.Encoder) error
	CheckConfig(string, MonitorConf)
	DefaultConfig() *MonitorConf
}

MetadataGenerator is the interface that all metadata sources must adhere to

func GetMonitor

func GetMonitor(name string) MetadataGenerator

GetMonitor returns a pointer to a MetadataGenerator given a name, or nil if no such monitor exists

func NewCPUMonitor

func NewCPUMonitor() MetadataGenerator

NewCPUMonitor creates and returns a new CPUMonitor

func NewCmdLineToolMonitor added in v1.3.4

func NewCmdLineToolMonitor() MetadataGenerator

NewCmdLineToolMonitor creates and returns a new NetstatMonitor

func NewIOMonitor

func NewIOMonitor() MetadataGenerator

NewIOMonitor creates and returns a new IOMonitor

func NewMemoryMonitor

func NewMemoryMonitor() MetadataGenerator

NewMemoryMonitor creates and returns a new MemoryMonitor

func NewNetstatMonitor

func NewNetstatMonitor() MetadataGenerator

NewNetstatMonitor creates and returns a new NetstatMonitor

func NewRTTMonitor

func NewRTTMonitor() MetadataGenerator

NewRTTMonitor creates and returns a new RTTMonitor

func NewSsMonitor

func NewSsMonitor() MetadataGenerator

NewSsMonitor creates and returns a new NetstatMonitor

type Monitor

type Monitor struct {
	Name string `json:"name"`
	Kind string `json:"type"` // v1.3 change external name to Kind; keep json as type for back compat
	// contains filtered or unexported fields
}

Monitor encapsulates elements common to all monitors

type MonitorConf

type MonitorConf struct {
	Kind     string        // all monitors
	Interval time.Duration // all monitors
	Device   []string      // netstat, io, rtt
	RttType  string        // rtt
	Dest     string        // rtt
	MaxTTL   int           // rtt
	AllHops  bool          // rtt
	CmdOpts  []string      // ss, cmdlinetool
}

MonitorConf defines a configuration for a monitor

func MonitorConfFromStringMap

func MonitorConfFromStringMap(kind string, strconfig map[string]string) (MonitorConf, error)

MonitorConfFromStringMap constructs a MonitorConf from a str map from command line

func (*MonitorConf) String

func (m *MonitorConf) String() string

String method - a slightly nicer repr of MonitorConf

type NetstatMetadata

type NetstatMetadata struct {
	Timestamp time.Time                     `json:"timestamp"`
	Netstat   map[string]net.IOCountersStat `json:"netstat"`
}

NetstatMetadata encapsulates what it says

type NetstatMonitor

type NetstatMonitor struct {
	Monitor
	Data []NetstatMetadata `json:"data"`
	// contains filtered or unexported fields
}

NetstatMonitor collects network interface counters metadata

func (*NetstatMonitor) CheckConfig

func (n *NetstatMonitor) CheckConfig(name string, conf MonitorConf)

CheckConfig does some basic sanity checking on the configuration

func (*NetstatMonitor) DefaultConfig added in v1.4.0

func (n *NetstatMonitor) DefaultConfig() *MonitorConf

DefaultConfig returns a default config or nil if no default

func (*NetstatMonitor) Flush

func (n *NetstatMonitor) Flush(encoder *json.Encoder) error

Flush will write any current metadata to the writer

func (*NetstatMonitor) Init

func (n *NetstatMonitor) Init(name string, verbose bool, defaultInterval time.Duration, config MonitorConf) error

Init initializes a NetstatMonitor

func (*NetstatMonitor) Run

func (n *NetstatMonitor) Run(ctx context.Context) error

Run runs the netstat monitor; this should be invoked in a goroutine

type RTTMetadata

type RTTMetadata struct {
	Probes        []probe    `json:"probes"`
	PcapStats     pcap.Stats `json:"libpcap_stats"`
	Protocol      string     `json:"protocol"`
	Probetype     string     `json:"probetype"`
	TotalEmitted  int64      `json:"total_probes_emitted"`
	TotalReceived int64      `json:"total_probes_received"`
	ProbeAllHops  bool       `json:"probe_all_hops"`
	MaxTTL        int        `json:"maxttl"`
	IPDest        string     `json:"dest"`
}

RTTMetadata is a slice of probe samples. It implements sort.Interface

func (*RTTMetadata) Append

func (r *RTTMetadata) Append(p *probe)

Append appends a probe record to the metadata

func (*RTTMetadata) Len

func (r *RTTMetadata) Len() int

Len returns the number of probe samples

func (*RTTMetadata) Less

func (r *RTTMetadata) Less(i, j int) bool

Less returns true if probe sample i has a send time < probe sample j

func (*RTTMetadata) Swap

func (r *RTTMetadata) Swap(i, j int)

Swap swaps two probe samples in the slice

type RTTMonitor

type RTTMonitor struct {
	Monitor
	RTTMetadata
	// contains filtered or unexported fields
}

RTTMonitor collects RTT samples using ICMP

func (*RTTMonitor) CheckConfig

func (r *RTTMonitor) CheckConfig(name string, conf MonitorConf)

CheckConfig does some basic sanity checking on the configuration

func (*RTTMonitor) DefaultConfig added in v1.4.0

func (r *RTTMonitor) DefaultConfig() *MonitorConf

DefaultConfig returns a default config or nil if no default

func (*RTTMonitor) Flush

func (r *RTTMonitor) Flush(encoder *json.Encoder) error

Flush will write any current metadata to the writer

func (*RTTMonitor) Init

func (r *RTTMonitor) Init(name string, verbose bool, defaultInterval time.Duration, conf MonitorConf) error

Init initializes an RTT monitor

func (*RTTMonitor) Run

func (r *RTTMonitor) Run(ctx context.Context) error

Run runs the RTT monitor; this should be invoked in a goroutine

type SsMetadata

type SsMetadata struct {
	Timestamp time.Time `json:"timestamp"`
	Ss        string    `json:"info"`
}

SsMetadata encapsulates what it says

type SsMonitor

type SsMonitor struct {
	Monitor
	SsOptions string       `json:"ssoptions"`
	Data      []SsMetadata `json:"data"`
}

SsMonitor collects metadata from the linux ss tool

func (*SsMonitor) CheckConfig

func (s *SsMonitor) CheckConfig(name string, conf MonitorConf)

CheckConfig does some basic sanity checking on the configuration

func (*SsMonitor) DefaultConfig added in v1.4.0

func (s *SsMonitor) DefaultConfig() *MonitorConf

DefaultConfig returns a default config or nil if no default

func (*SsMonitor) Flush

func (s *SsMonitor) Flush(encoder *json.Encoder) error

Flush will write any current metadata to the writer

func (*SsMonitor) Init

func (s *SsMonitor) Init(name string, verbose bool, defaultInterval time.Duration, config MonitorConf) error

Init initializes an SsMonitor

func (*SsMonitor) Run

func (s *SsMonitor) Run(ctx context.Context) error

Run runs the netstat monitor; this should be invoked in a goroutine

Jump to

Keyboard shortcuts

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