mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-25 23:19:06 +01:00
Fix for API changes in gofish@v0.15.0
This commit is contained in:
parent
9b671ce68f
commit
06ca37e705
@ -328,7 +328,7 @@ func (r *RedfishReceiver) readProcessorMetrics(
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := processor.Client.Get(URL)
|
resp, err := processor.GetClient().Get(URL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Skip non existing URLs
|
// Skip non existing URLs
|
||||||
if statusCode := err.(*common.Error).HTTPReturnedStatusCode; statusCode == http.StatusNotFound {
|
if statusCode := err.(*common.Error).HTTPReturnedStatusCode; statusCode == http.StatusNotFound {
|
||||||
@ -336,7 +336,7 @@ func (r *RedfishReceiver) readProcessorMetrics(
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("processor.Client.Get(%v) failed: %+w", URL, err)
|
return fmt.Errorf("processor.GetClient().Get(%v) failed: %+w", URL, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var processorMetrics struct {
|
var processorMetrics struct {
|
||||||
@ -351,7 +351,7 @@ func (r *RedfishReceiver) readProcessorMetrics(
|
|||||||
}
|
}
|
||||||
body, err := io.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to read JSON for processor metrics: %+w", err)
|
return fmt.Errorf("unable to read response body for processor metrics: %+w", err)
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(body, &processorMetrics)
|
err = json.Unmarshal(body, &processorMetrics)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -361,7 +361,6 @@ func (r *RedfishReceiver) readProcessorMetrics(
|
|||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
processorMetrics.SetClient(processor.Client)
|
|
||||||
|
|
||||||
// Set tags
|
// Set tags
|
||||||
tags := map[string]string{
|
tags := map[string]string{
|
||||||
@ -724,6 +723,7 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {
|
|||||||
|
|
||||||
clientConfigJSON := &configJSON.ClientConfigs[i]
|
clientConfigJSON := &configJSON.ClientConfigs[i]
|
||||||
|
|
||||||
|
// Redfish endpoint
|
||||||
var endpoint_pattern string
|
var endpoint_pattern string
|
||||||
if clientConfigJSON.Endpoint != nil {
|
if clientConfigJSON.Endpoint != nil {
|
||||||
endpoint_pattern = *clientConfigJSON.Endpoint
|
endpoint_pattern = *clientConfigJSON.Endpoint
|
||||||
@ -735,6 +735,7 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Redfish username
|
||||||
var username string
|
var username string
|
||||||
if clientConfigJSON.Username != nil {
|
if clientConfigJSON.Username != nil {
|
||||||
username = *clientConfigJSON.Username
|
username = *clientConfigJSON.Username
|
||||||
@ -746,6 +747,7 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Redfish password
|
||||||
var password string
|
var password string
|
||||||
if clientConfigJSON.Password != nil {
|
if clientConfigJSON.Password != nil {
|
||||||
password = *clientConfigJSON.Password
|
password = *clientConfigJSON.Password
|
||||||
@ -816,6 +818,7 @@ func NewRedfishReceiver(name string, config json.RawMessage) (Receiver, error) {
|
|||||||
r.config.fanout = numClients
|
r.config.fanout = numClients
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that at least on client config exists
|
||||||
if numClients == 0 {
|
if numClients == 0 {
|
||||||
err := fmt.Errorf("at least one client config is required")
|
err := fmt.Errorf("at least one client config is required")
|
||||||
cclog.ComponentError(r.name, err)
|
cclog.ComponentError(r.name, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user