Documentation ¶
Index ¶
- Variables
- func MakeGetParsedNagiosEndpoint(svc NagiosParserSvc) endpoint.Endpoint
- func MakeHTTPHandler(svc NagiosParserSvc, cacher *cache.Cache, limiter *rate.Limiter) http.Handler
- func MakeRefreshNagiosDataEndpoint(svc NagiosParserSvc) endpoint.Endpoint
- type Endpoints
- type Middleware
- type NagiosParserSvc
- type NagiosStatusResponse
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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