Documentation ¶
Index ¶
- type Columns
- type SamplerInstance
- type Samplers
- func (s *Samplers) Close() error
- func (s Samplers) ColumnInfo(rowdata interface{}) (cols Columns, columnnames []string, sorting string, err error)
- func (p Samplers) ColumnNames() []string
- func (p Samplers) Columns() Columns
- func (p Samplers) Interval() time.Duration
- func (s *Samplers) New(p plugins.Connection, name string, group string) error
- func (s Samplers) RowsFromMap(rowdata interface{}) (rows [][]string, err error)
- func (s Samplers) RowsFromMapDelta(newrowdata, oldrowdata interface{}, interval time.Duration) (rows [][]string, err error)
- func (s Samplers) RowsFromSlice(rowdata interface{}) (rows [][]string, err error)
- func (p *Samplers) SetColumnNames(columnnames []string)
- func (p *Samplers) SetColumns(columns Columns)
- func (p *Samplers) SetInterval(interval time.Duration)
- func (p *Samplers) SetSortColumn(column string)
- func (p Samplers) SortColumn() string
- func (p *Samplers) Start(wg *sync.WaitGroup) (err error)
- func (s *Samplers) UpdateTableFromMap(data interface{}) error
- func (s *Samplers) UpdateTableFromMapDelta(newdata, olddata interface{}, interval time.Duration) error
- func (s Samplers) UpdateTableFromSlice(rowdata interface{}) error
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 ¶
All plugins share common settings
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 (Samplers) RowsFromMap ¶
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 ¶
RowsFromSlice - results are not resorted, they are assumed to be in the order required
func (*Samplers) SetColumnNames ¶
func (*Samplers) SetColumns ¶
func (*Samplers) SetInterval ¶
func (*Samplers) SetSortColumn ¶
func (Samplers) SortColumn ¶
func (*Samplers) UpdateTableFromMap ¶
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 ¶
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