cmd

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SummaryPath = "licensing/licences.csv"
	DetailsPath = "licensing/all_licences.csv"
)

Variables

View Source
var GDNACmd = &cobra.Command{
	Use:   "gdna [FLAGS...]",
	Short: "Process Geneos License Usage Data",
	Long:  rootCmdDescription,
	Args:  cobra.ArbitraryArgs,
	CompletionOptions: cobra.CompletionOptions{
		DisableDefaultCmd: true,
	},
	Version:               cordial.VERSION,
	DisableAutoGenTag:     true,
	DisableSuggestions:    true,
	DisableFlagsInUseLine: true,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
		if daemon {
			return process.Daemon(nil, process.RemoveArgs, "-D", "--daemon")
		}

		initConfig(cmd)

		if !cf.IsSet("gdna.version") {
			cf.Set("gdna.version", cordial.VERSION)
		}

		return
	},
}

GDNACmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type APIReporter added in v1.15.0

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 NewAPIReporter added in v1.15.0

func NewAPIReporter(cf *config.Config, options ...APIReporterOptions) (a *APIReporter, err error)

NewAPIReporter returns a new APIReporter using the following configuration settings from cf:

* `geneos.netprobe.hostname`

* `geneos.netprobe.port`

* `geneos.netprobe.secure`

* `geneos.netprobe.skip-verify`

* `geneos.entity`

* `geneos.sampler`

If reset is true then Dataviews are reset on the first use from SetReport()

func (*APIReporter) Close added in v1.15.0

func (a *APIReporter) Close()

func (*APIReporter) Render added in v1.15.0

func (a *APIReporter) Render()

func (*APIReporter) SetReport added in v1.15.0

func (a *APIReporter) SetReport(report Report) (err error)

SetReport 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) WriteHeadline added in v1.15.0

func (a *APIReporter) WriteHeadline(name, value string)

func (*APIReporter) WriteTable added in v1.15.0

func (a *APIReporter) WriteTable(data ...[]string)

WriteTable 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. WriteTable replaces all existing data in the Dataview.

type APIReporterOptions added in v1.15.0

type APIReporterOptions func(*apiReporterOptions)

func ResetDataviews added in v1.15.0

func ResetDataviews(reset bool) APIReporterOptions

func ScrambleDataviews added in v1.15.0

func ScrambleDataviews(scramble bool) APIReporterOptions

type ConditionalFormat added in v1.15.0

type ConditionalFormat struct {
	Test ConditionalFormatTest  `mapstructure:"test,omitempty"`
	Set  []ConditionalFormatSet `mapstructure:"set,omitempty"`
}

type ConditionalFormatSet added in v1.15.0

type ConditionalFormatSet struct {
	Rows    string   `mapstructure:"rows,omitempty"`
	NotRows string   `mapstructure:"not-rows,omitempty"`
	Columns []string `mapstructure:"columns,omitempty"`
	Format  string   `mapstructure:"format,omitempty"`
}

type ConditionalFormatTest added in v1.15.0

type ConditionalFormatTest struct {
	Columns   []string `mapstructure:"columns,omitempty"`
	Condition string   `mapstructure:"condition,omitempty"`
	Type      string   `mapstructure:"type,omitempty"`
	Value     string   `mapstructure:"value,omitempty"`
}

type FormattedReporter added in v1.15.0

type FormattedReporter struct {
	// contains filtered or unexported fields
}

func NewFormattedReporter added in v1.15.0

func NewFormattedReporter(w io.Writer, options ...FormattedReporterOptions) (tr *FormattedReporter)

NewFormattedReporter returns a new Table reporter

func (*FormattedReporter) Close added in v1.15.0

func (t *FormattedReporter) Close()

func (*FormattedReporter) Render added in v1.15.0

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) SetReport added in v1.15.0

func (t *FormattedReporter) SetReport(report Report) error

func (*FormattedReporter) UpdateReporter added in v1.15.0

func (tr *FormattedReporter) UpdateReporter(options ...FormattedReporterOptions)

func (*FormattedReporter) WriteHeadline added in v1.15.0

func (t *FormattedReporter) WriteHeadline(name, value string)

func (*FormattedReporter) WriteTable added in v1.15.0

func (t *FormattedReporter) WriteTable(data ...[]string)

type FormattedReporterOptions added in v1.15.0

type FormattedReporterOptions func(*formattedReporterOptions)

func DataviewCSSClass added in v1.15.0

func DataviewCSSClass(cssclass string) FormattedReporterOptions

func HTMLPostscript added in v1.15.0

func HTMLPostscript(postscript string) FormattedReporterOptions

func HTMLPreamble added in v1.15.0

func HTMLPreamble(preamble string) FormattedReporterOptions

func HeadlineCSSClass added in v1.15.0

func HeadlineCSSClass(cssclass string) FormattedReporterOptions

func RenderAs added in v1.15.0

func RenderAs(renderas string) FormattedReporterOptions

func Scramble added in v1.15.0

func Scramble(scramble bool) FormattedReporterOptions

func WriteTo added in v1.15.0

type Report

type Report struct {
	Name              string   `mapstructure:"name"`
	Group             string   `mapstructure:"group,omitempty"`
	Columns           []string `mapstructure:"columns,omitempty"`
	EnableForDataview *bool    `mapstructure:"enable-for-dataview,omitempty"`
	EnableForXLSX     *bool    `mapstructure:"enable-for-xlsx,omitempty"`
	FreezeColumn      string   `mapstructure:"freeze-to-column"`
	ScrambleColumns   []string `mapstructure:"scramble-columns,omitempty"`
	Type              string   `mapstructure:"type,omitempty"`
	Query             string   `mapstructure:"query,omitempty"`
	Headlines         string   `mapstructure:"headlines,omitempty"`

	Grouping      string   `mapstructure:"grouping,omitempty"`
	GroupingOrder []string `mapstructure:"grouping-order,omitempty"`

	ConditionalFormat []ConditionalFormat `mapstructure:"conditional-format,omitempty"`

	// when Type = "split" then
	SplitColumn string `mapstructure:"split-column,omitempty"`
	SplitValues string `mapstructure:"split-values-query,omitempty"`
}

type Reporter added in v1.15.0

type Reporter interface {
	SetReport(report Report) error
	WriteTable(rows ...[]string)
	WriteHeadline(name, value string)
	Render()
	Close()
}

type ToolkitReporter added in v1.15.0

type ToolkitReporter struct {
	// contains filtered or unexported fields
}

func NewToolkitReporter added in v1.15.0

func NewToolkitReporter(w io.Writer) *ToolkitReporter

func (*ToolkitReporter) Close added in v1.15.0

func (c *ToolkitReporter) Close()

func (*ToolkitReporter) Render added in v1.15.0

func (t *ToolkitReporter) Render()

func (*ToolkitReporter) SetReport added in v1.15.0

func (t *ToolkitReporter) SetReport(report Report) error

func (*ToolkitReporter) WriteHeadline added in v1.15.0

func (t *ToolkitReporter) WriteHeadline(name, value string)

WriteHeadline writes a Geneos Toolkit formatted headline to the reporter.

func (*ToolkitReporter) WriteTable added in v1.15.0

func (t *ToolkitReporter) WriteTable(data ...[]string)

type XLSXReporter added in v1.15.0

type XLSXReporter struct {
	// contains filtered or unexported fields
}

func NewXLSXReporter added in v1.15.0

func NewXLSXReporter(w io.Writer, scramble bool, password *config.Plaintext) (x *XLSXReporter)

NewTableReporter returns a new Table reporter

func (*XLSXReporter) Close added in v1.15.0

func (x *XLSXReporter) Close()

func (*XLSXReporter) Render added in v1.15.0

func (x *XLSXReporter) Render()

func (*XLSXReporter) SetReport added in v1.15.0

func (x *XLSXReporter) SetReport(report Report) (err error)

func (*XLSXReporter) WriteHeadline added in v1.15.0

func (x *XLSXReporter) WriteHeadline(name, value string)

func (*XLSXReporter) WriteTable added in v1.15.0

func (x *XLSXReporter) WriteTable(data ...[]string)

Jump to

Keyboard shortcuts

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