Documentation ¶
Index ¶
- func GetBool(s string) bool
- func GetDuration(s string) time.Duration
- func GetInt(s string) int
- func GetString(s string, confmap ...map[string]string) string
- func GetStringMapString(s string, confmap ...map[string]string) map[string]string
- func GetStringSlice(s string, confmap ...map[string]string) []string
- func GetViper() *viper.Viper
- func SetDefault(s string, i interface{})
- type Attribute
- type Column
- type Config
- func (c *Config) ExpandString(input string, confmap map[string]string) (value string)
- func (c *Config) GetBool(s string) bool
- func (c *Config) GetDuration(s string) time.Duration
- func (c *Config) GetInt(s string) int
- func (c *Config) GetString(s string, confmap ...map[string]string) string
- func (c *Config) GetStringMapString(s string, confmap ...map[string]string) (m map[string]string)
- func (c *Config) GetStringSlice(s string, confmap ...map[string]string) (slice []string)
- func (c *Config) GetViper() *viper.Viper
- func (c *Config) SetDefault(s string, i interface{})
- func (c *Config) SetViper(v *viper.Viper)
- type DBConnection
- type Data
- type Dataview
- type DataviewAdditions
- type DataviewHeadline
- type Environment
- type EnvironmentGroup
- type EnvironmentVariable
- type Environments
- type FTMAdditionalPath
- type FTMAdditionalPaths
- type FTMFile
- type FTMSampler
- type Gateway
- type GatewaySQLSampler
- type GatewaySQLTable
- type Macro
- type ManagedEntities
- type ManagedEntity
- type MonitoringPeriodAlias
- type MonitoringPeriodStart
- type MySQL
- type Query
- type Rule
- type RuleGroups
- type Rules
- type SQLServer
- type SQLToolkitSampler
- type Samplers
- type SingleLineString
- type Sybase
- type ToolkitSampler
- type Type
- type TypeRef
- type Types
- type Var
- type VarData
- type VarMacro
- type VarRef
- type VarStringList
- type Vars
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDuration ¶ added in v1.10.0
func GetString ¶
Returns the configuration item as a string with ExpandString() applied, passing the first "confmap" if given
func GetStringMapString ¶
func SetDefault ¶ added in v1.10.0
func SetDefault(s string, i interface{})
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
The Config type acts as a container for local/extended viper instances
func (*Config) ExpandString ¶
Return a string that has all contents of the form ${var} or $var expanded according to the following rules:
url - read the contents of the url, which can be a local file, as below: ${file://path/to/file} - read the entire contents of the file, trim whitespace ${https://host/path} - fetch the remote contents, trim whitespace. "http:" also supported. ${env:VARNAME} - replace with the contents of the environment varaible VARNAME, trim whitespace ${path.to.config} - and var containing a '.' will be looked up in global viper config space - this is NOT recursive ${name} - replace with the contents of confmap["name"] - trim whitespace
While the form $var is also supported but may be ambiguous and is not recommended.
If confmap is not given then environment variables are used directly.
Any errors result in an empty string being returned.
func (*Config) GetString ¶
Returns the configuration item as a string with ExpandString() applied, passing the first "confmap" if given
func (*Config) GetStringMapString ¶
func (*Config) GetStringSlice ¶
func (*Config) SetDefault ¶ added in v1.10.0
type DBConnection ¶
type DBConnection struct { MySQL *MySQL `xml:"database>mysql,omitempty"` SQLServer *SQLServer `xml:"database>sqlServer,omitempty"` Sybase *Sybase `xml:"database>sybase,omitempty"` UsernameVar VarRef `xml:"var-userName>var"` PasswordVar VarRef `xml:"password>var"` CloseConnectionAfterQuery bool `xml:"closeConnectionAfterQuery>data"` }
type Dataview ¶
type Dataview struct { XMLName xml.Name `xml:"dataview"` Name string `xml:"name,attr"` Additions DataviewAdditions }
type DataviewAdditions ¶
type DataviewAdditions struct { XMLName xml.Name `xml:"additions"` Headlines []DataviewHeadline `xml:"var-headlines>data,omitempty"` }
type DataviewHeadline ¶
type DataviewHeadline struct {
Name string `xml:"headline>data,omitempty"`
}
type Environment ¶
type Environment struct { XMLName xml.Name `xml:"environment,omitempty"` Name string `xml:"name,attr"` Environments []Environment `xml:"environment,omitempty"` Vars []Vars }
type EnvironmentGroup ¶
type EnvironmentGroup struct { XMLName xml.Name `xml:"environmentGroup"` Name string `xml:"name,attr"` Environments []Environment }
type EnvironmentVariable ¶
type EnvironmentVariable struct { Name string `xml:"name"` Value SingleLineString `xml:"value"` }
type Environments ¶
type Environments struct { XMLName xml.Name `xml:"environments"` Groups []EnvironmentGroup Environments []Environment }
type FTMAdditionalPath ¶
type FTMAdditionalPath struct {
Path string `xml:"data"`
}
type FTMAdditionalPaths ¶
type FTMAdditionalPaths struct {
Paths []FTMAdditionalPath `xml:"additionalPath"`
}
type FTMFile ¶
type FTMFile struct { XMLName xml.Name `xml:"file"` Path string `xml:"path>data"` AdditionalPaths *FTMAdditionalPaths `xml:"additionalPaths,omitempty"` ExpectedArrival string `xml:"expectedArrival>data"` ExpectedPeriod *struct { Period string `xml:",innerxml"` } `xml:"expectedPeriod,omitempty"` TZOffset string `xml:"tzOffset>data"` MonitoringPeriod interface{} `xml:"monioringPeriod"` Alias string `xml:"alias>data"` }
type FTMSampler ¶
type FTMSampler struct { XMLName xml.Name `xml:"sampler"` Name string `xml:"name,attr"` Comment string `xml:",comment"` Group string `xml:"var-group>data"` Interval *VarData `xml:"sampleInterval,omitempty"` Files []FTMFile `xml:"plugin>ftm>files>file"` ConsistentDateStamps bool `xml:"plugin>ftm>consistentDateStamps>data,omitempty"` DisplayTimeInISO8601Format bool `xml:"plugin>ftm>displayTimeInIso8601Format>data,omitempty"` ShowActualFilename bool `xml:"plugin>ftm>showActualFilename>data,omitempty"` DelayUnit string `xml:"plugin>ftm>delayUnit"` SizeUnit string `xml:"plugin>ftm>sizeUnit"` Dataviews []Dataview `xml:"dataviews>dataview,omitempty"` }
type Gateway ¶
type Gateway struct { XMLName xml.Name `xml:"gateway"` Compatibility int `xml:"compatibility,attr"` XMLNs string `xml:"xmlns:xsi,attr"` // http://www.w3.org/2001/XMLSchema-instance XSI string `xml:"xsi:noNamespaceSchemaLocation,attr"` // http://schema.itrsgroup.com/GA5.12.0-220125/gateway.xsd ManagedEntities *ManagedEntities Types *Types Samplers *Samplers Environments *Environments }
type GatewaySQLSampler ¶
type GatewaySQLSampler struct { XMLName xml.Name `xml:"sampler"` Name string `xml:"name,attr"` Comment string `xml:",comment"` Group string `xml:"var-group>data"` Interval *VarData `xml:"sampleInterval,omitempty"` Setup string `xml:"plugin>Gateway-sql>setupSql>sql>data"` Tables []GatewaySQLTable `xml:"plugin>Gateway-sql>tables>xpath"` Views []View `xml:"plugin>Gateway-sql>views>view"` Dataviews []Dataview `xml:"dataviews>dataview,omitempty"` }
type GatewaySQLTable ¶
type ManagedEntities ¶
type ManagedEntity ¶
type ManagedEntity struct { XMLName xml.Name `xml:"managedEntity"` Name string `xml:"name,attr"` Probe struct { Name string `xml:"ref,attr"` Timezone *time.Location `xml:"-"` } `xml:"probe"` Attributes []Attribute `xml:",omitempty"` AddTypes struct { XMLName xml.Name `xml:"addTypes"` Types []TypeRef `xml:",omitempty"` } Vars []Vars `xml:",omitempty"` }
type MonitoringPeriodAlias ¶
type MonitoringPeriodAlias struct {
Alias string `xml:"periodAlias"`
}
type MonitoringPeriodStart ¶
type MonitoringPeriodStart struct {
PeriodStart string `xml:"periodStart>data"`
}
type Query ¶
type Query struct { Name string `xml:"name>data"` SQL SingleLineString `xml:"sql"` }
type RuleGroups ¶
type SQLToolkitSampler ¶
type SQLToolkitSampler struct { XMLName xml.Name `xml:"sampler"` Name string `xml:"name,attr"` Comment string `xml:",comment"` Group string `xml:"var-group>data"` Interval *VarData `xml:"sampleInterval,omitempty"` Queries []Query `xml:"plugin>sql-toolkit>queries>query"` Connection DBConnection `xml:"plugin>sql-toolkit>connection"` }
type SingleLineString ¶
type SingleLineString struct {
Parts []interface{}
}
A container for a single line string that can be made up of static text and variable references. Use like this:
type MyContainer struct { XMLName xml.Name `xml:"mycontainer` VarField SingleLineString `xml:"fieldname"` } func blah() { x := MyContainer{ VarField: geneos.NewSingleLineString(geneos.Data{Data: "hello"}, geneos.Var{Var: "world"}, geneos.Data{Data: "!"}) } ... }
func ExpandSingleLineString ¶
func ExpandSingleLineString(in string) (s SingleLineString)
ExpandSingleLineString take a plain string and locates any Geneos style variables of the form $(var) - not these are parenthesis and not brackets - and splits the string into Data and Var parts as required so that this can be used directly in the XML encodings
func NewSingleLineString ¶
func NewSingleLineString(parts ...interface{}) (s SingleLineString)
type ToolkitSampler ¶
type ToolkitSampler struct { XMLName xml.Name `xml:"sampler"` Name string `xml:"name,attr"` Comment string `xml:",comment"` Group string `xml:"var-group>data"` Interval *VarData `xml:"sampleInterval,omitempty"` SamplerScript string `xml:"plugin>toolkit>samplerScript>data"` EnvironmentVariables []EnvironmentVariable `xml:"plugin>toolkit>environmentVariables>variable"` }
type VarData ¶
type VarData struct {
Part interface{}
}
VarData is a struct that contains either a Var or a Data type depending on the usage.
func NewVarData ¶
NewVarData takes a string argument and removes leading and trailing spaces. If the string is of the form "$(var)" then returns a pointer to a VarData struct containing a Var{} or if a non-empty string returns a Data{}. If the string is empty then a nil pointer is returned. This allows `xml:",omixempty"“ to leave out VarData fields that contain no data.
type VarMacro ¶
type VarMacro struct { ManagedEntitiesName *Macro `xml:"managedEntityName,omitempty"` InsecureGatewayPort *Macro `xml:"insecureGatewayPort,omitempty"` }
these have to be pointers for the ",omitempty" logic to work. only ever initialise one field to an empty struct.
type VarStringList ¶
type VarStringList struct {
Strings []string `xml:"string"`
}