Documentation ¶
Index ¶
- func CreatePrefix(prefix, target string) (*gnmi.Path, error)
- func ParsePath(p string) (*gnmi.Path, error)
- type Collector
- func (c *Collector) AddInput(name string, cfg map[string]interface{}) error
- func (c *Collector) AddOutput(name string, cfg map[string]interface{}) error
- func (c *Collector) AddSubscriptionConfig(sc *SubscriptionConfig) error
- func (c *Collector) AddTarget(tc *TargetConfig) error
- func (c *Collector) Capabilities(ctx context.Context, tName string, ext ...*gnmi_ext.Extension) (*gnmi.CapabilityResponse, error)
- func (c *Collector) DeleteOutput(name string) error
- func (c *Collector) DeleteSubscription(name string) error
- func (c *Collector) DeleteTarget(ctx context.Context, name string) error
- func (c *Collector) Export(ctx context.Context, rsp *gnmi.SubscribeResponse, m outputs.Meta, ...)
- func (c *Collector) Get(ctx context.Context, tName string, req *gnmi.GetRequest) (*gnmi.GetResponse, error)
- func (c *Collector) GetModels(ctx context.Context, tName string) ([]*gnmi.ModelData, error)
- func (c *Collector) InitInput(ctx context.Context, name string, tcs map[string]interface{})
- func (c *Collector) InitInputs(ctx context.Context)
- func (c *Collector) InitOutput(ctx context.Context, name string, tcs map[string]interface{})
- func (c *Collector) InitOutputs(ctx context.Context)
- func (c *Collector) PolledSubscriptionsTargets() map[string][]string
- func (c *Collector) Set(ctx context.Context, tName string, req *gnmi.SetRequest) (*gnmi.SetResponse, error)
- func (c *Collector) Start(ctx context.Context)
- func (c *Collector) StopTarget(ctx context.Context, name string) error
- func (c *Collector) Subscribe(ctx context.Context, tName string) error
- func (c *Collector) SubscribeOnce(ctx context.Context, tName string) error
- func (c *Collector) TargetPoll(targetName, subscriptionName string) (*gnmi.SubscribeResponse, error)
- func (c *Collector) TargetSubscribeOnce(ctx context.Context, name string) error
- func (c *Collector) TargetSubscribePoll(ctx context.Context, name string)
- func (c *Collector) TargetSubscribeStream(ctx context.Context, name string)
- type CollectorOption
- func WithDialOptions(dialOptions []grpc.DialOption) CollectorOption
- func WithEventProcessors(eps map[string]map[string]interface{}) CollectorOption
- func WithInputs(inputsConfig map[string]map[string]interface{}) CollectorOption
- func WithLocker(locker lockers.Locker) CollectorOption
- func WithLogger(logger *log.Logger) CollectorOption
- func WithOutputs(outs map[string]map[string]interface{}) CollectorOption
- func WithProtoDescriptor(d desc.Descriptor) CollectorOption
- func WithSubscriptions(subs map[string]*SubscriptionConfig) CollectorOption
- type Config
- type SubscribeResponse
- type SubscriptionConfig
- func (sc *SubscriptionConfig) CreateSubscribeRequest() (*gnmi.SubscribeRequest, error)
- func (sc *SubscriptionConfig) HeartbeatIntervalString() string
- func (sc *SubscriptionConfig) ModeString() string
- func (sc *SubscriptionConfig) ModelsString() string
- func (sc *SubscriptionConfig) PathsString() string
- func (sc *SubscriptionConfig) PrefixString() string
- func (sc *SubscriptionConfig) QosString() string
- func (sc *SubscriptionConfig) SampleIntervalString() string
- func (sc *SubscriptionConfig) String() string
- func (sc *SubscriptionConfig) SuppressRedundantString() string
- func (sc *SubscriptionConfig) UpdatesOnlyString() string
- type Target
- func (t *Target) Capabilities(ctx context.Context, ext ...*gnmi_ext.Extension) (*gnmi.CapabilityResponse, error)
- func (t *Target) CreateGNMIClient(ctx context.Context, opts ...grpc.DialOption) error
- func (t *Target) Get(ctx context.Context, req *gnmi.GetRequest) (*gnmi.GetResponse, error)
- func (t *Target) ReadSubscriptions() (chan *SubscribeResponse, chan *TargetError)
- func (t *Target) Set(ctx context.Context, req *gnmi.SetRequest) (*gnmi.SetResponse, error)
- func (t *Target) Stop()
- func (t *Target) Subscribe(ctx context.Context, req *gnmi.SubscribeRequest, subscriptionName string)
- func (t *Target) SubscribeOnce(ctx context.Context, req *gnmi.SubscribeRequest, subscriptionName string) (chan *gnmi.SubscribeResponse, chan error)
- type TargetConfig
- func (tc *TargetConfig) BufferSizeString() string
- func (tc *TargetConfig) InsecureString() string
- func (tc *TargetConfig) OutputsString() string
- func (tc *TargetConfig) PasswordString() string
- func (tc *TargetConfig) SkipVerifyString() string
- func (tc *TargetConfig) String() string
- func (tc *TargetConfig) SubscriptionString() string
- func (tc *TargetConfig) TLSCAString() string
- func (tc *TargetConfig) TLSCertString() string
- func (tc *TargetConfig) TLSKeyString() string
- func (tc *TargetConfig) UsernameString() string
- type TargetError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collector ¶
type Collector struct { Config *Config Subscriptions map[string]*SubscriptionConfig Outputs map[string]outputs.Output Inputs map[string]inputs.Input Targets map[string]*Target EventProcessorsConfig map[string]map[string]interface{} // contains filtered or unexported fields }
Collector //
func NewCollector ¶
func NewCollector(config *Config, targetConfigs map[string]*TargetConfig, opts ...CollectorOption) *Collector
NewCollector //
func (*Collector) AddInput ¶ added in v0.7.0
AddInput adds an input called name, with config cfg to the collector instance
func (*Collector) AddOutput ¶ added in v0.5.1
AddOutput initializes an output called name, with config cfg if it does not already exist
func (*Collector) AddSubscriptionConfig ¶ added in v0.5.1
func (c *Collector) AddSubscriptionConfig(sc *SubscriptionConfig) error
AddSubscriptionConfig adds a subscriptionConfig sc to Collector's map if it does not already exists
func (*Collector) AddTarget ¶ added in v0.5.1
func (c *Collector) AddTarget(tc *TargetConfig) error
AddTarget initializes a target based on *TargetConfig
func (*Collector) Capabilities ¶ added in v0.5.0
func (*Collector) DeleteOutput ¶ added in v0.5.1
func (*Collector) DeleteSubscription ¶ added in v0.5.1
func (*Collector) DeleteTarget ¶ added in v0.5.1
func (*Collector) Get ¶ added in v0.5.0
func (c *Collector) Get(ctx context.Context, tName string, req *gnmi.GetRequest) (*gnmi.GetResponse, error)
func (*Collector) InitInputs ¶ added in v0.7.0
func (*Collector) InitOutput ¶ added in v0.5.1
func (*Collector) InitOutputs ¶ added in v0.5.1
func (*Collector) PolledSubscriptionsTargets ¶
PolledSubscriptionsTargets returns a map of target name to a list of subscription names that have Mode == POLL
func (*Collector) Set ¶ added in v0.5.0
func (c *Collector) Set(ctx context.Context, tName string, req *gnmi.SetRequest) (*gnmi.SetResponse, error)
func (*Collector) Start ¶
Start start the prometheus server as well as a goroutine per target selecting on the response chan, the error chan and the ctx.Done() chan
func (*Collector) StopTarget ¶ added in v0.7.0
func (*Collector) SubscribeOnce ¶ added in v0.8.0
func (*Collector) TargetPoll ¶
func (c *Collector) TargetPoll(targetName, subscriptionName string) (*gnmi.SubscribeResponse, error)
TargetPoll sends a gnmi.SubscribeRequest_Poll to targetName and returns the response and an error, it uses the targetName and the subscriptionName strings to find the gnmi.GNMI_SubscribeClient
func (*Collector) TargetSubscribeOnce ¶ added in v0.8.0
func (*Collector) TargetSubscribePoll ¶ added in v0.8.0
type CollectorOption ¶ added in v0.4.0
type CollectorOption func(c *Collector)
func WithDialOptions ¶ added in v0.4.0
func WithDialOptions(dialOptions []grpc.DialOption) CollectorOption
func WithEventProcessors ¶ added in v0.6.0
func WithEventProcessors(eps map[string]map[string]interface{}) CollectorOption
func WithInputs ¶ added in v0.7.0
func WithInputs(inputsConfig map[string]map[string]interface{}) CollectorOption
func WithLocker ¶ added in v0.7.0
func WithLocker(locker lockers.Locker) CollectorOption
func WithLogger ¶ added in v0.4.0
func WithLogger(logger *log.Logger) CollectorOption
func WithOutputs ¶ added in v0.4.0
func WithOutputs(outs map[string]map[string]interface{}) CollectorOption
func WithProtoDescriptor ¶ added in v0.9.0
func WithProtoDescriptor(d desc.Descriptor) CollectorOption
func WithSubscriptions ¶ added in v0.4.0
func WithSubscriptions(subs map[string]*SubscriptionConfig) CollectorOption
type Config ¶
type Config struct { Name string PrometheusAddress string Debug bool Format string TargetReceiveBuffer uint RetryTimer time.Duration ClusterName string LockRetryTimer time.Duration }
Config is the collector config
type SubscribeResponse ¶
type SubscribeResponse struct { SubscriptionName string Response *gnmi.SubscribeResponse }
SubscribeResponse //
type SubscriptionConfig ¶
type SubscriptionConfig struct { Name string `mapstructure:"name,omitempty" json:"name,omitempty"` Models []string `mapstructure:"models,omitempty" json:"models,omitempty"` Prefix string `mapstructure:"prefix,omitempty" json:"prefix,omitempty"` Target string `mapstructure:"target,omitempty" json:"target,omitempty"` Paths []string `mapstructure:"paths,omitempty" json:"paths,omitempty"` Mode string `mapstructure:"mode,omitempty" json:"mode,omitempty"` StreamMode string `mapstructure:"stream-mode,omitempty" json:"stream-mode,omitempty"` Encoding string `mapstructure:"encoding,omitempty" json:"encoding,omitempty"` Qos *uint32 `mapstructure:"qos,omitempty" json:"qos,omitempty"` SampleInterval *time.Duration `mapstructure:"sample-interval,omitempty" json:"sample-interval,omitempty"` HeartbeatInterval *time.Duration `mapstructure:"heartbeat-interval,omitempty" json:"heartbeat-interval,omitempty"` SuppressRedundant bool `mapstructure:"suppress-redundant,omitempty" json:"suppress-redundant,omitempty"` UpdatesOnly bool `mapstructure:"updates-only,omitempty" json:"updates-only,omitempty"` }
SubscriptionConfig //
func (*SubscriptionConfig) CreateSubscribeRequest ¶
func (sc *SubscriptionConfig) CreateSubscribeRequest() (*gnmi.SubscribeRequest, error)
CreateSubscribeRequest validates the SubscriptionConfig and creates gnmi.SubscribeRequest
func (*SubscriptionConfig) HeartbeatIntervalString ¶ added in v0.5.0
func (sc *SubscriptionConfig) HeartbeatIntervalString() string
func (*SubscriptionConfig) ModeString ¶ added in v0.5.0
func (sc *SubscriptionConfig) ModeString() string
func (*SubscriptionConfig) ModelsString ¶ added in v0.5.0
func (sc *SubscriptionConfig) ModelsString() string
func (*SubscriptionConfig) PathsString ¶ added in v0.5.0
func (sc *SubscriptionConfig) PathsString() string
func (*SubscriptionConfig) PrefixString ¶ added in v0.5.0
func (sc *SubscriptionConfig) PrefixString() string
func (*SubscriptionConfig) QosString ¶ added in v0.5.0
func (sc *SubscriptionConfig) QosString() string
func (*SubscriptionConfig) SampleIntervalString ¶ added in v0.5.0
func (sc *SubscriptionConfig) SampleIntervalString() string
func (*SubscriptionConfig) SuppressRedundantString ¶ added in v0.5.0
func (sc *SubscriptionConfig) SuppressRedundantString() string
func (*SubscriptionConfig) UpdatesOnlyString ¶ added in v0.5.0
func (sc *SubscriptionConfig) UpdatesOnlyString() string
type Target ¶
type Target struct { Config *TargetConfig `json:"config,omitempty"` Subscriptions map[string]*SubscriptionConfig `json:"subscriptions,omitempty"` Client gnmi.GNMIClient `json:"-"` SubscribeClients map[string]gnmi.GNMI_SubscribeClient `json:"-"` // subscription name to subscribeClient // contains filtered or unexported fields }
Target represents a gNMI enabled box
func (*Target) Capabilities ¶
func (t *Target) Capabilities(ctx context.Context, ext ...*gnmi_ext.Extension) (*gnmi.CapabilityResponse, error)
Capabilities sends a gnmi.CapabilitiesRequest to the target *t and returns a gnmi.CapabilitiesResponse and an error
func (*Target) CreateGNMIClient ¶
CreateGNMIClient //
func (*Target) Get ¶
func (t *Target) Get(ctx context.Context, req *gnmi.GetRequest) (*gnmi.GetResponse, error)
Get sends a gnmi.GetRequest to the target *t and returns a gnmi.GetResponse and an error
func (*Target) ReadSubscriptions ¶ added in v0.9.1
func (t *Target) ReadSubscriptions() (chan *SubscribeResponse, chan *TargetError)
func (*Target) Set ¶
func (t *Target) Set(ctx context.Context, req *gnmi.SetRequest) (*gnmi.SetResponse, error)
Set sends a gnmi.SetRequest to the target *t and returns a gnmi.SetResponse and an error
func (*Target) Subscribe ¶
func (t *Target) Subscribe(ctx context.Context, req *gnmi.SubscribeRequest, subscriptionName string)
Subscribe sends a gnmi.SubscribeRequest to the target *t, responses and error are sent to the target channels
func (*Target) SubscribeOnce ¶ added in v0.9.1
func (t *Target) SubscribeOnce(ctx context.Context, req *gnmi.SubscribeRequest, subscriptionName string) (chan *gnmi.SubscribeResponse, chan error)
type TargetConfig ¶
type TargetConfig struct { Name string `mapstructure:"name,omitempty" json:"name,omitempty"` Address string `mapstructure:"address,omitempty" json:"address,omitempty"` Username *string `mapstructure:"username,omitempty" json:"username,omitempty"` Password *string `mapstructure:"password,omitempty" json:"password,omitempty"` Timeout time.Duration `mapstructure:"timeout,omitempty" json:"timeout,omitempty"` Insecure *bool `mapstructure:"insecure,omitempty" json:"insecure,omitempty"` TLSCA *string `mapstructure:"tls-ca,omitempty" json:"tls-ca,omitempty"` TLSCert *string `mapstructure:"tls-cert,omitempty" json:"tls-cert,omitempty"` TLSKey *string `mapstructure:"tls-key,omitempty" json:"tls-key,omitempty"` SkipVerify *bool `mapstructure:"skip-verify,omitempty" json:"skip-verify,omitempty"` Subscriptions []string `mapstructure:"subscriptions,omitempty" json:"subscriptions,omitempty"` Outputs []string `mapstructure:"outputs,omitempty" json:"outputs,omitempty"` BufferSize uint `mapstructure:"buffer-size,omitempty" json:"buffer-size,omitempty"` RetryTimer time.Duration `mapstructure:"retry,omitempty" json:"retry-timer,omitempty"` TLSMinVersion string `mapstructure:"tls-min-version,omitempty" json:"tls-min-version,omitempty"` TLSMaxVersion string `mapstructure:"tls-max-version,omitempty" json:"tls-max-version,omitempty"` TLSVersion string `mapstructure:"tls-version,omitempty" json:"tls-version,omitempty"` ProtoFiles []string `mapstructure:"proto-files,omitempty" json:"proto-files,omitempty"` ProtoDirs []string `mapstructure:"proto-dirs,omitempty" json:"proto-dirs,omitempty"` Tags []string `mapstructure:"tags,omitempty" json:"tags,omitempty"` Gzip *bool `mapstructure:"gzip,omitempty" json:"gzip,omitempty"` }
TargetConfig //
func (*TargetConfig) BufferSizeString ¶ added in v0.5.0
func (tc *TargetConfig) BufferSizeString() string
func (*TargetConfig) InsecureString ¶ added in v0.5.0
func (tc *TargetConfig) InsecureString() string
func (*TargetConfig) OutputsString ¶ added in v0.5.0
func (tc *TargetConfig) OutputsString() string
func (*TargetConfig) PasswordString ¶ added in v0.5.0
func (tc *TargetConfig) PasswordString() string
func (*TargetConfig) SkipVerifyString ¶ added in v0.5.0
func (tc *TargetConfig) SkipVerifyString() string
func (*TargetConfig) String ¶
func (tc *TargetConfig) String() string
func (*TargetConfig) SubscriptionString ¶ added in v0.5.0
func (tc *TargetConfig) SubscriptionString() string
func (*TargetConfig) TLSCAString ¶ added in v0.5.0
func (tc *TargetConfig) TLSCAString() string
func (*TargetConfig) TLSCertString ¶ added in v0.5.0
func (tc *TargetConfig) TLSCertString() string
func (*TargetConfig) TLSKeyString ¶ added in v0.5.0
func (tc *TargetConfig) TLSKeyString() string
func (*TargetConfig) UsernameString ¶ added in v0.5.0
func (tc *TargetConfig) UsernameString() string