diff --git a/README.md b/README.md index 1f12869..124f80a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Magellan -Magellan is a small tool designed to scan a network and collect BMC information -to load the data into an [`hms-smd`](https://github.com/alexlovelltroy/hms-smd/tree/master) instance. +Magellan is a board management controller discovery tool designed to scan a network +and collect information about a BMC node and load that data into an +[`hms-smd`](https://github.com/bikeshack/smd/tree/master) instance. ## How It Works @@ -13,9 +14,13 @@ Magellan is designed to do three things: Magellan first tries to probe for specified hosts using the [`dora`](https://github.com/bmc-toolbox/dora) API. If that fails, it then tries to use its own built-in, simpler scanner as a fallback. -Next, it tries to query information about the BMC node using `bmclib` functions, but requires -access to a redfish interface on the node to work. Once the BMC information is received, -it is then stored into `hms-smd` using its API. +This is done by sending a raw TCP request to a number of potential hosts over a +network, and noting which requests are successful. At this point, `magellan` sees +no difference between a services. + +Next, it tries to query information about the BMC node using `bmclib` functions, +but requires access to a redfish interface on the node to work. Once the BMC +information is received, it is then stored into `hms-smd` using its API. In summary, `magellan` needs at minimum the following configured to work on each node: @@ -33,7 +38,7 @@ cd magellan go mod tidy && go build ``` -This should find and download all of the required dependencies. Although other +This should find and download all of the required dependencies. Although other versions of Go may work, the project has only been tested with v1.20. ## Usage diff --git a/internal/api/smd/smd.go b/internal/api/smd/smd.go index a8369ea..67a56d1 100644 --- a/internal/api/smd/smd.go +++ b/internal/api/smd/smd.go @@ -51,9 +51,7 @@ func AddRedfishEndpoint(data []byte, headers map[string]string) error { // Add redfish endpoint via POST `/hsm/v2/Inventory/RedfishEndpoints` endpoint url := makeEndpointUrl("/Inventory/RedfishEndpoints") res, body, err := util.MakeRequest(url, "POST", data, headers) - fmt.Printf("smd url: %v\n", url) - fmt.Printf("res: %v\n", res.Status) - fmt.Printf("body: %v\n", string(body)) + fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body)) if res != nil { if res.StatusCode != http.StatusOK { return fmt.Errorf("could not add redfish endpoint") @@ -69,9 +67,7 @@ func UpdateRedfishEndpoint(xname string, data []byte, headers map[string]string) // Update redfish endpoint via PUT `/hsm/v2/Inventory/RedfishEndpoints` endpoint url := makeEndpointUrl("/Inventory/RedfishEndpoints/" + xname) res, body, err := util.MakeRequest(url, "PUT", data, headers) - fmt.Printf("smd url: %v\n", url) - fmt.Printf("res: %v\n", res.Status) - fmt.Printf("body: %v\n", string(body)) + fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body)) if res != nil { if res.StatusCode != http.StatusOK { return fmt.Errorf("could not update redfish endpoint") diff --git a/internal/collect.go b/internal/collect.go index 9ca35b9..76dcf06 100644 --- a/internal/collect.go +++ b/internal/collect.go @@ -638,6 +638,9 @@ func QueryProcessors(q *QueryParams) ([]byte, error) { func connectGofish(q *QueryParams) (*gofish.APIClient, error) { config := makeGofishConfig(q) c, err := gofish.Connect(config) + if err != nil { + return nil, err + } c.Service.ProtocolFeaturesSupported = gofish.ProtocolFeaturesSupported{ ExpandQuery: gofish.Expand{ ExpandAll: true,