xmlrpc

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: 11 Imported by: 0

README

xmlrpc

The xmlrpc package is the low level implementation of an ITRS Geneox XML-RPC client API to communicate with a Netprobe.

The package implements structs that keep the minimum state data. No state is kept regarding the data being sent to the Netprobe.

The files in this package have the following functions:

  • xmlrpc.go This file provides the NewClient() method and some common logging setup

    NewClient() is the initial entry point to create an xmlrpc.Client and it returns a Sampler struct. While there are lowe evels calls to check for the existance of specific Managed Entities and Samplers and also to check for Gateway connectivity, these are not normally exposed and used by common plugin code.

    The principal consumer of this method is the ConnectSampler method in the plugins package.

  • client.go The client.go file defines the Client struct which forms the common basic for other structs in this package. The principal method in this file is, oddly, NewSampler() which given a variable of type Client will return a more useful Sampler object.

  • sampler.go Sampler level struct and methods. The principal method is NewDataview() to create a new dataview on the given sampler. The NewDataview() method checks for and, if found, removes any dataview with the same name. The CreateDataview() method just does it directly, wuthout checking.

  • dataview.go Almost all data updates are done in this file. Creating and removing headlines, rows and creating columns are all done through here. You cannot remove columns using the API and so there is no mapping to an exported method to try the same.

    UpdateTable and AddRow/RemoveRow are the most likely to be used methods.

    Other methods provide a way to query the size of the dataview dimensions and names of rows, columns and headlines as per the published Geneos API.

  • streams.so The basic stream methods in a golang form.

  • rawapi.go All the methods in this file are unexported but map to the Netprobe API and API-Streams interface functions by name and including the list of arguments (some functions use separate args for entity and sampler, most a merged single argument). The only method not implemented is a deprecated function to create entities on ancient Gateway 1 systems.

    The API-Streams signOn and signOff functions have been renamed to not clash with the pricipal functions of the same name but with different argument paths. This shouldn't matter unless you intend to use them yourself.

  • internals.go Like the name suggests, internal methods to provide common code the the rawapi.go methods, including post() and a custom marshal() mthod.

    One change from the underlying API is that error messages are merged back into to golang type err as an int + string.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	http.Client
	// contains filtered or unexported fields
}

The Client struct carries the http Client and the url down to successive layers

func NewClient

func NewClient(url *url.URL, options ...Options) (c *Client)

func (Client) Connected added in v1.2.1

func (c Client) Connected() bool

Connected checks if the client is connected to a gateway.

func (*Client) InsecureSkipVerify added in v1.2.1

func (c *Client) InsecureSkipVerify()

func (Client) Sampler added in v1.2.1

func (c Client) Sampler(entityName string, samplerName string) (sampler Sampler, err error)

Sampler creates and returns a new Sampler struct from the lower level.

XXX At the moment there is no error checking or validation

func (Client) String

func (c Client) String() string

String conforms to the Stringer Type

type Dataview

type Dataview struct {
	Sampler
	// contains filtered or unexported fields
}

Dataview struct encapsulates the Sampler it belongs to and adds the name. The name is the aggregated for of [group]-name the "-" is always present

func (Dataview) AddColumn

func (d Dataview) AddColumn(column string) (err error)

func (Dataview) AddRow

func (d Dataview) AddRow(rowname string) (err error)

func (*Dataview) Close

func (d *Dataview) Close() (err error)

Close - currently a no-op. To remove a dataview use [Remove]

func (Dataview) ColumnExists added in v1.2.1

func (d Dataview) ColumnExists(column string) bool

func (Dataview) ColumnNames

func (d Dataview) ColumnNames() (columnnames []string, err error)

func (Dataview) CountColumns

func (d Dataview) CountColumns() (int, error)

func (Dataview) CountHeadlines

func (d Dataview) CountHeadlines() (int, error)

func (Dataview) CountRows

func (d Dataview) CountRows() (int, error)

func (Dataview) Exists added in v1.2.1

func (d Dataview) Exists() bool

Exists checks if the dataview exists

func (Dataview) Headline

func (d Dataview) Headline(headline string, args ...string) (err error)

func (Dataview) HeadlineExists added in v1.2.1

func (d Dataview) HeadlineExists(headline string) bool

func (Dataview) HeadlineNames

func (d Dataview) HeadlineNames() (headlinenames []string, err error)

func (*Dataview) Remove added in v1.2.1

func (d *Dataview) Remove() (err error)

Remove a dataview

func (Dataview) RemoveHeadline

func (d Dataview) RemoveHeadline(headline string) (err error)

func (Dataview) RemoveRow

func (d Dataview) RemoveRow(rowname string) (err error)

func (Dataview) RowExists added in v1.2.1

func (d Dataview) RowExists(rowname string) bool

func (Dataview) RowNames

func (d Dataview) RowNames() (rownames []string, err error)

func (Dataview) RowNamesOlderThan

func (d Dataview) RowNamesOlderThan(datetime time.Time) (rownames []string, err error)

func (Dataview) String

func (d Dataview) String() string

String returns a formatted view name

func (Dataview) UpdateCell

func (d Dataview) UpdateCell(rowname string, column string, value interface{}) (err error)

UpdateCell sets the value of an existing dataview cell given the row and column name The value is formatted using %v so this can be passed any concrete value

No validation is done on args

func (Dataview) UpdateRow

func (d Dataview) UpdateRow(rowname string, args ...interface{}) (err error)

func (Dataview) UpdateTable

func (d Dataview) UpdateTable(columns []string, values ...[]string) (err error)

UpdateTable replaces the contents of the dataview table but will not work if the column names have changed. The underlying API requires the caller to remove the original dataview unless you are simply adding new columns

The arguments are a mandatory slice of column names followed by any number of rows in the form of a variadic list of slices of strings

type Options added in v1.2.1

type Options func(*xmlrpcOptions)

func InsecureSkipVerify added in v1.2.1

func InsecureSkipVerify() Options

InsecureSkipVerify

type Sampler

type Sampler struct {
	Client
	// contains filtered or unexported fields
}

func (Sampler) Dataview added in v1.2.1

func (s Sampler) Dataview(groupName string, viewName string) (d *Dataview)

Dataview returns a Dataview on the current Sampler.

func (*Sampler) Exists added in v1.2.1

func (s *Sampler) Exists() bool

func (Sampler) Heartbeat

func (s Sampler) Heartbeat() error

Heartbeat sends a heartbeat to reset the watchdog timer activated by SignOn

func (Sampler) HeartbeatStream

func (s Sampler) HeartbeatStream(streamname string) error

func (Sampler) NewDataview

func (s Sampler) NewDataview(groupName string, viewName string, args ...[]string) (d *Dataview, err error)

NewDataview - Create a new Dataview on the Sampler with an optional initial table of data.

If supplied the data is in the form of rows, each of which is a slice of strings containing cell data. The first row must be the column names and the first string in each row must be the rowname (including the first row of column names).

The underlying API appears to accept incomplete data so you can just send a row of column names followed by each row only contains the first N columns each.

func (Sampler) Parameter

func (s Sampler) Parameter(name string) (string, error)

Parameter - Get a parameter from the Geneos sampler config as a string It would not be difficult to add numeric and other type getters

func (*Sampler) SignOff

func (s *Sampler) SignOff() error

SignOff and cancel the heartbeat requirement for the sampler

func (Sampler) SignOffStream

func (s Sampler) SignOffStream(streamname string) error

func (*Sampler) SignOn

func (s *Sampler) SignOn(heartbeat time.Duration) error

SignOn to the sampler with the interval given

func (Sampler) SignOnStream

func (s Sampler) SignOnStream(streamname string, heartbeat time.Duration) error

func (Sampler) String

func (s Sampler) String() string

String returns the Sampler name as a string

func (Sampler) WriteMessage

func (s Sampler) WriteMessage(streamname string, message string) (err error)

WriteMessage is the only function for a Stream that is data oriented. The others are administrative.

Jump to

Keyboard shortcuts

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