diff --git a/receivers/httpReceiver.go b/receivers/httpReceiver.go index efd31ac..578ccff 100644 --- a/receivers/httpReceiver.go +++ b/receivers/httpReceiver.go @@ -54,15 +54,22 @@ func (r *HttpReceiver) Init(name string, config json.RawMessage) error { if !strings.HasPrefix(p, "/") { p = "/" + p } - uri := fmt.Sprintf("%s:%s%s", r.config.Addr, r.config.Port, p) - cclog.ComponentDebug(r.name, "INIT", uri) + addr := fmt.Sprintf("%s:%s", r.config.Addr, r.config.Port) + uri := addr + p + cclog.ComponentDebug(r.name, "INIT", "listen on:", uri) r.handler = influx.NewMetricHandler() r.parser = influx.NewParser(r.handler) r.parser.SetTimeFunc(DefaultTime) + // Create new router and register p as path r.router = mux.NewRouter() r.router.Path(p).HandlerFunc(r.ServerHttp) - r.server = &http.Server{Addr: uri, Handler: r.router} + + // Create http server, with router as handler + r.server = &http.Server{ + Addr: addr, + Handler: r.router, + } return nil } diff --git a/receivers/receiveManager.go b/receivers/receiveManager.go index 31853fe..47325b2 100644 --- a/receivers/receiveManager.go +++ b/receivers/receiveManager.go @@ -11,6 +11,7 @@ import ( ) var AvailableReceivers = map[string]func(name string, config json.RawMessage) (Receiver, error){ + "http": NewHttpReceiver, "ipmi": NewIPMIReceiver, "nats": NewNatsReceiver, "redfish": NewRedfishReceiver,