agent

package
v0.0.0-...-c12f8f0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package agent runs readers, writers, and HTTP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	ID                 string
	Tags               map[string]string
	AccessTokens       []string
	Configs            *resourced_config.Configs
	GeneralConfig      resourced_config.GeneralConfig
	DbPath             string
	StatsDMetrics      metrics.Registry
	ResultDB           *gocache.Cache
	ExecutorCounterDB  *libmap.TSafeMapCounter
	LiveLogPubSub      *pubsub.PubSub
	LiveLogSubscribers map[string]chan interface{}
}

Agent struct carries most of the functionality of ResourceD. It collects information through readers and serve them up as HTTP+JSON.

func New

func New(configDir string) (*Agent, error)

New is the constructor for Agent struct.

func (*Agent) AuthorizeMiddleware

func (a *Agent) AuthorizeMiddleware(next http.Handler) http.Handler

AuthorizeMiddleware wraps all other handlers; returns 403 for clients that aren't authorized to connect.

func (*Agent) DefaultLogrusFieldsForHTTP

func (a *Agent) DefaultLogrusFieldsForHTTP() logrus.Fields

func (*Agent) FlushStatsDMetricsToResultDB

func (a *Agent) FlushStatsDMetricsToResultDB(statsInterval time.Duration)

func (*Agent) GetByPathHandler

func (a *Agent) GetByPathHandler(dataType string) http.Handler

GetByPathHandler returns data by a specific path.

func (*Agent) GetDataTypePathsHandler

func (a *Agent) GetDataTypePathsHandler() http.Handler

GetDataTypePathsHandler returns path to all data by type.

func (*Agent) GetExecutorsHandler

func (a *Agent) GetExecutorsHandler() http.Handler

GetExecutorsHandler returns all executors data stored in memory.

func (*Agent) GetLogPathsHandler

func (a *Agent) GetLogPathsHandler() http.Handler

GetLogPathsHandler returns all log paths.

func (*Agent) GetLogsHandler

func (a *Agent) GetLogsHandler() http.Handler

GetLogsHandler returns all logs data stored in memory.

func (*Agent) GetPathsHandler

func (a *Agent) GetPathsHandler() http.Handler

GetPathsHandler returns paths to all data.

func (*Agent) GetReadersHandler

func (a *Agent) GetReadersHandler() http.Handler

GetReadersHandler returns all readers data stored in memory.

func (*Agent) GetRunByPath

func (a *Agent) GetRunByPath(path string) ([]byte, error)

GetRunByPath returns JSON data stored in local storage given path string.

func (*Agent) GetWritersHandler

func (a *Agent) GetWritersHandler() http.Handler

GetWritersHandler returns all writers data stored in memory.

func (*Agent) HandleGraphite

func (a *Agent) HandleGraphite(dataInBytes []byte)

func (*Agent) HandleLog

func (a *Agent) HandleLog(dataInBytes []byte)

func (*Agent) HandleStatsD

func (a *Agent) HandleStatsD(dataInBytes []byte)

func (*Agent) HeadRootHandler

func (a *Agent) HeadRootHandler() http.Handler

HeadRootHandler returns empty body. This is useful for curl -I.

func (*Agent) HttpRouter

func (a *Agent) HttpRouter() *mux.Router

HttpRouter returns HTTP router.

func (*Agent) IsAllowed

func (a *Agent) IsAllowed(givenToken string) bool

Check if a given access token is allowed.

func (*Agent) NewMetricsRegistryForSelf

func (a *Agent) NewMetricsRegistryForSelf() metrics.Registry

func (*Agent) NewTCPClient

func (a *Agent) NewTCPClient(addr string) (*net.TCPConn, error)

NewTCPClient creates a TCP connection.

func (*Agent) NewTCPServer

func (a *Agent) NewTCPServer(config resourced_config.ITCPServer, name string) (net.Listener, error)

NewTCPServer creates a TCP server.

func (*Agent) NewUDPServer

func (a *Agent) NewUDPServer(config resourced_config.ITCPServer, name string) (*net.UDPConn, error)

NewUDPServer creates a UDP server.

func (*Agent) Run

func (a *Agent) Run(config resourced_config.Config) (output []byte, err error)

Run executes a reader/writer/executor/log config.

func (*Agent) RunAllForever

func (a *Agent) RunAllForever()

RunAllForever runs everything in an infinite loop.

func (*Agent) RunExecutorForever

func (a *Agent) RunExecutorForever(config resourced_config.Config)

RunExecutorForever in an infinite loop with a sleep of config.Interval.

func (*Agent) RunForever

func (a *Agent) RunForever(config resourced_config.Config)

RunForever executes Run() in an infinite loop with a sleep of config.Interval.

func (*Agent) RunLoggerForever

func (a *Agent) RunLoggerForever(config resourced_config.Config)

Jump to

Keyboard shortcuts

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