Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type History ¶
History represents the ping history for a single node/device.
func NewHistory ¶
NewHistory creates a new History object with a specific capacity.
func (*History) ComputeAndClear ¶
ComputeAndClear aggregates the result history into a single data point and clears the result set.
type Metrics ¶
type Metrics struct { PacketsSent int // number of packets sent PacketsLost int // number of packets lost Best time.Duration // best rtt Worst time.Duration // worst rtt Median time.Duration // median rtt Mean time.Duration // mean rtt StdDev time.Duration // std deviation }
Metrics is a dumb data point computed from a history of Results.
type Monitor ¶
type Monitor struct { HistorySize int // Number of results per target to keep PayloadSize uint16 Privileged bool // contains filtered or unexported fields }
Monitor manages the goroutines responsible for collecting Ping RTT data.
func New ¶
New creates and configures a new Ping instance. You need to call AddTarget()/RemoveTarget() to manage monitored targets.
func (*Monitor) AddTarget ¶
AddTarget adds a target to the monitored list. If the target with the given ID already exists, it is removed first and then readded. This allows the easy restart of the monitoring.
func (*Monitor) Export ¶
Export calculates the metrics for each monitored target and returns it as a simple map.
func (*Monitor) RemoveTarget ¶
RemoveTarget removes a target from the monitoring list.