server

package
v1.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2018 License: MIT Imports: 75 Imported by: 0

Documentation

Overview

Provides a server type for starting and configuring a Kapacitor server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	Version  string
	Commit   string
	Branch   string
	Platform string
}

BuildInfo represents the build details for the server code.

type Config

type Config struct {
	HTTP           httpd.Config      `toml:"http"`
	Replay         replay.Config     `toml:"replay"`
	Storage        storage.Config    `toml:"storage"`
	Task           task_store.Config `toml:"task"`
	Load           load.Config       `toml:"load"`
	InfluxDB       []influxdb.Config `toml:"influxdb" override:"influxdb,element-key=name"`
	Logging        diagnostic.Config `toml:"logging"`
	ConfigOverride config.Config     `toml:"config-override"`

	// Input services
	Graphite []graphite.Config `toml:"graphite"`
	Collectd collectd.Config   `toml:"collectd"`
	OpenTSDB opentsdb.Config   `toml:"opentsdb"`
	UDP      []udp.Config      `toml:"udp"`

	// Alert handlers
	Alerta     alerta.Config     `toml:"alerta" override:"alerta"`
	HipChat    hipchat.Config    `toml:"hipchat" override:"hipchat"`
	Kafka      kafka.Configs     `toml:"kafka" override:"kafka,element-key=id"`
	MQTT       mqtt.Configs      `toml:"mqtt" override:"mqtt,element-key=name"`
	OpsGenie   opsgenie.Config   `toml:"opsgenie" override:"opsgenie"`
	OpsGenie2  opsgenie2.Config  `toml:"opsgenie2" override:"opsgenie2"`
	PagerDuty  pagerduty.Config  `toml:"pagerduty" override:"pagerduty"`
	PagerDuty2 pagerduty2.Config `toml:"pagerduty2" override:"pagerduty2"`
	Pushover   pushover.Config   `toml:"pushover" override:"pushover"`
	HTTPPost   httppost.Configs  `toml:"httppost" override:"httppost,element-key=endpoint"`
	SMTP       smtp.Config       `toml:"smtp" override:"smtp"`
	SNMPTrap   snmptrap.Config   `toml:"snmptrap" override:"snmptrap"`
	Sensu      sensu.Config      `toml:"sensu" override:"sensu"`
	Slack      slack.Configs     `toml:"slack" override:"slack,element-key=workspace"`
	Talk       talk.Config       `toml:"talk" override:"talk"`
	Telegram   telegram.Config   `toml:"telegram" override:"telegram"`
	VictorOps  victorops.Config  `toml:"victorops" override:"victorops"`

	// Discovery for scraping
	Scraper         []scraper.Config          `toml:"scraper" override:"scraper,element-key=name"`
	Azure           []azure.Config            `toml:"azure" override:"azure,element-key=id"`
	Consul          []consul.Config           `toml:"consul" override:"consul,element-key=id"`
	DNS             []dns.Config              `toml:"dns" override:"dns,element-key=id"`
	EC2             []ec2.Config              `toml:"ec2" override:"ec2,element-key=id"`
	FileDiscovery   []file_discovery.Config   `toml:"file-discovery" override:"file-discovery,element-key=id"`
	GCE             []gce.Config              `toml:"gce" override:"gce,element-key=id"`
	Marathon        []marathon.Config         `toml:"marathon" override:"marathon,element-key=id"`
	Nerve           []nerve.Config            `toml:"nerve" override:"nerve,element-key=id"`
	Serverset       []serverset.Config        `toml:"serverset" override:"serverset,element-key=id"`
	StaticDiscovery []static_discovery.Config `toml:"static-discovery" override:"static-discovery,element-key=id"`
	Triton          []triton.Config           `toml:"triton" override:"triton,element-key=id"`

	// Third-party integrations
	Kubernetes k8s.Configs   `toml:"kubernetes" override:"kubernetes,element-key=id" env-config:"implicit-index"`
	Swarm      swarm.Configs `toml:"swarm" override:"swarm,element-key=id"`

	Reporting reporting.Config `toml:"reporting"`
	Stats     stats.Config     `toml:"stats"`
	UDF       udf.Config       `toml:"udf"`
	Deadman   deadman.Config   `toml:"deadman"`

	Hostname               string `toml:"hostname"`
	DataDir                string `toml:"data_dir"`
	SkipConfigOverrides    bool   `toml:"skip-config-overrides"`
	DefaultRetentionPolicy string `toml:"default-retention-policy"`

	Commander command.Commander `toml:"-"`
}

Config represents the configuration format for the kapacitord binary.

func NewConfig

func NewConfig() *Config

NewConfig returns an instance of Config with reasonable defaults.

func NewDemoConfig

func NewDemoConfig() (*Config, error)

NewDemoConfig returns the config that runs when no config is specified.

func (*Config) ApplyEnvOverrides

func (c *Config) ApplyEnvOverrides() error

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the config is invalid.

type Diagnostic added in v1.4.0

type Diagnostic interface {
	Debug(msg string, ctx ...keyvalue.T)
	Info(msg string, ctx ...keyvalue.T)
	Error(msg string, err error, ctx ...keyvalue.T)
}

type Queryexecutor

type Queryexecutor struct{}

func (*Queryexecutor) Authorize

func (qe *Queryexecutor) Authorize(u *meta.UserInfo, q *influxql.Query, db string) error

func (*Queryexecutor) ExecuteQuery

func (qe *Queryexecutor) ExecuteQuery(q *influxql.Query, db string, chunkSize int) (<-chan *influxql.Result, error)

type Server

type Server struct {
	Commander command.Commander

	TaskMaster       *kapacitor.TaskMaster
	TaskMasterLookup *kapacitor.TaskMasterLookup

	LoadService           *load.Service
	SideloadService       *sideload.Service
	AuthService           auth.Interface
	HTTPDService          *httpd.Service
	StorageService        *storage.Service
	AlertService          *alert.Service
	TaskStore             *task_store.Service
	ReplayService         *replay.Service
	SessionService        *diagnostic.SessionService
	InfluxDBService       *influxdb.Service
	ConfigOverrideService *config.Service
	TesterService         *servicetest.Service
	StatsService          *stats.Service

	ScraperService *scraper.Service

	MetaClient    *kapacitor.NoopMetaClient
	QueryExecutor *Queryexecutor

	// List of services in startup order
	Services []Service
	// Map of service name to index in Services list
	ServicesByName map[string]int

	// Map of services capable of receiving dynamic configuration updates.
	DynamicServices map[string]Updater

	BuildInfo BuildInfo

	ClusterID uuid.UUID
	ServerID  uuid.UUID

	// Profiling
	CPUProfile string
	MemProfile string

	DiagService *diagnostic.Service
	Diag        Diagnostic
	// contains filtered or unexported fields
}

Server represents a container for the metadata and storage data and services. It is built using a Config and it manages the startup and shutdown of all services in the proper order.

func New

func New(c *Config, buildInfo BuildInfo, diagService *diagnostic.Service) (*Server, error)

New returns a new instance of Server built from a config.

func (*Server) AppendService

func (s *Server) AppendService(name string, srv Service)

func (*Server) Close

func (s *Server) Close() error

Close shuts down the meta and data stores and all services.

func (*Server) Err

func (s *Server) Err() <-chan error

Err returns an error channel that multiplexes all out of band errors received from all services.

func (*Server) Open

func (s *Server) Open() error

Open opens all the services.

func (*Server) Reload added in v1.4.0

func (s *Server) Reload()

func (*Server) SetClusterID added in v1.3.0

func (s *Server) SetClusterID(clusterID uuid.UUID) error

func (*Server) SetDynamicService added in v1.1.0

func (s *Server) SetDynamicService(name string, srv dynamicService)

type Service

type Service interface {
	Open() error
	Close() error
}

Service represents a service attached to the server.

type Updater added in v1.1.0

type Updater interface {
	Update(c []interface{}) error
}

Updater represents a service that can have its configuration updated while running.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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