config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConf

func InitConf(conf *VESAgentConfiguration) error

InitConf initilize the config store from config file, env and cli variables.

Types

type AlertManagerConfiguration

type AlertManagerConfiguration struct {
	Bind     string `yaml:"bind,omitempty"`
	Path     string `yaml:"path,omitempty"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
}

AlertManagerConfiguration parameters

type ClusterConfiguration

type ClusterConfiguration struct {
	ID          string `mapstructure:"id"`          // Local node ID
	Peers       Peers  `mapstructure:"peers"`       // List of cluster's node
	Debug       bool   `mapstructure:"debug"`       // Display raft log messages
	DisplayLogs bool   `mapstructure:"displayLogs"` // Display replication log entries
}

ClusterConfiguration is the configuration of the raft cluster

type HeartbeatConfiguration

type HeartbeatConfiguration struct {
	DefaultInterval time.Duration `mapstructure:"defaultInterval,omitempty"`
}

HeartbeatConfiguration parameters

type Label

type Label struct {
	Name string `mapstructure:"name"`
	Expr string `mapstructure:"expr"`
}

Label represents a VES field by it's name, with an expression for getting its value

type MeasurementConfiguration

type MeasurementConfiguration struct {
	DomainAbbreviation   string           `mapstructure:"domainAbbreviation"`   // "Measurement" or "Mfvs"
	DefaultInterval      time.Duration    `mapstructure:"defaultInterval"`      // Default measurement interval
	MaxBufferingDuration time.Duration    `mapstructure:"maxBufferingDuration"` // Maximum timeframe size of buffering
	Prometheus           PrometheusConfig `mapstructure:"prometheus"`           // Prometheus configuration
}

MeasurementConfiguration parameters

type MetricRule

type MetricRule struct {
	Target         string  `mapstructure:"target"`          // Target VES event field
	Expr           string  `mapstructure:"expr"`            // Prometheus query expression
	VMIDLabel      string  `mapstructure:"vmId"`            // Metric label holding the VNF ID
	Labels         []Label `mapstructure:"labels"`          // Set of VES fields to map to values of given label
	ObjectName     string  `mapstructure:"object_name"`     // JSON Object Name
	ObjectInstance string  `mapstructure:"object_instance"` // JSON Object instance
	ObjectKeys     []Label `mapstructure:"object_keys"`     // JSON Object keys
}

MetricRule defines how to retrieve metrics and map them into a list of evel.EventMeasurement struct

func (MetricRule) WithDefaults

func (rule MetricRule) WithDefaults(def *MetricRule) MetricRule

WithDefaults applies default values from `def` to `rule`, and return a new one

type MetricRules

type MetricRules struct {
	DefaultValues *MetricRule  `mapstructure:"defaults"` // Default rules to apply (except for expr), labels are merged
	Metrics       []MetricRule `mapstructure:"metrics"`  // List of query and mapping of rules
}

MetricRules defines a list of rules, and defaults values for them

type Peer

type Peer struct {
	ID      string `mapstructure:"id"`      // Peer ID
	Address string `mapstructure:"address"` // Peer address and port
}

Peer is the configuration of a single raft peer

func (Peer) Server

func (pcfg Peer) Server() raft.Server

Server converts the peer configuration into a raft server

func (*Peer) TCPAddr

func (pcfg *Peer) TCPAddr() (*net.TCPAddr, error)

TCPAddr resolves the peer address &nd port into a TCP address

type Peers

type Peers []Peer

Peers is a list of peer configuration

func (Peers) GetPeer

func (cfg Peers) GetPeer(id string) (Peer, bool)

GetPeer find and returns the peer configuration for a given peer ID

func (Peers) Servers

func (cfg Peers) Servers() []raft.Server

Servers converts the list of peer configuration into a list of raft servers

type PrometheusConfig

type PrometheusConfig struct {
	Address   string        `mapstructure:"address"`   // Base URL to prometheus API
	Timeout   time.Duration `mapstructure:"timeout"`   // API request timeout
	KeepAlive time.Duration `mapstructure:"keepalive"` // HTTP Keep-Alive
	Rules     MetricRules   `mapstructure:"rules"`     // Querying rules
}

PrometheusConfig parameters

type VESAgentConfiguration

type VESAgentConfiguration struct {
	PrimaryCollector govel.CollectorConfiguration `mapstructure:"primaryCollector"`
	BackupCollector  govel.CollectorConfiguration `mapstructure:"backupCollector,omitempty"`
	Heartbeat        HeartbeatConfiguration       `mapstructure:"heartbeat,omitempty"`
	Measurement      MeasurementConfiguration     `mapstructure:"measurement,omitempty"`
	Event            govel.EventConfiguration     `mapstructure:"event,omitempty"`
	AlertManager     AlertManagerConfiguration    `mapstructure:"alertManager,omitempty"`
	Cluster          *ClusterConfiguration        `mapstructure:"cluster"` // Optional cluster config. If absent, fallbacks to single node mode
	Debug            bool                         `mapstructure:"debug,omitempty"`
	CaCert           string                       `mapstructure:"caCert,omitempty"` // Root certificate content
	DataDir          string                       `mapsctructure:"datadir"`         // Path to directory containing data
}

VESAgentConfiguration parameters

Jump to

Keyboard shortcuts

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