Documentation ¶
Index ¶
- func Abs(c geneos.Instance, file string) (path string)
- func AllNames(h *host.Host, ct *geneos.Component) (names []string)
- func BuildCmd(c geneos.Instance) (cmd *exec.Cmd, env []string)
- func Clean(c geneos.Instance, options ...geneos.GeneosOptions) (err error)
- func ConfigPathWithExt(c geneos.Instance, extension string) (path string)
- func CopyInstance(ct *geneos.Component, srcname, dstname string, remove bool) (err error)
- func CreateCert(c geneos.Instance) (err error)
- func CreateCertKey(template, parent *x509.Certificate, parentKey *rsa.PrivateKey, ...) (cert *x509.Certificate, key *rsa.PrivateKey, err error)
- func CreateConfigFromTemplate(c geneos.Instance, path string, name string, defaultTemplate []byte) (err error)
- func Files(c geneos.Instance) (links map[int]string)
- func ForAll(ct *geneos.Component, fn func(geneos.Instance, []string) error, args []string, ...) (err error)
- func Get(ct *geneos.Component, name string) (c geneos.Instance, err error)
- func GetAll(r *host.Host, ct *geneos.Component) (confs []geneos.Instance)
- func GetPID(c geneos.Instance) (pid int, err error)
- func GetPIDInfo(c geneos.Instance) (pid int, uid uint32, gid uint32, mtime int64, err error)
- func GetPorts(r *host.Host) (ports map[uint16]*geneos.Component)
- func ImportCommons(r *host.Host, ct *geneos.Component, common string, params []string) (filename string, err error)
- func ImportFile(h *host.Host, home string, user string, source string, ...) (filename string, err error)
- func IsDisabled(c geneos.Instance) bool
- func LoadConfig(c geneos.Instance) (err error)
- func LogFile(c geneos.Instance) (logfile string)
- func Match(ct *geneos.Component, name string) (c geneos.Instance, err error)
- func MatchAll(ct *geneos.Component, name string) (c []geneos.Instance)
- func MatchKeyValue(h *host.Host, ct *geneos.Component, key, value string) (confs []geneos.Instance)
- func Migrate(c geneos.Instance) (err error)
- func NextPort(r *host.Host, ct *geneos.Component) uint16
- func Ports(c geneos.Instance) (ports []int)
- func ReadCert(c geneos.Instance) (cert *x509.Certificate, err error)
- func ReadConfig(c geneos.Instance) (err error)
- func ReadKey(c geneos.Instance) (key *rsa.PrivateKey, err error)
- func ReadRootCert() (cert *x509.Certificate, err error)
- func ReadSigningCert() (cert *x509.Certificate, err error)
- func RemovePaths(c geneos.Instance, paths string) (err error)
- func ReservedName(in string) (ok bool)
- func SetDefaults(c geneos.Instance, name string) (err error)
- func SetExtendedValues(c geneos.Instance, x ExtraConfigValues) (changed bool)
- func Signal(c geneos.Instance, signal syscall.Signal) (err error)
- func SplitName(in string, defaultHost *host.Host) (ct *geneos.Component, name string, h *host.Host)
- func Start(c geneos.Instance) (err error)
- func Stop(c geneos.Instance, force bool) (err error)
- func ValidInstanceName(in string) (ok bool)
- func Version(c geneos.Instance) (base string, underlying string, err error)
- func WriteCert(c geneos.Instance, cert *x509.Certificate) (err error)
- func WriteConfig(c geneos.Instance) (err error)
- func WriteConfigValues(c geneos.Instance, values map[string]interface{}) error
- func WriteKey(c geneos.Instance, key *rsa.PrivateKey) (err error)
- type ExtraConfigValues
- type GatewayValues
- type IncludeValues
- type Instance
- type StringSliceValues
- type VarValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllNames ¶
Return a slice of all instance names for a given component. No checking is done to validate that the directory is a populated instance.
func BuildCmd ¶
buildCmd gathers the path to the binary, arguments and any environment variables for an instance and returns an exec.Cmd, almost ready for execution. Callers will add more details such as working directories, user and group etc.
func CopyInstance ¶
func CreateCert ¶
create a new certificate for an instance
this also creates a new private key
skip if certificate exists (no expiry check)
func CreateCertKey ¶
func CreateCertKey(template, parent *x509.Certificate, parentKey *rsa.PrivateKey, existingKey *rsa.PrivateKey) (cert *x509.Certificate, key *rsa.PrivateKey, err error)
wrapper to create a new certificate given the sign cert and private key and an optional private key to (re)use for the created certificate itself. returns a certificate and private key
func CreateConfigFromTemplate ¶
func CreateConfigFromTemplate(c geneos.Instance, path string, name string, defaultTemplate []byte) (err error)
load templates from TYPE/templates/[tmpl]* and parse it using the instance data write it out to a single file. If tmpl is empty, load all files
func ForAll ¶
func ForAll(ct *geneos.Component, fn func(geneos.Instance, []string) error, args []string, params []string) (err error)
given a component type and a slice of args, call the function for each arg
try to use go routines here - mutexes required
func Get ¶
return an instance of component ct, loads the config. it is an error if the config cannot be loaded
func GetPID ¶
locate a process instance
the component type must be part of the basename of the executable and the component name must be on the command line as an exact and standalone args
walk the /proc directory (local or remote) and find the matching pid this is subject to races, but not much we can do
func GetPIDInfo ¶
func GetPorts ¶
get all used ports in config files on a specific remote this will not work for ports assigned in component config files, such as gateway setup or netprobe collection agent
returns a map
func ImportCommons ¶
func ImportFile ¶
func IsDisabled ¶
func LoadConfig ¶
loadConfig will load the JSON config file is available, otherwise try to load the "legacy" .rc file
support cache?
error check core values - e.g. Name
func Match ¶
Looks for exactly one matching instance across types and hosts returns Invalid Args if zero of more than 1 match
func MatchKeyValue ¶
func NextPort ¶
given a range, find the first unused port
range is comma or two-dot seperated list of single number, e.g. "7036" min-max inclusive range, e.g. "7036-8036" start- open ended range, e.g. "7041-"
some limits based on https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
not concurrency safe at this time
func ReadCert ¶
func ReadCert(c geneos.Instance) (cert *x509.Certificate, err error)
read the instance certificate
func ReadConfig ¶
func ReadKey ¶
func ReadKey(c geneos.Instance) (key *rsa.PrivateKey, err error)
read the instance RSA private key
func ReadRootCert ¶
func ReadRootCert() (cert *x509.Certificate, err error)
read the rootCA certificate from the installation directory
func ReadSigningCert ¶
func ReadSigningCert() (cert *x509.Certificate, err error)
read the signing certificate from the installation directory
func RemovePaths ¶
given a pathlist (typically ':') seperated list of paths, remove all files and directories
func ReservedName ¶
separate reserved words and invalid syntax
func SetDefaults ¶
SetDefaults() is a common function called by component factory functions to iterate over the component specific instance struct and set the defaults as defined in the 'defaults' struct tags.
func SetExtendedValues ¶
func SetExtendedValues(c geneos.Instance, x ExtraConfigValues) (changed bool)
XXX abstract this for a general case
func SplitName ¶
given an instance name in the format [TYPE:]NAME[@HOST] and a default host, return a *geneos.Component for the TYPE if given, a string for the NAME and a *host.Host - the latter being either from the name or the default provided
func ValidInstanceName ¶
return true while a string is considered a valid instance name
used to consume instance names until parameters are then passed down
func Version ¶
return the base package name and the version it links to. if not a link, then return the same follow a limited number of links (10?)
func WriteConfig ¶
write out an instance configuration file. XXX check if existing config is an .rc file and if so rename it after successful write to match migrate
remote configuration files are supported using afero.Fs through viper but rely on host.DialSFTP to dial and cache the client
delete any aliases fields before writing
func WriteConfigValues ¶
Types ¶
type ExtraConfigValues ¶
type ExtraConfigValues struct { Includes IncludeValues Gateways GatewayValues Attributes StringSliceValues Envs StringSliceValues Variables VarValues Types StringSliceValues Keys StringSliceValues }
type GatewayValues ¶
gateway - name:port
func (*GatewayValues) Set ¶
func (i *GatewayValues) Set(value string) error
func (*GatewayValues) String ¶
func (i *GatewayValues) String() string
func (*GatewayValues) Type ¶
func (i *GatewayValues) Type() string
type IncludeValues ¶
include file - priority:url|path
func (*IncludeValues) Set ¶
func (i *IncludeValues) Set(value string) error
func (*IncludeValues) String ¶
func (i *IncludeValues) String() string
func (*IncludeValues) Type ¶
func (i *IncludeValues) Type() string
type Instance ¶
type Instance struct { geneos.Instance `json:"-"` L *sync.RWMutex `json:"-"` Conf *viper.Viper `json:"-"` InstanceHost *host.Host `json:"-"` Component *geneos.Component `json:"-"` ConfigLoaded bool `json:"-"` Env []string `json:",omitempty"` }
The Instance type is the common data shared by all instance / component types
type StringSliceValues ¶
type StringSliceValues []string
attribute - name=value
func (*StringSliceValues) Set ¶
func (i *StringSliceValues) Set(value string) error
func (*StringSliceValues) String ¶
func (i *StringSliceValues) String() string
func (*StringSliceValues) Type ¶
func (i *StringSliceValues) Type() string