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

Adding support for HPE DL380 servers #19

Merged
merged 60 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
877b5a5
Initial commit for addition of HPE DL380
jenniferKaiser21 Feb 7, 2024
90e93ce
Update copyright info
jenniferKaiser21 Feb 7, 2024
09bec39
Initialize drive, exporter, and metrics.go files
jenniferKaiser21 Feb 7, 2024
2e80b17
Add HPE DL380 to cmd/fishymetrics/main.go
jenniferKaiser21 Feb 7, 2024
edbc090
Add DL380 metrics mapping to drive.go
jenniferKaiser21 Feb 8, 2024
79546b7
Update exporter.go to include drive logic handling, added todo items
jenniferKaiser21 Feb 9, 2024
7e9fc41
Update util.go to include todo tasks to add FetchIterate function
jenniferKaiser21 Feb 9, 2024
51f1bc1
Update drive.go to include additional metrics
jenniferKaiser21 Feb 9, 2024
cdb95b1
Update metrics.go to handle various drive metrics
jenniferKaiser21 Feb 9, 2024
45ae777
Update main.go to include DL380 import
jenniferKaiser21 Feb 11, 2024
999db60
Update util.go to include FetchIterate logic and todo
jenniferKaiser21 Feb 11, 2024
423c672
Update drive.go to include Collection struct for urls within the arra…
jenniferKaiser21 Feb 12, 2024
f1ced8d
Update exporter.go to include getArrayControllerEndpoint func
jenniferKaiser21 Feb 12, 2024
1a14e48
Add arrayControllerIterate function to DL380 exporter.go
jenniferKaiser21 Feb 12, 2024
bd50cff
Update drive.go to include ArrayControllerObject and Links structures
jenniferKaiser21 Feb 13, 2024
1ddabdd
Update drive.go to include nested array controller structs
jenniferKaiser21 Feb 13, 2024
f31d17c
Update exporter.go to include looping logic for ArrayController drives
jenniferKaiser21 Feb 13, 2024
cf12aff
Remove fetchIterate function from util.go
jenniferKaiser21 Feb 16, 2024
008060c
Update drive.go
jenniferKaiser21 Feb 16, 2024
e7a45dd
Update exporter.go prep for new logic
jenniferKaiser21 Feb 16, 2024
72ba40d
Update drive.go to include generic drive type
jenniferKaiser21 Feb 16, 2024
e064398
Update exporter.go to include while loop to gather drive endpoints
jenniferKaiser21 Feb 16, 2024
1e2331d
Update exporter.go with refactored drive logic
jenniferKaiser21 Feb 18, 2024
4d084d6
Clean up drive.go dl 380
jenniferKaiser21 Feb 19, 2024
0ebf550
Update exporter.go
jenniferKaiser21 Feb 19, 2024
9a905ab
Update exporter.go
jenniferKaiser21 Feb 19, 2024
3f20723
Update drive.go to include MembersCount in GenericDrive struct
jenniferKaiser21 Feb 19, 2024
ca9da16
Update drive.go with nested GenericDrive struct
jenniferKaiser21 Feb 19, 2024
cb57e2b
Improve logic in exporter.go to match GenericDrive struct
jenniferKaiser21 Feb 19, 2024
fd13595
Update exporter.go
jenniferKaiser21 Feb 19, 2024
04b1f69
Update exporter.go with finished drive exporter logic
jenniferKaiser21 Feb 19, 2024
9b3a071
Update drive.go with cleaned up drive structs
jenniferKaiser21 Feb 19, 2024
64b2425
Update exporter.go
jenniferKaiser21 Feb 19, 2024
940ddcf
Update templates.go with DL380 option
jenniferKaiser21 Feb 19, 2024
56ce1ac
Update metrics.go with drive metrics
jenniferKaiser21 Feb 19, 2024
41ea927
Update exporter.go
jenniferKaiser21 Feb 19, 2024
66f1827
Update exporter.go refactor URL building logic
jenniferKaiser21 Feb 19, 2024
bc52c28
Update exporter.go
jenniferKaiser21 Feb 19, 2024
944f573
Update drive.go
jenniferKaiser21 Feb 19, 2024
efe984d
drive.go refactor with reusable drive status
jenniferKaiser21 Feb 19, 2024
30aa196
Update exporter.go with refactored urls
jenniferKaiser21 Feb 19, 2024
0d21f5b
Update drive.go reorder structs
jenniferKaiser21 Feb 20, 2024
f786b4d
Update metrics.go enhancing metrics output
jenniferKaiser21 Feb 20, 2024
6eb839c
Update drive.go fixed syntax for [email protected] bug
jenniferKaiser21 Feb 20, 2024
b871799
Update exporter.go add debug prints
jenniferKaiser21 Feb 20, 2024
db31fbd
Update exporter.go
jenniferKaiser21 Feb 20, 2024
15bb74f
Update metrics.go
jenniferKaiser21 Feb 20, 2024
bb94550
Update exporter.go
jenniferKaiser21 Feb 20, 2024
b64532f
Update exporter.go with functional exporters
jenniferKaiser21 Feb 20, 2024
6c96e28
Update metrics.go with functional exporters
jenniferKaiser21 Feb 20, 2024
4005b64
Update drive.go with functional structs
jenniferKaiser21 Feb 20, 2024
95a285e
Remove debug print statements in exporter.go
jenniferKaiser21 Feb 20, 2024
64b8f0c
Remove debug print statements in metrics.go
jenniferKaiser21 Feb 20, 2024
8a36d34
Update exporter.go clean up commenting
jenniferKaiser21 Feb 21, 2024
9a4b076
Remove _TEST from metric name in metrics.go
jenniferKaiser21 Feb 21, 2024
0ed5cd4
Update exporter.go to include zap.Error(err) in log.Error
jenniferKaiser21 Feb 21, 2024
3de7ed1
Update casing of chassis_output and chassis_url in exporter.go
jenniferKaiser21 Feb 21, 2024
75c3d50
Update CHANGELOG.md to include HPE DL380 enhancement
jenniferKaiser21 Feb 21, 2024
b410ac0
Update README.md to include DL380 addition
jenniferKaiser21 Feb 21, 2024
8663560
Merge branch 'Comcast:main' into hpe_dl380
jenniferKaiser21 Feb 21, 2024
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
5 changes: 4 additions & 1 deletion cmd/fishymetrics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"github.com/comcast/fishymetrics/config"
"github.com/comcast/fishymetrics/hpe/dl20"
"github.com/comcast/fishymetrics/hpe/dl360"
"github.com/comcast/fishymetrics/hpe/dl380"
"github.com/comcast/fishymetrics/hpe/moonshot"
"github.com/comcast/fishymetrics/logger"
"github.com/comcast/fishymetrics/middleware/muxprom"
Expand Down Expand Up @@ -138,6 +139,8 @@ func handler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
switch moduleName {
case "moonshot":
exporter = moonshot.NewExporter(r.Context(), target, uri)
case "dl380":
exporter = dl380.NewExporter(r.Context(), target, uri)
case "dl360":
exporter = dl360.NewExporter(r.Context(), target, uri)
case "dl20":
Expand All @@ -150,7 +153,7 @@ func handler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
exporter, err = s3260m5.NewExporter(r.Context(), target, uri)
default:
log.Error("'module' parameter does not match available options", zap.String("module", moduleName), zap.String("target", target), zap.Any("trace_id", r.Context().Value("traceID")))
http.Error(w, "'module' parameter does not match available options: [moonshot, dl360, dl20, c220, s3260m4, s3260m5]", http.StatusBadRequest)
http.Error(w, "'module' parameter does not match available options: [moonshot, dl360, dl380, dl20, c220, s3260m4, s3260m5]", http.StatusBadRequest)
return
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/fishymetrics/templates.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 Down Expand Up @@ -56,6 +56,7 @@ const indexTmpl string = `<html>
<label for="module">Module:</label>
<select id="module" name="module">
<option vaule="moonshot">moonshot</option>
<option vaule="dl380">dl380</option>
<option vaule="dl360">dl360</option>
<option vaule="dl20">dl20</option>
<option vaule="c220">c220</option>
Expand Down
107 changes: 107 additions & 0 deletions hpe/dl380/drive.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dl380

// NVME's
// /redfish/v1/chassis/1/
// NVMeMetrics is the top level json object for DL380 NVMe Metrics Metadata
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
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
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
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:"[email protected],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