samplers

package
v1.1.6-beta Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Columns

type Columns map[string]columndetails

Columns is a common type for the map of rows for output.

type SamplerInstance

type SamplerInstance interface {
	New(plugins.Connection, string, string) *SamplerInstance
	InitSampler() (err error)
	DoSample() (err error)
}

type Samplers

type Samplers struct {
	plugins.Plugins
	*xmlrpc.Dataview
	// contains filtered or unexported fields
}

All plugins share common settings

func (*Samplers) Close

func (s *Samplers) Close() error

func (Samplers) ColumnInfo

func (s Samplers) ColumnInfo(rowdata interface{}) (cols Columns,
	columnnames []string, sorting string, err error)

ColumnInfo is a helper function that takes a (flat) struct as input and returns an ordered slice of column names ready to update a dataview. Normally called once per sampler during initialisation.

The column names are the display names in the struct tags or the field name otherwise. The internal method parsetags() is where the valid options are defined in detail. More docs to follow.

The input is a type or an zero-ed struct as this method only checks the struct tags and doesn't care about the data

func (Samplers) ColumnNames

func (p Samplers) ColumnNames() []string

func (Samplers) Columns

func (p Samplers) Columns() Columns

func (Samplers) Interval

func (p Samplers) Interval() time.Duration

func (*Samplers) New

func (s *Samplers) New(p *plugins.Connection, name string, group string) error

func (Samplers) RowsFromMap

func (s Samplers) RowsFromMap(rowdata interface{}) (rows [][]string, err error)

RowFromMap is a helper function that takes a tagged (flat) struct as input and formats a row (slice of strings) using tags. TBD, but selecting the rowname, the sorting, the format and type conversion, scaling and labels (percent, MB etc.)

The data passed should NOT include column heading slice as it will be regenerated from the Columns data

func (Samplers) RowsFromMapDelta

func (s Samplers) RowsFromMapDelta(newrowdata, oldrowdata interface{},
	interval time.Duration) (rows [][]string, err error)

RowsFromMapDelta takes two sets of data and calculates the difference between them. Only numeric data is changed, any non-numeric fields are left unchanged and taken from newrowdata only. If an interval is supplied (non-zero) then that is used as a scaling value otherwise the straight numeric difference is calculated

This is for data like sets of counters that are absolute values over time

func (Samplers) RowsFromSlice

func (s Samplers) RowsFromSlice(rowdata interface{}) (rows [][]string, err error)

RowsFromSlice - results are not resorted, they are assumed to be in the order required

func (*Samplers) SetColumnNames

func (p *Samplers) SetColumnNames(columnnames []string)

func (*Samplers) SetColumns

func (p *Samplers) SetColumns(columns Columns)

func (*Samplers) SetInterval

func (p *Samplers) SetInterval(interval time.Duration)

func (*Samplers) SetSortColumn

func (p *Samplers) SetSortColumn(column string)

func (Samplers) SortColumn

func (p Samplers) SortColumn() string

func (*Samplers) Start

func (p *Samplers) Start(wg *sync.WaitGroup) (err error)

func (*Samplers) UpdateTableFromMap

func (s *Samplers) UpdateTableFromMap(data interface{}) error

UpdateTableFromMap - Given a map of structs representing rows of data, render a simple table update by converting all data and sorting the rows by the sort column in the initialised ColumnNames member of the Sampler

Sorting the data is only to define the "natural sort order" of the data as it appears in a Geneos Dataview without further client-side sorting.

func (*Samplers) UpdateTableFromMapDelta

func (s *Samplers) UpdateTableFromMapDelta(newdata, olddata interface{}, interval time.Duration) error

UpdateTableFromMapDelta

func (Samplers) UpdateTableFromSlice

func (s Samplers) UpdateTableFromSlice(rowdata interface{}) error

UpdateTableFromSlice - Given an ordered slice of structs of data the method renders a simple table of data as defined in the Columns part of Samplers

Jump to

Keyboard shortcuts

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