Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPE DL360 Gen 10 drive metrics enhancement #32

Merged
merged 11 commits into from
Mar 4, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ project adheres to [Semantic Versioning](http://semver.org/) and this change
log is based on the [Keep a CHANGELOG](http://keepachangelog.com/) project.

## Unreleased
- Enhanced drive metrics collection for HPE DL360 model servers to include NVME, Storage Disk Drives, and Logical Drives. [#31](https://github.com/Comcast/fishymetrics/issues/31)
jenniferKaiser21 marked this conversation as resolved.
Show resolved Hide resolved

## Added
- Add ability to reference different vault paths for credential retrieval [#25](https://github.com/Comcast/fishymetrics/issues/25)
Expand Down
107 changes: 92 additions & 15 deletions hpe/dl360/drive.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Comcast Cable Communications Management, LLC
* Copyright 2024 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,18 +16,95 @@

package dl360

// /redfish/v1/Systems/1/SmartStorage/ArrayControllers/0/LogicalDrives/1

// DriveMetrics is the top level json object for DL360 Drive metadata
type DriveMetrics struct {
ID string `json:"Id"`
CapacityMiB int `json:"CapacityMiB"`
Description string `json:"Description"`
InterfaceType string `json:"InterfaceType"`
LogicalDriveName string `json:"LogicalDriveName"`
LogicalDriveNumber int `json:"LogicalDriveNumber"`
Name string `json:"Name"`
Raid string `json:"Raid"`
Status Status `json:"Status"`
StripeSizeBytes int `json:"StripeSizeBytes"`
// NVME's
// /redfish/v1/chassis/1/
type NVMeDriveMetrics struct {
ID string `json:"Id"`
Model string `json:"Model"`
Name string `json:"Name"`
MediaType string `json:"MediaType"`
PhysicalLocation PhysicalLocation `json:"PhysicalLocation"`
Protocol string `json:"Protocol"`
Status DriveStatus `json:"Status"`
FailurePredicted bool `json:"FailurePredicted"`
CapacityBytes int `json:"CapacityBytes"`
}

// Logical Drives
// /redfish/v1/Systems/1/SmartStorage/ArrayControllers/
type LogicalDriveMetrics struct {
Id string `json:"Id"`
CapacityMiB int `json:"CapacityMiB"`
Description string `json:"Description"`
InterfaceType string `json:"InterfaceType"`
LogicalDriveName string `json:"LogicalDriveName"`
LogicalDriveNumber int `json:"LogicalDriveNumber"`
Name string `json:"Name"`
Raid string `json:"Raid"`
Status DriveStatus `json:"Status"`
StripeSizebytes int `json:"StripeSizebytes"`
VolumeUniqueIdentifier string `json:"VolumeUniqueIdentifier"`
}

// Disk Drives
// /redfish/v1/Systems/1/SmartStorage/ArrayControllers/
type DiskDriveMetrics struct {
Id string `json:"Id"`
CapacityMiB int `json:"CapacityMiB"`
Description string `json:"Description"`
InterfaceType string `json:"InterfaceType"`
Name string `json:"Name"`
Model string `json:"Model"`
Status DriveStatus `json:"Status"`
Location string `json:"Location"`
SerialNumber string `json:"SerialNumber"`
}

// NVME, Logical, and Physical Disk Drive Status
type DriveStatus struct {
Health string `json:"Health,omitempty"`
State string `json:"Enabled,omitempty"`
}

// GenericDrive is used to iterate over differing drive endpoints
// /redfish/v1/Systems/1/SmartStorage/ArrayControllers/ for Logical and Physical Drives
// /redfish/v1/Chassis/1/Drives/ for NVMe Drive(s)
type GenericDrive struct {
Members []struct {
URL string `json:"@odata.id"`
} `json:"Members,omitempty"`
Links struct {
Drives []struct {
URL string `json:"@odata.id"`
} `json:"Drives,omitempty"`
LogicalDrives struct {
URL string `json:"@odata.id"`
} `json:"LogicalDrives,omitempty"`
PhysicalDrives struct {
URL string `json:"@odata.id"`
} `json:"PhysicalDrives,omitempty"`
} `json:"Links,omitempty"`
MembersCount int `json:"Members@odata.count,omitempty"`
}

// PhysicalLocation
type PhysicalLocation struct {
PartLocation PartLocation `json:"PartLocation"`
}

// PartLocation is a variable that determines the Box and the Bay location of the NVMe drive
type PartLocation struct {
ServiceLabel string `json:"ServiceLabel"`
}

// Contents of Oem
type Oem struct {
Hpe HpeCont `json:"Hpe"`
}

// Contents of Hpe
type HpeCont struct {
CurrentTemperatureCelsius int `json:"CurrentTemperatureCelsius"`
DriveStatus DriveStatus `json:"Status"`
NVMeID string `json:"NVMeId"`
}
Loading