server

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2017 License: MIT Imports: 52 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
}

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"`
	InfluxDB       []influxdb.Config `toml:"influxdb" override:"influxdb,element-key=name"`
	Logging        logging.Config    `toml:"logging"`
	ConfigOverride config.Config     `toml:"config-override"`
	Alert          alert.Config      `toml:"alert"`

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

	// Alert handlers
	Alerta    alerta.Config    `toml:"alerta" override:"alerta"`
	HipChat   hipchat.Config   `toml:"hipchat" override:"hipchat"`
	OpsGenie  opsgenie.Config  `toml:"opsgenie" override:"opsgenie"`
	PagerDuty pagerduty.Config `toml:"pagerduty" override:"pagerduty"`
	SMTP      smtp.Config      `toml:"smtp" override:"smtp"`
	SNMPTrap  snmptrap.Config  `toml:"snmptrap" override:"snmptrap"`
	Sensu     sensu.Config     `toml:"sensu" override:"sensu"`
	Slack     slack.Config     `toml:"slack" override:"slack"`
	Talk      talk.Config      `toml:"talk" override:"talk"`
	Telegram  telegram.Config  `toml:"telegram" override:"telegram"`
	VictorOps victorops.Config `toml:"victorops" override:"victorops"`

	// Third-party integrations
	Kubernetes k8s.Config `toml:"kubernetes" override:"kubernetes"`

	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 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

	AuthService           auth.Interface
	HTTPDService          *httpd.Service
	StorageService        *storage.Service
	AlertService          *alert.Service
	TaskStore             *task_store.Service
	ReplayService         *replay.Service
	InfluxDBService       *influxdb.Service
	ConfigOverrideService *config.Service
	TesterService         *servicetest.Service
	StatsService          *stats.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 string
	ServerID  string

	// Profiling
	CPUProfile string
	MemProfile string

	LogService logging.Interface
	Logger     *log.Logger
	// 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, logService logging.Interface) (*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) 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.

Jump to

Keyboard shortcuts

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