Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
411 changes: 283 additions & 128 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cmd/collectors/eseries/eseries.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func (e *ESeries) pollData(mat *matrix.Matrix, results []gjson.Result) uint64 {
for _, k := range e.Prop.InstanceKeys {
value := instanceData.Get(k)
if value.Exists() {
instanceKey.WriteString(value.String())
instanceKey.WriteString(value.ClonedString())
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/collectors/eseries/hostcluster/hostcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ func BuildHostClusterLookup(client *rest.Client, arrayID string, logger *slog.Lo
}

for _, host := range hosts {
hostRef := host.Get("hostRef").String()
hostRef := host.Get("hostRef").ClonedString()
if hostRef == "" {
hostRef = host.Get("id").String()
hostRef = host.Get("id").ClonedString()
}
hostName := host.Get("name").String()
hostName := host.Get("name").ClonedString()
if hostName == "" {
hostName = host.Get("label").String()
hostName = host.Get("label").ClonedString()
}
if hostRef != "" && hostName != "" {
hostClusterNames[hostRef] = hostName
Expand Down
14 changes: 7 additions & 7 deletions cmd/collectors/eseries/plugins/hardware/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (h *Hardware) initCodeVersionMatrix() {
instanceLabels.NewChildS("", "controller_id")
instanceLabels.NewChildS("", "controller")
instanceLabels.NewChildS("", "code_module")
instanceLabels.NewChildS("", "version_string")
instanceLabels.NewChildS("", "version")

mat.SetExportOptions(exportOptions)

Expand Down Expand Up @@ -302,17 +302,17 @@ func (h *Hardware) processController(controller gjson.Result, controllerID strin
// Set metrics
if m := mat.GetMetric("used_cache_memory"); m != nil {
if val := controller.Get("cacheMemorySize"); val.Exists() {
m.SetValueFloat64(inst, val.Float())
m.SetValueFloat64(inst, float64(val.Uint()*1024*1024))
}
}
if m := mat.GetMetric("total_cache_memory"); m != nil {
if val := controller.Get("physicalCacheMemorySize"); val.Exists() {
m.SetValueFloat64(inst, val.Float())
m.SetValueFloat64(inst, float64(val.Uint()*1024*1024))
}
}
if m := mat.GetMetric("processor_memory"); m != nil {
if val := controller.Get("processorMemorySize"); val.Exists() {
m.SetValueFloat64(inst, val.Float())
m.SetValueFloat64(inst, float64(val.Uint()*1024*1024))
}
}

Expand Down Expand Up @@ -437,7 +437,7 @@ func (h *Hardware) processCodeVersions(controller gjson.Result, controllerID, co
inst.SetLabelTrimmed("controller_id", controllerID)
inst.SetLabelTrimmed("controller", controllerLocation)
inst.SetLabelTrimmed("code_module", codeModule)
inst.SetLabelTrimmed("version_string", versionString)
inst.SetLabelTrimmed("version", versionString)
}
}

Expand Down Expand Up @@ -740,7 +740,7 @@ func (h *Hardware) processCacheMemoryDimms(response gjson.Result, controllerLabe
inst.SetLabelTrimmed("status", dimm.Get("status").ClonedString())
if val := dimm.Get("capacityInMegabytes"); val.Exists() {
if m := mat.GetMetric("capacity"); m != nil {
m.SetValueFloat64(inst, float64(val.Int()))
m.SetValueFloat64(inst, float64(val.Uint()*1024*1024))
}
}
inst.SetLabelTrimmed("serial_number", dimm.Get("serialNumber").ClonedString())
Expand Down Expand Up @@ -788,7 +788,7 @@ func (h *Hardware) processCacheBackupDevices(response gjson.Result, controllerLa
inst.SetLabelTrimmed("device_type", device.Get("backupDeviceType").ClonedString())
if val := device.Get("backupDeviceCapacity"); val.Exists() {
if m := mat.GetMetric("capacity"); m != nil {
m.SetValueFloat64(inst, float64(val.Int()))
m.SetValueFloat64(inst, float64(val.Uint()*1024*1024))
}
}
inst.SetLabelTrimmed("serial_number", device.Get("backupDeviceVpd.serialNumber").ClonedString())
Expand Down
30 changes: 15 additions & 15 deletions cmd/collectors/eseries/plugins/volumemapping/volumemapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ func (v *VolumeMapping) buildPoolLookup(systemID string) (map[string]string, err
}

for _, pool := range pools {
poolRef := pool.Get("id").String()
poolRef := pool.Get("id").ClonedString()
if poolRef == "" {
poolRef = pool.Get("volumeGroupRef").String()
poolRef = pool.Get("volumeGroupRef").ClonedString()
}
poolName := pool.Get("name").String()
poolName := pool.Get("name").ClonedString()
if poolName == "" {
poolName = pool.Get("label").String()
poolName = pool.Get("label").ClonedString()
}
if poolRef != "" && poolName != "" {
poolNames[poolRef] = poolName
Expand All @@ -176,13 +176,13 @@ func (v *VolumeMapping) buildHostLookup(systemID string) (map[string]string, err
}

for _, host := range hosts {
hostRef := host.Get("hostRef").String()
hostRef := host.Get("hostRef").ClonedString()
if hostRef == "" {
hostRef = host.Get("id").String()
hostRef = host.Get("id").ClonedString()
}
hostName := host.Get("name").String()
hostName := host.Get("name").ClonedString()
if hostName == "" {
hostName = host.Get("label").String()
hostName = host.Get("label").ClonedString()
}
if hostRef != "" && hostName != "" {
hostNames[hostRef] = hostName
Expand All @@ -203,8 +203,8 @@ func (v *VolumeMapping) buildWorkloadLookup(systemID string) (map[string]string,
}

for _, workload := range workloads {
workloadID := workload.Get("id").String()
workloadName := workload.Get("name").String()
workloadID := workload.Get("id").ClonedString()
workloadName := workload.Get("name").ClonedString()
if workloadID != "" && workloadName != "" {
workloadNames[workloadID] = workloadName
}
Expand All @@ -228,9 +228,9 @@ func (v *VolumeMapping) addLunAndHostLabels(volumeInstance *matrix.Instance, hos
var luns, hosts, types []string

for _, mapping := range mappings.Array() {
lun := mapping.Get("lun").String()
mapRef := mapping.Get("mapRef").String()
mapType := mapping.Get("type").String()
lun := mapping.Get("lun").ClonedString()
mapRef := mapping.Get("mapRef").ClonedString()
mapType := mapping.Get("type").ClonedString()

if mapRef == "" {
continue
Expand Down Expand Up @@ -302,8 +302,8 @@ func (v *VolumeMapping) addWorkloadLabel(volumeInstance *matrix.Instance, worklo

var workloadID string
for _, item := range metadata.Array() {
if item.Get("key").String() == "workloadId" {
workloadID = item.Get("value").String()
if item.Get("key").ClonedString() == "workloadId" {
workloadID = item.Get("value").ClonedString()
break
}
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/collectors/eseries/rest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,9 @@ func (c *Client) get(endpoint string, headers ...map[string]string) ([]gjson.Res
results, err = doInvoke()

if err != nil {
var he errs.HarvestError
if errors.As(err, &he) {
if errors.Is(he, errs.ErrAuthFailed) {
var re *errs.RestError
if errors.As(err, &re) {
if errors.Is(re, errs.ErrAuthFailed) {
pollerAuth, err2 := c.auth.GetPollerAuth()
if err2 != nil {
return nil, err2
Expand Down Expand Up @@ -386,8 +386,8 @@ func (c *Client) getBundleDisplayVersion(systemID string) (string, error) {
}

for _, version := range codeVersions.Array() {
if version.Get("codeModule").String() == "bundleDisplay" {
versionString := version.Get("versionString").String()
if version.Get("codeModule").ClonedString() == "bundleDisplay" {
versionString := version.Get("versionString").ClonedString()
if versionString != "" {
normalized := c.normalizeBundleVersion(versionString)
if normalized == "" {
Expand Down
Loading
Loading