Skip to content

Commit

Permalink
iDRAC9 F/W ver up and RedFish ver up (#88)
Browse files Browse the repository at this point in the history
* Adapting latest OMSA version

* add comments

* Improve Dockerfile

* change for OMSA v11.0.0.0

* add redfish rule for v1.17

* fix issue

* rebuild rules for v.1.17

* add the entries of base-rule for v1.11

* fix typo

* change unreleased section

* change for review comment

* run go run ../pkg/render-rules

* re-make collector rule

* add the test cases with real data

* revert changing converter.go

* name change to appropriate

* add base-rule for v1.17 and shell

* change filename to avoid confusing

* change for review comment

* change for review comment

* delete rule.yaml
  • Loading branch information
takara9 committed Jul 19, 2023
1 parent 217622c commit e688b27
Show file tree
Hide file tree
Showing 15 changed files with 183,658 additions and 25 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ Hardware setup container
This repository contains a Dockerfile and associated tools to build a
container image for configuring/monitoring server [BMC][] and [BIOS][].

Specifically, the image bundles `idracadm7` from [OMSA][] for Dell servers.
Specifically, the image bundles `racadm` from [OMSA][] for Dell servers.

Usage
-----

### Build

```console
$ docker build -t setup-hw:latest docker
$ cd setup-hw
$ make build-image
```

### Run as a system service

The container need to be run as a system service before using `idracadm7` or [`setup-hw`](docs/setup-hw.md).
The container need to be run as a system service before using `racadm` or [`setup-hw`](docs/setup-hw.md).

```console
$ sudo mkdir -p /var/lib/setup-hw
Expand Down Expand Up @@ -48,10 +49,10 @@ by default.
You must prepare [configuration files](docs/config.md) before running
`monitor-hw`.

### Run idracadm7
### Run racadm

```console
$ docker exec setup-hw idracadm7 ...
$ docker exec setup-hw racadm ...
```

### Run `setup-hw`
Expand All @@ -64,3 +65,4 @@ See the [document](docs/setup-hw.md) for details.
[BIOS]: https://en.wikipedia.org/wiki/BIOS
[OMSA]: https://en.wikipedia.org/wiki/OpenManage#OMSA_%E2%80%93_OpenManage_Server_Administrator
[Prometheus]: https://prometheus.io/
[Dell Remote Access Controller 9 RACADM CLI Guide]: https://www.dell.com/support/manuals/ja-jp/poweredge-r7415/idrac9_7.xx_racadm_pub/introduction
100 changes: 100 additions & 0 deletions base-rules/dell-redfish-v117.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Traverse:
Root: /redfish/v1
Excludes:
# Schemas
- /JsonSchemas
# Non-metric properties
- /Accounts
- /Certificates
- /Jobs
- /Logs
- /Registries
- /Roles
- /Sessions
- /Settings
# Services
- /AccountService
- /CertificateService
- /EventService
- /JobService
- /LogServices
- /SessionService
- /TaskService
- /TelemetryService
- /UpdateService
- /LicenseService
# Sub-metrics included in /Power or /Thermal
- /Power/
- /Power#/
- /Thermal#/
- /Assembly#/
# Redundant page with extra trailing slash
- /redfish/v1/Chassis/$

Metrics:
## Chassis
- Path: /redfish/v1/Chassis/{chassis}
- Path: /redfish/v1/Chassis/{chassis}/Assembly
- Path: /redfish/v1/Chassis/{chassis}/NetworkAdapters/{nic}
- Path: /redfish/v1/Chassis/{chassis}/NetworkAdapters/{nic}/NetworkDeviceFunctions/{function}
- Path: /redfish/v1/Chassis/{chassis}/NetworkAdapters/{nic}/NetworkPorts/{port}
- Path: /redfish/v1/Chassis/{chassis}/NetworkAdapters/{nic}/Ports/{port}
- Path: /redfish/v1/Chassis/{chassis}/PCIeDevices/{device}
- Path: /redfish/v1/Chassis/{chassis}/PCIeDevices/{device}/PCIeFunctions/{function}
- Path: /redfish/v1/Chassis/{chassis}/PCIeSlots
- Path: /redfish/v1/Chassis/{chassis}/Power
- Path: /redfish/v1/Chassis/{chassis}/PowerSubsystem
- Path: /redfish/v1/Chassis/{chassis}/PowerSubsystem/PowerSupplies/{unit}
- Path: /redfish/v1/Chassis/{chassis}/PowerSubsystem/PowerSupplies/{unit}/Metrics
- Path: /redfish/v1/Chassis/{chassis}/Sensors/{sensor}
- Path: /redfish/v1/Chassis/{chassis}/Thermal
- Path: /redfish/v1/Chassis/{chassis}/ThermalSubsystem
- Path: /redfish/v1/Chassis/{chassis}/ThermalSubsystem/Fans/{unit}
- Path: /redfish/v1/Chassis/{chassis}/ThermalSubsystem/ThermalMetrics

## Dell
- Path: /redfish/v1/Dell/Chassis/{system}/DellAssembly/{assembly}
- Path: /redfish/v1/Dell/Systems/{system}/DellNumericSensor/{sensor}
- Path: /redfish/v1/Dell/Systems/{system}/DellPCIeFunction/{function}
- Path: /redfish/v1/Dell/Systems/{system}/DellPSNumericSensor/{sensor}
- Path: /redfish/v1/Dell/Systems/{system}/DellSensor/{sensor}
- Path: /redfish/v1/Dell/Systems/{system}/DellSlot/{slot}
- Path: /redfish/v1/Dell/Systems/{system}/Memory/DellMemory/{memory}
- Path: /redfish/v1/Dell/Systems/{system}/NetworkAdapters/NetworkDeviceFunctions/DellNICPortMetrics/{port}
- Path: /redfish/v1/Dell/Systems/{system}/NetworkDeviceFunctions/DellNIC/{nic}
- Path: /redfish/v1/Dell/Systems/{system}/NetworkDeviceFunctions/DellNICCapabilities/{nic}
- Path: /redfish/v1/Dell/Systems/{system}/NetworkPorts/DellSwitchConnection/{connection}
- Path: /redfish/v1/Dell/Systems/{system}/Processors/DellProcessor/{processor}
- Path: /redfish/v1/Dell/Systems/{system}/Storage/DellController/{controller}
- Path: /redfish/v1/Dell/Systems/{system}/Storage/DellPCIeSSD/{disk}
- Path: /redfish/v1/Dell/Systems/{system}/Storage/Drives/DellPhysicalDisk/{disk}
- Path: /redfish/v1/Dell/Systems/{system}/Storage/Volumes/DellVirtualDisk/{disk}
## Fabrics
- Path: /redfish/v1/Fabrics/{fabric}
- Path: /redfish/v1/Fabrics/{fabric}/Switches
## Managers
- Path: /redfish/v1/Managers/{manager}
- Path: /redfish/v1/Managers/{manager}/Attributes
- Path: /redfish/v1/Managers/{manager}/EthernetInterfaces/{interface}
- Path: /redfish/v1/Managers/{manager}/HostInterfaces/{host}
- Path: /redfish/v1/Managers/{manager}/NetworkProtocol
## Systems
- Path: /redfish/v1/Systems/{system}
- Path: /redfish/v1/Systems/{system}/BootOptions/{option}
- Path: /redfish/v1/Systems/{system}/EthernetInterfaces/{interface}
- Path: /redfish/v1/Systems/{system}/Memory/{memory}
- Path: /redfish/v1/Systems/{system}/Memory/{memory}/MemoryMetrics
- Path: /redfish/v1/Systems/{system}/NetworkAdapters/{nic}
- Path: /redfish/v1/Systems/{system}/NetworkAdapters/{nic}/NetworkDeviceFunctions/{function}
- Path: /redfish/v1/Systems/{system}/NetworkAdapters/{nic}/NetworkPorts/{port}
- Path: /redfish/v1/Systems/{system}/NetworkInterfaces/{nic}
- Path: /redfish/v1/Systems/{system}/PCIeDevices/{device}
- Path: /redfish/v1/Systems/{system}/PCIeDevices/{device}/PCIeFunctions/{function}
- Path: /redfish/v1/Systems/{system}/Processors/{processor}
- Path: /redfish/v1/Systems/{system}/SimpleStorage/{controller}
- Path: /redfish/v1/Systems/{system}/Storage/{storage}
- Path: /redfish/v1/Systems/{system}/Storage/{storage}/Controllers/{controller}
- Path: /redfish/v1/Systems/{system}/Storage/{storage}/Drives/{device}
- Path: /redfish/v1/Systems/{system}/Storage/{storage}/StorageControllers/{controller}
- Path: /redfish/v1/Systems/{system}/Storage/{storage}/Volumes
- Path: /redfish/v1/Systems/{system}/Storage/{storage}/Volumes/{volume}
33 changes: 33 additions & 0 deletions base-rules/run_generate-rule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/bash
#
# Shell for collector generate-rule execute on container
#
# 2023/7/14 RedFish v1.17
#

# Please edit for your environment
RULE="dell-redfish-v117.yaml" # Base rule
INPUT1="r7525-data-omsa1100.json" # Output by "collector show" command
INPUT2="r6525-data-omsa1100.json" # for each PowerEdge Model
OUTPUT="dell_redfish_1.17.0.yml" # Output rule file for Promethus/Grafana
SETUP_HW="quay.io/neco_test/setup-hw:dev" # Latest container image if there is dell command upgrade.

docker run -it --name=setup-hw \
-v ${PWD}:/mnt \
--rm \
${SETUP_HW} collector generate-rule \
--base-rule=/mnt/${RULE} \
--key=Health:health \
--key=State:state \
--key=FailurePredicted:bool \
--key=PredictedMediaLifeLeftPercent:number \
--key=AddressParityError:bool \
--key=CorrectableECCError:bool \
--key=SpareBlock:bool \
--key=Temperature:bool \
--key=UncorrectableECCError:bool \
--key=DataLossDetected:bool \
--key=ReadingCelsius:number \
--key=PowerConsumedWatts:number \
--key=Reading:number \
/mnt/${INPUT1} /mnt/${INPUT2} > ${OUTPUT}
29 changes: 18 additions & 11 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
FROM centos:7 as stage1
FROM ubuntu:22.04 as stage1

COPY setup-hw /usr/local/bin/setup-hw
COPY monitor-hw /usr/local/sbin/monitor-hw
COPY collector /usr/local/sbin/collector
COPY setup-apply-firmware /usr/local/sbin/setup-apply-firmware
COPY setup-isoreboot /usr/local/sbin/setup-isoreboot

CMD ["/usr/local/sbin/monitor-hw"]


# Install vendor tools
FROM stage1

ARG DSU_VERSION=21.11.26
# See https://linux.dell.com/repo/community/openmanage/
ARG OMSA_VERSION=11000
ARG UBUNTU_VERSION=jammy

# Setup DELL repository
RUN apt-get update -y && apt-get install -y --no-install-recommends wget gnupg ca-certificates \
&& echo "deb http://linux.dell.com/repo/community/openmanage/${OMSA_VERSION}/${UBUNTU_VERSION} ${UBUNTU_VERSION} main" | tee -a /etc/apt/sources.list.d/linux.dell.com.sources.list \
&& wget https://linux.dell.com/repo/pgp_pubkeys/0x1285491434D8786F.asc \
&& apt-key add 0x1285491434D8786F.asc \
&& rm 0x1285491434D8786F.asc

RUN curl -sf -o bootstrap.cgi https://linux.dell.com/repo/hardware/DSU_${DSU_VERSION}/bootstrap.cgi \
&& bash bootstrap.cgi \
&& rm bootstrap.cgi \
&& yum update -y \
&& yum install -y syscfg srvadmin-idracadm7 dmidecode \
&& yum clean all
# To avoid error postinstall script of srvadmin-all in the contaioner enviroment.
COPY systemctl-dummy /usr/bin/systemctl

ENV PATH /opt/dell/srvadmin/bin:$PATH
# Install DELL's tools
RUN apt-get update -y \
&& ln -s /usr/lib/x86_64-linux-gnu/libssl.so.3 /usr/lib/libssl.so \
&& DEBIAN_FRONTEND=noninteractive apt-get install srvadmin-all -y \
&& rm /usr/bin/systemctl
2 changes: 2 additions & 0 deletions docker/systemctl-dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
/bin/true
2 changes: 1 addition & 1 deletion docs/monitor-hw.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Vendor specific behaviors

### Dell actions

`monitor-hw` invokes `instsvcdrv-helper` for `idracadm7`.
`monitor-hw` invokes `instsvcdrv-helper` for `racadm`.

`monitor-hw` periodically resets iDRAC because it occasionally hangs.

Expand Down
4 changes: 2 additions & 2 deletions pkg/monitor-hw/cmd/dell.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ func initDell(ctx context.Context) error {
if err := well.CommandContext(ctx, "/usr/libexec/instsvcdrv-helper", "start").Run(); err != nil {
return err
}
if err := well.CommandContext(ctx, "/opt/dell/srvadmin/bin/idracadm7", "remoteimage", "-d").Run(); err != nil {
if err := well.CommandContext(ctx, "/usr/bin/racadm", "remoteimage", "-d").Run(); err != nil {
return err
}
return nil
}

func resetDell(ctx context.Context) error {
return well.CommandContext(ctx, "/opt/dell/srvadmin/bin/idracadm7", "racreset", "soft").Run()
return well.CommandContext(ctx, "/usr/bin/racadm", "racreset", "soft").Run()
}
6 changes: 3 additions & 3 deletions pkg/setup-apply-firmware/dell.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (

func setupDell(ctx context.Context, files []string) error {
for _, f := range files {
cmd := well.CommandContext(ctx, "/opt/dell/srvadmin/bin/idracadm7", "update", "-f", f)
cmd := well.CommandContext(ctx, "/usr/bin/racadm", "update", "-f", f)
buf := bytes.Buffer{}
cmd.Stdout = &buf
cmd.Stderr = &buf
err := cmd.Run()
// we cannot use exit status to detect errors because `idracadm7 update` returns nonzero status even in case of successful update initiation.
// we cannot use exit status to detect errors because `racadm update` returns nonzero status even in case of successful update initiation.
var exitError *exec.ExitError
if err != nil && !errors.As(err, &exitError) {
return fmt.Errorf("racadm update failed at file %s: %w", f, err)
Expand All @@ -33,7 +33,7 @@ func setupDell(ctx context.Context, files []string) error {
"file": f,
})

// if the next `idracadm7 update` is executed immediately after the previous one, it will fail.
// if the next `racadm update` is executed immediately after the previous one, it will fail.
time.Sleep(time.Second * 10)
}

Expand Down
6 changes: 4 additions & 2 deletions pkg/setup-hw/dell.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

const (
racadmPath = "/opt/dell/srvadmin/bin/idracadm7"
racadmPath = "/usr/bin/racadm"

retryCount = 5
)
Expand Down Expand Up @@ -66,7 +66,7 @@ RETRY:

retries++
if retries == retryCount {
log.Error("idracadm7 failed", map[string]interface{}{
log.Error("racadm failed", map[string]interface{}{
log.FnError: err,
"output": string(out),
})
Expand Down Expand Up @@ -95,6 +95,7 @@ RETRY:
//
// $ sudo idracadm7 get System.ServerPwr.PSRapidOn
// Enabled

func racadmGetConfig(ctx context.Context, key string) (string, error) {
cmd := well.CommandContext(ctx, racadmPath, "get", key)
cmd.Severity = log.LvDebug
Expand Down Expand Up @@ -160,6 +161,7 @@ func parseRacadmGetOutput(out, key string) (string, error) {
//
// If you want to get a commented key-value like 'iDRAC.SNMP.EngineID',
// use 'racadmGetConfig()'.

func racadmGetConfigs(ctx context.Context, key string) (map[string]string, error) {
cmd := well.CommandContext(ctx, racadmPath, "get", key)
cmd.Severity = log.LvDebug
Expand Down
2 changes: 1 addition & 1 deletion pkg/setup-isoreboot/dell.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/cybozu-go/well"
)

const idracadm7Path = "/opt/dell/srvadmin/bin/idracadm7"
const idracadm7Path = "/usr/bin/racadm"

func setupDell(ctx context.Context, url string) error {
err := well.CommandContext(ctx, idracadm7Path, "vmdisconnect").Run()
Expand Down
Loading

0 comments on commit e688b27

Please sign in to comment.