core

package
v0.0.0-...-2ff6a3e Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = lg.NewLogger("EYE ")

Functions

func ChecksKey

func ChecksKey(strictness string, serviceNames []string) string

func TimeoutContext

func TimeoutContext(timeout time.Duration) context.Context

Types

type Check

type Check interface {
	Info() string
	Query() (QueryResults, error)
	Validate() error
}

type CommandRequest

type CommandRequest struct {
}

type CompositeQueryResult

type CompositeQueryResult struct {
	Splitter *regexp.Regexp
	Data     []QueryResult
}

func NewCompositeQueryResult

func NewCompositeQueryResult(separator string, data []QueryResult) (ret *CompositeQueryResult, err error)

func (*CompositeQueryResult) Get

func (o *CompositeQueryResult) Get(name string) (ret interface{}, err error)

func (*CompositeQueryResult) String

func (o *CompositeQueryResult) String() (ret string)

type Config

type Config struct {
	Name         string `default:"Eye"`
	Port         int    `default:"3000"`
	Debug        bool   `default:true`
	ExportFolder string `default:"./export"`
	AppHome      string `default:"."`

	MySql   []*MySql
	Http    []*Http
	Fs      []*Fs
	Ps      []*Ps
	Elastic []*Elastic

	PingAny []*PingCheck
	PingAll []*PingCheck

	Validate []*ValidateCheck

	ValidateAny     []*ValidateCheck
	ValidateRunning []*ValidateCheck
	ValidateAll     []*ValidateCheck

	CompareRunning []*ValidateCheck
	CompareAll     []*ValidateCheck

	FieldsExporter []*FieldsExporter

	FileExporter []*FileExporter

	Executor []*SimpleExecutor

	ConfigFiles    []string
	ConfigSuffixes []string
}

func LoadConfig

func LoadConfig(files []string, suffixes []string, appHome string) (ret *Config, err error)

func (*Config) ExtractAccessKeys

func (o *Config) ExtractAccessKeys() (ret []string)

func (*Config) Print

func (o *Config) Print()

func (*Config) Reload

func (o *Config) Reload() (ret *Config, err error)

type Elastic

type Elastic struct {
	Name       string `default:"elastic"`
	Host       string `default:"localhost"`
	Port       int    `default:"9200"`
	ScrollSize int    `default:"500"`

	Index string

	PingTimeoutMillis  int
	QueryTimeoutMillis int
}

type ElasticService

type ElasticService struct {
	// contains filtered or unexported fields
}

func (*ElasticService) Close

func (o *ElasticService) Close()

func (*ElasticService) Init

func (o *ElasticService) Init() (err error)

func (*ElasticService) Name

func (o *ElasticService) Name() string

func (*ElasticService) NewExecutor

func (o *ElasticService) NewExecutor(req *CommandRequest) (ret Executor, err error)

func (*ElasticService) NewExporter

func (o *ElasticService) NewExporter(req *ExportRequest) (ret Exporter, err error)

func (*ElasticService) NewСheck

func (o *ElasticService) NewСheck(req *ValidationRequest) (ret Check, err error)

func (*ElasticService) Ping

func (o *ElasticService) Ping() (err error)

type Executor

type Executor interface {
	Info() string
	Execute(params map[string]string) error
}

type ExportRequest

type ExportRequest struct {
	Query     string
	EvalExpr  string
	Convert   func(map[string]interface{}) (io.Reader, error)
	CreateOut func(params map[string]string) (io.WriteCloser, error)
}

func (*ExportRequest) ExportKey

func (o *ExportRequest) ExportKey(serviceName string) string

type Exporter

type Exporter interface {
	Info() string
	Export(params map[string]string) error
}

type Eye

type Eye struct {
	// contains filtered or unexported fields
}

func NewEye

func NewEye(config *Config, accessFinder as.AccessFinder) (ret *Eye)

func (*Eye) Check

func (o *Eye) Check(checkName string) (err error)

func (*Eye) Close

func (o *Eye) Close()

func (*Eye) CompareAll

func (o *Eye) CompareAll(serviceNames []string, req *ValidationRequest) (err error)

func (*Eye) CompareRunning

func (o *Eye) CompareRunning(serviceNames []string, req *ValidationRequest) (err error)

func (*Eye) Execute

func (o *Eye) Execute(executorName string, params map[string]string) (err error)

func (*Eye) Export

func (o *Eye) Export(exportName string, params map[string]string) (err error)

func (*Eye) Ping

func (o *Eye) Ping(serviceName string) (err error)

func (*Eye) PingAll

func (o *Eye) PingAll(serviceNames []string) (err error)

func (*Eye) PingAny

func (o *Eye) PingAny(serviceNames []string) (err error)

func (*Eye) UpdateConfig

func (o *Eye) UpdateConfig(config *Config)

func (*Eye) Validate

func (o *Eye) Validate(serviceName string, req *ValidationRequest) (err error)

func (*Eye) ValidateAll

func (o *Eye) ValidateAll(serviceNames []string, req *ValidationRequest) (err error)

func (*Eye) ValidateAny

func (o *Eye) ValidateAny(serviceNames []string, req *ValidationRequest) (err error)

func (*Eye) ValidateRunning

func (o *Eye) ValidateRunning(serviceNames []string, req *ValidationRequest) (err error)

type Factory

type Factory interface {
	Find(name string) (Service, error)
	Close()
}

type FieldsExporter

type FieldsExporter struct {
	Name      string
	Query     string
	EvalExpr  string
	Fields    []string
	Separator string
	Services  []string
}

type FileExporter

type FileExporter struct {
	Name           string
	Query          string
	EvalExpr       string
	Fields         []string
	SourceFileExpr string
	Services       []string
}

type FileInfo

type FileInfo struct {
	Name    string
	Size    int64
	Mode    os.FileMode
	ModTime time.Time
	IsDir   bool
	Path    string
}

func (*FileInfo) ToMap

func (o *FileInfo) ToMap() (ret map[string]interface{})

type Fs

type Fs struct {
	Name        string
	File        string
	PingRequest *ValidationRequest
}

type FsCheck

type FsCheck struct {
	// contains filtered or unexported fields
}

buildCheck

func (*FsCheck) Files

func (o *FsCheck) Files() (ret []*FileInfo, err error)

func (*FsCheck) Info

func (o *FsCheck) Info() string

func (*FsCheck) Query

func (o *FsCheck) Query() (ret QueryResults, err error)

func (*FsCheck) Validate

func (o *FsCheck) Validate() (err error)

type FsService

type FsService struct {
	Fs *Fs
	// contains filtered or unexported fields
}

func (*FsService) Close

func (o *FsService) Close()

func (*FsService) Files

func (o *FsService) Files(file string) (ret []*FileInfo, err error)

func (*FsService) FilesWithFilter

func (o *FsService) FilesWithFilter(file string, eval *govaluate.EvaluableExpression) (ret []*FileInfo, err error)

func (*FsService) Init

func (o *FsService) Init() (err error)

func (*FsService) Name

func (o *FsService) Name() string

func (*FsService) NewExecutor

func (o *FsService) NewExecutor(req *CommandRequest) (ret Executor, err error)

func (*FsService) NewExporter

func (o *FsService) NewExporter(req *ExportRequest) (ret Exporter, err error)

func (*FsService) NewСheck

func (o *FsService) NewСheck(req *ValidationRequest) (ret Check, err error)

func (*FsService) Ping

func (o *FsService) Ping() (err error)

type Http

type Http struct {
	Name      string
	AccessKey string
	Url       string

	PingRequest *ValidationRequest

	PingTimeoutMillis  int
	QueryTimeoutMillis int
}

type HttpService

type HttpService struct {
	// contains filtered or unexported fields
}

func (*HttpService) Close

func (o *HttpService) Close()

func (*HttpService) Init

func (o *HttpService) Init() (err error)

func (*HttpService) Name

func (o *HttpService) Name() string

func (*HttpService) NewExecutor

func (o *HttpService) NewExecutor(req *CommandRequest) (ret Executor, err error)

func (*HttpService) NewExporter

func (o *HttpService) NewExporter(req *ExportRequest) (ret Exporter, err error)

func (*HttpService) NewСheck

func (o *HttpService) NewСheck(req *ValidationRequest) (ret Check, err error)

func (*HttpService) Ping

func (o *HttpService) Ping() error

type MapQueryResult

type MapQueryResult struct {
	Data map[string]interface{}
}

func (*MapQueryResult) Get

func (o *MapQueryResult) Get(name string) (ret interface{}, err error)

func (*MapQueryResult) String

func (o *MapQueryResult) String() (ret string)

type MultiCheck

type MultiCheck struct {
	// contains filtered or unexported fields
}

func (*MultiCheck) Info

func (o *MultiCheck) Info() string

func (*MultiCheck) Query

func (o *MultiCheck) Query() (data QueryResults, err error)

func (*MultiCheck) Validate

func (o *MultiCheck) Validate() (err error)

type MultiPing

type MultiPing struct {
	// contains filtered or unexported fields
}

func (*MultiPing) Info

func (o *MultiPing) Info() string

func (*MultiPing) Query

func (o *MultiPing) Query() (data QueryResults, err error)

func (*MultiPing) Validate

func (o *MultiPing) Validate() (err error)

type MultiValidate

type MultiValidate struct {
	// contains filtered or unexported fields
}

func (*MultiValidate) Info

func (o *MultiValidate) Info() string

func (*MultiValidate) Query

func (o *MultiValidate) Query() (data QueryResults, err error)

func (*MultiValidate) Validate

func (o *MultiValidate) Validate() (err error)

type MySql

type MySql struct {
	Name      string `default:"mysql"`
	AccessKey string `default:"mysql"`

	Host string `default:"localhost"`
	Port int    `default:"3306"`

	Database string

	PingTimeoutMillis  int
	QueryTimeoutMillis int
}

type MySqlService

type MySqlService struct {
	// contains filtered or unexported fields
}

func (*MySqlService) Close

func (o *MySqlService) Close()

func (*MySqlService) Init

func (o *MySqlService) Init() (err error)

func (*MySqlService) Name

func (o *MySqlService) Name() string

func (*MySqlService) NewExecutor

func (o *MySqlService) NewExecutor(req *CommandRequest) (ret Executor, err error)

func (*MySqlService) NewExporter

func (o *MySqlService) NewExporter(req *ExportRequest) (ret Exporter, err error)

func (*MySqlService) NewСheck

func (o *MySqlService) NewСheck(req *ValidationRequest) (ret Check, err error)

func (*MySqlService) Ping

func (o *MySqlService) Ping() (err error)

type PingCheck

type PingCheck struct {
	Name     string
	Services []string
}

type Proc

type Proc struct {
	Id      int
	Name    string
	Status  string
	Cmdline string
	Path    string
}

func (*Proc) ToMap

func (o *Proc) ToMap() (ret map[string]interface{})

type Ps

type Ps struct {
	Name        string
	PingRequest *ValidationRequest
}

type PsCheck

type PsCheck struct {
	// contains filtered or unexported fields
}

buildCheck

func (*PsCheck) Info

func (o *PsCheck) Info() string

func (*PsCheck) Query

func (o *PsCheck) Query() (ret QueryResults, err error)

func (*PsCheck) Validate

func (o *PsCheck) Validate() (err error)

type PsService

type PsService struct {
	Ps *Ps
	// contains filtered or unexported fields
}

func (*PsService) Close

func (o *PsService) Close()

func (*PsService) Init

func (o *PsService) Init() (err error)

func (*PsService) Name

func (o *PsService) Name() string

func (*PsService) NewExecutor

func (o *PsService) NewExecutor(req *CommandRequest) (ret Executor, err error)

func (*PsService) NewExporter

func (o *PsService) NewExporter(req *ExportRequest) (ret Exporter, err error)

func (*PsService) NewСheck

func (o *PsService) NewСheck(req *ValidationRequest) (ret Check, err error)

func (*PsService) Ping

func (o *PsService) Ping() (err error)

func (*PsService) Processes

func (o *PsService) Processes() (ret []*Proc, err error)

type Query

type Query interface {
	Info() string
	Query() (QueryResults, error)
}

type QueryResult

type QueryResult interface {
	Get(name string) (interface{}, error)
	String() string
}

type QueryResultMapWriter

type QueryResultMapWriter struct {
	Data []QueryResult
}

func NewQueryResultMapWriter

func NewQueryResultMapWriter() *QueryResultMapWriter

func (*QueryResultMapWriter) WriteMap

func (o *QueryResultMapWriter) WriteMap(data map[string]interface{}) error

type QueryResults

type QueryResults []QueryResult

func ComposeQueryResults

func ComposeQueryResults(separator string, results []QueryResults) (ret QueryResults, err error)

func (*QueryResults) String

func (o *QueryResults) String() (ret string)

type Service

type Service interface {
	Name() string

	Init() error
	Close()
	Ping() error

	NewСheck(req *ValidationRequest) (Check, error)
	NewExporter(req *ExportRequest) (Exporter, error)
	NewExecutor(req *CommandRequest) (Executor, error)
}

type SimpleExecutor

type SimpleExecutor struct {
	Name     string
	Services []string
}

type SimpleServiceFactory

type SimpleServiceFactory struct {
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory() *SimpleServiceFactory

func (*SimpleServiceFactory) Add

func (o *SimpleServiceFactory) Add(service Service)

func (*SimpleServiceFactory) Close

func (o *SimpleServiceFactory) Close()

func (*SimpleServiceFactory) Find

func (o *SimpleServiceFactory) Find(name string) (ret Service, err error)

type ValidateCheck

type ValidateCheck struct {
	Name     string
	Services []string
	Request  *ValidationRequest
}

type ValidationRequest

type ValidationRequest struct {
	Query    string
	RegExpr  string
	EvalExpr string
	All      bool
}

func NewValidationRequest

func NewValidationRequest(query string, evalExp string) *ValidationRequest

func (*ValidationRequest) CheckKey

func (o *ValidationRequest) CheckKey(serviceName string) string

func (*ValidationRequest) ChecksKey

func (o *ValidationRequest) ChecksKey(strictness string, serviceNames []string) string

Jump to

Keyboard shortcuts

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