Documentation ¶
Overview ¶
The reporter package provides a simple interface to generating Geneos dataviews, with headlines and a data table, either though the XML-RPC API, as Toolkit compatible CSV, XLSX workbooks or a number of other formats.
Index ¶
- Constants
- type APIReporter
- type APIReporterOptions
- func APIEntity(entity string) APIReporterOptions
- func APIHostname(hostname string) APIReporterOptions
- func APIMaxRows(n int) APIReporterOptions
- func APIPort(port int) APIReporterOptions
- func APISampler(sampler string) APIReporterOptions
- func APISecure(secure bool) APIReporterOptions
- func APISkipVerify(skip bool) APIReporterOptions
- func DataviewCreateDelay(delay time.Duration) APIReporterOptions
- func ResetDataviews(reset bool) APIReporterOptions
- func ScrambleDataviews(scramble bool) APIReporterOptions
- type ConditionalFormat
- type ConditionalFormatSet
- type ConditionalFormatTest
- type FormattedReporter
- func (t *FormattedReporter) AddHeadline(name, value string)
- func (t *FormattedReporter) Close()
- func (t *FormattedReporter) Prepare(report Report) error
- func (t *FormattedReporter) Remove(report Report) (err error)
- func (t *FormattedReporter) Render()
- func (t *FormattedReporter) UpdateTable(columns []string, data [][]string)
- type FormattedReporterOptions
- func DataviewCSSClass(cssclass string) FormattedReporterOptions
- func HTMLPostscript(postscript string) FormattedReporterOptions
- func HTMLPreamble(preamble string) FormattedReporterOptions
- func HeadlineCSSClass(cssclass string) FormattedReporterOptions
- func RenderAs(renderas string) FormattedReporterOptions
- func Scramble(scramble bool) FormattedReporterOptions
- func Writer(w io.Writer) FormattedReporterOptions
- type Report
- type Reporter
- type ReporterCommon
- type ReporterOptions
- type ToolkitReporter
- func (t *ToolkitReporter) AddHeadline(name, value string)
- func (t *ToolkitReporter) Close()
- func (t *ToolkitReporter) Prepare(report Report) error
- func (t *ToolkitReporter) Remove(report Report) (err error)
- func (t *ToolkitReporter) Render()
- func (t *ToolkitReporter) UpdateTable(columns []string, data [][]string)
- type XLSXReporter
- func (x *XLSXReporter) AddHeadline(name, value string)
- func (x *XLSXReporter) Close()
- func (x *XLSXReporter) Prepare(report Report) (err error)
- func (x *XLSXReporter) Remove(report Report) (err error)
- func (x *XLSXReporter) Render()
- func (x *XLSXReporter) UpdateTable(columns []string, data [][]string)
- type XLSXReporterOptions
- func DateFormat(dateFormat string) XLSXReporterOptions
- func IntFormat(format int) XLSXReporterOptions
- func MaxColumnWidth(n float64) XLSXReporterOptions
- func MinColumnWidth(n float64) XLSXReporterOptions
- func PercentFormat(format int) XLSXReporterOptions
- func SeverityColours(undefined, ok, warning, critical string) XLSXReporterOptions
- func SummarySheetName(name string) XLSXReporterOptions
- func XLSXHeadlines(headlines int) XLSXReporterOptions
- func XLSXPassword(password *config.Plaintext) XLSXReporterOptions
- func XLSXScramble(scramble bool) XLSXReporterOptions
Constants ¶
const ( XLSXHeadlinesNone = iota XLSXHeadlinesVertical XLSXHeadlinesHorizontal )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIReporter ¶
type APIReporter struct {
// contains filtered or unexported fields
}
An APIReporter connects to a Geneos Netprobe using the XML-RPC API and publishes Dataview with optional Headlines
func (*APIReporter) AddHeadline ¶
func (a *APIReporter) AddHeadline(name, value string)
func (*APIReporter) Close ¶
func (a *APIReporter) Close()
func (*APIReporter) Prepare ¶
func (a *APIReporter) Prepare(report Report) (err error)
Prepare sets the Dataview group and title from the report structure passed. err is returned if the connection fails or the name is invalid. Note that in the Geneos api sampler the group and title must be different.
func (*APIReporter) Remove ¶
func (a *APIReporter) Remove(report Report) error
func (*APIReporter) Render ¶
func (a *APIReporter) Render()
func (*APIReporter) UpdateTable ¶
func (a *APIReporter) UpdateTable(columns []string, data [][]string)
UpdateTable takes a table of data in the form of a slice of slices of strings and writes them to the configured APIReporter. The first slice must be the column names. UpdateTable replaces all existing data in the Dataview.
type APIReporterOptions ¶
type APIReporterOptions func(*apiReportOptions)
func APIEntity ¶
func APIEntity(entity string) APIReporterOptions
func APIHostname ¶
func APIHostname(hostname string) APIReporterOptions
func APIMaxRows ¶
func APIMaxRows(n int) APIReporterOptions
func APIPort ¶
func APIPort(port int) APIReporterOptions
func APISampler ¶
func APISampler(sampler string) APIReporterOptions
func APISecure ¶
func APISecure(secure bool) APIReporterOptions
func APISkipVerify ¶
func APISkipVerify(skip bool) APIReporterOptions
func DataviewCreateDelay ¶
func DataviewCreateDelay(delay time.Duration) APIReporterOptions
func ResetDataviews ¶
func ResetDataviews(reset bool) APIReporterOptions
func ScrambleDataviews ¶
func ScrambleDataviews(scramble bool) APIReporterOptions
type ConditionalFormat ¶
type ConditionalFormat struct { Test ConditionalFormatTest `mapstructure:"test,omitempty"` Set []ConditionalFormatSet `mapstructure:"set,omitempty"` }
type ConditionalFormatSet ¶
type ConditionalFormatTest ¶
type ConditionalFormatTest struct { Columns []string `mapstructure:"columns,omitempty"` Logical string `mapstructure:"logical,omitempty"` // "and", "all" or "or", "any" Condition string `mapstructure:"condition,omitempty"` Type string `mapstructure:"type,omitempty"` Value string `mapstructure:"value,omitempty"` }
type FormattedReporter ¶
type FormattedReporter struct { ReporterCommon // contains filtered or unexported fields }
func (*FormattedReporter) AddHeadline ¶
func (t *FormattedReporter) AddHeadline(name, value string)
func (*FormattedReporter) Close ¶
func (t *FormattedReporter) Close()
func (*FormattedReporter) Prepare ¶
func (t *FormattedReporter) Prepare(report Report) error
func (*FormattedReporter) Remove ¶
func (t *FormattedReporter) Remove(report Report) (err error)
func (*FormattedReporter) Render ¶
func (t *FormattedReporter) Render()
Render sends the collected report data to the underlying table.Writer as on table of headlines and another or table data
func (*FormattedReporter) UpdateTable ¶
func (t *FormattedReporter) UpdateTable(columns []string, data [][]string)
type FormattedReporterOptions ¶
type FormattedReporterOptions func(*formattedReporterOptions)
func DataviewCSSClass ¶
func DataviewCSSClass(cssclass string) FormattedReporterOptions
func HTMLPostscript ¶
func HTMLPostscript(postscript string) FormattedReporterOptions
func HTMLPreamble ¶
func HTMLPreamble(preamble string) FormattedReporterOptions
func HeadlineCSSClass ¶
func HeadlineCSSClass(cssclass string) FormattedReporterOptions
func RenderAs ¶
func RenderAs(renderas string) FormattedReporterOptions
func Scramble ¶
func Scramble(scramble bool) FormattedReporterOptions
func Writer ¶
func Writer(w io.Writer) FormattedReporterOptions
type Report ¶
type Report struct { Name string `mapstructure:"report"` Title string `mapstructure:"name"` Columns []string `mapstructure:"columns,omitempty"` ScrambleColumns []string `mapstructure:"scramble-columns,omitempty"` Dataview struct { Group string `mapstructure:"group,omitempty"` Enable *bool `mapstructure:"enable,omitempty"` } `mapstructure:"dataview,omitempty"` XLSX struct { // xlsx specific Enable *bool `mapstructure:"enable,omitempty"` FreezeColumn string `mapstructure:"freeze-to-column"` ConditionalFormat []ConditionalFormat `mapstructure:"conditional-format,omitempty"` } `mapstructure:"xlsx,omitempty"` }
type Reporter ¶
type Reporter interface { // Prepare initialises the current report and must be called before AddHeadline() or UpdateTable() Prepare(report Report) error // AddHeadline adds a single headline to the current report dataview / sheet etc. AddHeadline(name, value string) // UpdateTable sets the main data table to the rows given. The first row must be the column names. UpdateTable(headings []string, rows [][]string) // Remove deletes an existing report, e.g. an existing Dataview from a previous run Remove(report Report) error // Render writes the current report to the destination selected with Prepare() Render() // Close releases any resources for the whole reporter Close() }
func NewReporter ¶
NewReporter returns a reporter for type t, which must be one of "toolkit", "csv", "api", "dataview", "xlsx", "table" or "html". If a destination writer is appropriate for the reporter type, then w should be the io.Writer to use. options are a list of options of either ReporterOptions or the options for the selected reporter type.
type ReporterCommon ¶
type ReporterCommon struct {
// contains filtered or unexported fields
}
type ReporterOptions ¶
type ReporterOptions func(*reporterOptions)
func ScrambleColumns ¶
func ScrambleColumns(columns []string) ReporterOptions
func ScrambleFunc ¶
func ScrambleFunc(fn func(in string) string) ReporterOptions
type ToolkitReporter ¶
type ToolkitReporter struct { ReporterCommon // contains filtered or unexported fields }
func (*ToolkitReporter) AddHeadline ¶
func (t *ToolkitReporter) AddHeadline(name, value string)
AddHeadline writes a Geneos Toolkit formatted headline to the reporter.
func (*ToolkitReporter) Close ¶
func (t *ToolkitReporter) Close()
Close will call Close on the writer if it has a Close method
func (*ToolkitReporter) Prepare ¶
func (t *ToolkitReporter) Prepare(report Report) error
func (*ToolkitReporter) Remove ¶
func (t *ToolkitReporter) Remove(report Report) (err error)
func (*ToolkitReporter) Render ¶
func (t *ToolkitReporter) Render()
func (*ToolkitReporter) UpdateTable ¶
func (t *ToolkitReporter) UpdateTable(columns []string, data [][]string)
type XLSXReporter ¶
type XLSXReporter struct { ReporterCommon // contains filtered or unexported fields }
func (*XLSXReporter) AddHeadline ¶
func (x *XLSXReporter) AddHeadline(name, value string)
func (*XLSXReporter) Close ¶
func (x *XLSXReporter) Close()
func (*XLSXReporter) Prepare ¶
func (x *XLSXReporter) Prepare(report Report) (err error)
func (*XLSXReporter) Remove ¶
func (x *XLSXReporter) Remove(report Report) (err error)
func (*XLSXReporter) Render ¶
func (x *XLSXReporter) Render()
func (*XLSXReporter) UpdateTable ¶
func (x *XLSXReporter) UpdateTable(columns []string, data [][]string)
type XLSXReporterOptions ¶
type XLSXReporterOptions func(*xlsxReportOptions)
func DateFormat ¶
func DateFormat(dateFormat string) XLSXReporterOptions
func IntFormat ¶
func IntFormat(format int) XLSXReporterOptions
func MaxColumnWidth ¶
func MaxColumnWidth(n float64) XLSXReporterOptions
func MinColumnWidth ¶
func MinColumnWidth(n float64) XLSXReporterOptions
func PercentFormat ¶
func PercentFormat(format int) XLSXReporterOptions
func SeverityColours ¶
func SeverityColours(undefined, ok, warning, critical string) XLSXReporterOptions
func SummarySheetName ¶
func SummarySheetName(name string) XLSXReporterOptions
func XLSXHeadlines ¶
func XLSXHeadlines(headlines int) XLSXReporterOptions
XLSXHeadlines sets visibility and the direction of headlines in a sheet. The default is not to include headlines. If passed XLSXHeadlinesVertical then the headlines are added as a two column list of name/value pairs. If passed XLSXHeadlinesHorizontal then headlines are added as two rows with each headlines added as a single column, name above value.
func XLSXPassword ¶
func XLSXPassword(password *config.Plaintext) XLSXReporterOptions
XLSXPassword sets the workbook password
func XLSXScramble ¶
func XLSXScramble(scramble bool) XLSXReporterOptions