xmlrpc

package
v1.0.5-pre Latest Latest
Warning

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

Go to latest
Published: Jul 15, 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

Overview

Copyright © 2022 ITRS Group

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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 (*Client) AllowUnverifiedCertificates

func (c *Client) AllowUnverifiedCertificates()

func (Client) IsValid

func (c Client) IsValid() bool

IsValid returns a boolean based on the semantics of the layer it's call against.

At the top Client level it checks if the Gateway is connected to the Netprobe, but further levels will test if the appropriate objects exist in the Netprobe

func (Client) NewSampler

func (c Client) NewSampler(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) SetURL

func (c *Client) SetURL(url string)

SetURL takes a preformatted URL for the client.

The normal format is http[s]://host:port/xmlrpc

func (Client) String

func (c Client) String() string

String() conforms to the Stringer Type

func (Client) URL

func (c Client) URL() string

URL returns the configured root URL of the XMLRPC endpoint

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(name string) (err error)

func (Dataview) AddRow

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

func (Dataview) Close

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

Close removes the dataview from the sampler It does not cleanup the data structure

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) DataviewGroupNames

func (d Dataview) DataviewGroupNames() (string, string)

DataviewGroupNames returns the dataview name and group as two strings, the group may be empty

func (Dataview) DataviewName

func (d Dataview) DataviewName() string

DataviewName returns to aggregated dataview name (including the optional group)

func (Dataview) Headline

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

func (Dataview) HeadlineNames

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

func (Dataview) IsValid

func (d Dataview) IsValid() bool

IsValid checks if the dataview is (still) valid

func (Dataview) RemoveHeadline

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

func (Dataview) RemoveRow

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

func (Dataview) RowNames

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

func (Dataview) RowNamesOlderThan

func (d Dataview) RowNamesOlderThan(unixtime int64) (rownames []string, err error)

func (*Dataview) SetDataviewName

func (d *Dataview) SetDataviewName(dataview string, groupname string)

SetDataviewName sets the aggregated dataview name given the name and group XXX No validation or checking is done

func (Dataview) String

func (d Dataview) String() string

String returns a human readable string to identify the dataview, mainly for debugging

func (Dataview) UpdateCell

func (d Dataview) UpdateCell(rowname string, columnname 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(name 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 Sampler

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

func NewClient

func NewClient(url string, entityName string, samplerName string) (sampler Sampler, err error)

func (Sampler) CreateDataview

func (s Sampler) CreateDataview(dataviewName string, groupName string) (d *Dataview, err error)

CreateDataview creates a new dataview struct and calls the API to create one on the Netprobe. It does NOT check for an existing dataview or remove it if one exists

func (Sampler) EntityName

func (s Sampler) EntityName() string

EntityName returns the Entuty name as a string

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) IsValid

func (s *Sampler) IsValid() bool

func (Sampler) NewDataview

func (s Sampler) NewDataview(dataviewName string, groupName 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 numberic and other type getters

func (Sampler) SamplerName

func (s Sampler) SamplerName() string

SamplerName returns the Sampler name as a string

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(interval 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

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.

type XMLRPC

type XMLRPC interface {
	String() string
	IsValid() bool
}

The XMLRPC type is a simple one

Jump to

Keyboard shortcuts

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