svc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrJSONUnMarshall indicates a bad request where json unmarshalling failed
	ErrJSONUnMarshall = errors.New("failed to parse json")
)

Functions

func MakeGetParsedNagiosEndpoint

func MakeGetParsedNagiosEndpoint(svc NagiosParserSvc) endpoint.Endpoint

MakeGetParsedNagiosEndpoint returns an endpoint to get Parsed Nagios Data from multiple nagios instances

func MakeHTTPHandler

func MakeHTTPHandler(svc NagiosParserSvc, cacher *cache.Cache, limiter *rate.Limiter) http.Handler

MakeHTTPHandler returns an http handler for the endpoints

func MakeRefreshNagiosDataEndpoint

func MakeRefreshNagiosDataEndpoint(svc NagiosParserSvc) endpoint.Endpoint

MakeRefreshNagiosDataEndpoint returns an endpoint to refresh nagios data from new status files

Types

type Endpoints

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

Endpoints is a struct containing all the endpoints for the NagiosParserService

func MakeServerEndpoints

func MakeServerEndpoints(svc NagiosParserSvc, cacher *cache.Cache, limiter *rate.Limiter) Endpoints

MakeServerEndpoints returns a struct with all the Endpoints for the NagiosParserService

type Middleware

type Middleware func(NagiosParserSvc) NagiosParserSvc

Middleware is a service middleware builder

func CachingMiddleware

func CachingMiddleware(cacher *cache.Cache) Middleware

CachingMiddleware produces a caching middleware builder. This is a service middleware

func InstrumentingMiddleware

func InstrumentingMiddleware(requests metrics.Counter, requestDuration metrics.Histogram, numHosts metrics.Histogram) Middleware

InstrumentingMiddleware produces an instrumenting middleware builder. This is a service middleware

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) Middleware

LoggingMiddleware produces a logging middleware builder. This is a service middleware

type NagiosParserSvc

type NagiosParserSvc interface {
	GetParsedNagios(ctx context.Context) (map[string][]parser.NagiosStatus, error)
	RefreshNagiosData(ctx context.Context) error
}

NagiosParserSvc is a service that returns aggregated data from various nagios sources

func NewNagiosParserSvc

func NewNagiosParserSvc(statusDir, localDB string) (NagiosParserSvc, error)

NewNagiosParserSvc returns a boltdb backed nagios parser service

type NagiosStatusResponse

type NagiosStatusResponse struct {
	State            string    `json:"state,omitempty"`
	Output           string    `json:"output,omitempty"`
	Service          string    `json:"service,omitempty"`
	Attempts         string    `json:"attempts,omitempty"`
	LastCheck        time.Time `json:"last_check,omitempty"`
	NextCheck        time.Time `json:"next_check,omitempty"`
	LastStateChanged time.Time `json:"last_state_changed,omitempty"`
}

NagiosStatusResponse is a filtered structure for Nagios data to be returned to the client

Jump to

Keyboard shortcuts

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