Redfish

BMC_IP=10.0.1.123
BMC_USER=ADMIN
BMC_PASS=ADMIN
 
# Install redfishtool (CLI)
git clone  https://github.com/DMTF/Redfishtool.git
cd Redfishtool/
python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems -F
 
for BMC_IP in 10.0.1.11 10.0.1.12 10.0.1.13; do
    python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems -F | jq .SerialNumber
    python3 redfishtool.py -r $BMC_IP -u $BMC_USER -p $BMC_PASS Systems -F | jq .IndicatorLED
done
 
python3 redfishtool.py -r $BMC_IP -u $BMC_USER -p $BMC_PASS Chassis list
python3 redfishtool.py -r $BMC_IP -u $BMC_USER -p $BMC_PASS Chassis -I 1
python3 redfishtool.py -r $BMC_IP -u $BMC_USER -p $BMC_PASS Chassis -I HA-RAID.0.StorageEnclosure.0
 
python3 redfishtool.py -r $BMC_IP -u $BMC_USER -p $BMC_PASS Systems -F | jq .UUID
python3 redfishtool.py -r $BMC_IP -u $BMC_USER -p $BMC_PASS Systems -F | jq .IndicatorLED
 
python3 redfishtool.py -r $BMC_IP -u $BMC_USER -p $BMC_PASS Chassis -I 1 setIndicatorLed Off
 
BMC_IP=$(dig +short node1.example.com)
unset https_proxy 
 
# gret firmware versions
# BMC
python3 redfishtool.py -r ${BMC_HOST} -u ${BMC_USER} -p ${BMC_PASS} Managers -F | jq .FirmwareVersion
curl -s https://${BMC_IP}/redfish/v1/Managers/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq .FirmwareVersion
# BIOS
python3 redfishtool.py -r ${BMC_HOST} -u ${BMC_USER} -p ${BMC_PASS} Systems -F | jq .BiosVersion
curl -s https://${BMC_IP}/redfish/v1/Systems/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq .BiosVersion
 
# System manufactor
curl -s https://${BMC_IP}/redfish/v1/Systems/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq .Manufacturer
# System model
curl -s https://${BMC_IP}/redfish/v1/Systems/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq .PartNumber
 
# get serial
curl -s https://${BMC_IP}/redfish/v1/Systems/1 -k -u ${BMC_USER}:${BMC_PASS} | jq .UUID
curl -s https://${BMC_IP}/redfish/v1/Systems/1 -k -u ${BMC_USER}:${BMC_PASS} | jq .SerialNumber
curl -s https://${BMC_IP}/redfish/v1/Chassis/1 -k -u ${BMC_USER}:${BMC_PASS} | jq .SerialNumber
# get CPU information
curl -s https://${BMC_IP}/redfish/v1/Systems/1/Processors/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq -r .Model | awk '{$1=$1};1'
curl -s https://${BMC_IP}/redfish/v1/Systems/1/Processors/1 -k -u ${BMC_USER}:${BMC_PASS} | jq .TotalCores
curl -s https://${BMC_IP}/redfish/v1/Systems/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq .ProcessorSummary.Count
# ram total
curl -s https://${BMC_IP}/redfish/v1/Systems/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq .MemorySummary.TotalSystemMemoryGiB
# ram modules
curl -k -u ${BMC_USER}:${BMC_PASS} -s https://${BMC_IP}/redfish/v1/Systems/1/Memory | jq ".Members | length"
# get BMC settings
curl -s https://${BMC_IP}/redfish/v1/Managers/1/EthernetInterfaces/2  -k -u ${BMC_USER}:${BMC_PASS} | jq .IPv4Addresses[0].Address
 
# get Health
curl -s https://${BMC_IP}/redfish/v1/Chassis/1 -k -u ${BMC_USER}:${BMC_PASS} | jq .Status.Health
# get IndicatorLED
curl -s https://${BMC_IP}/redfish/v1/Systems/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq -r .IndicatorLED
# fan mode
curl -s https://${BMC_IP}//redfish/v1/Managers/1/FanMode -k -u ${BMC_USER}:${BMC_PASS} | jq .Mode
 
# storageb
curl -s https://${BMC_IP}/redfish/v1/Systems/1/SimpleStorage/1 -k -u ${BMC_USER}:${BMC_PASS} | jq .Devices[].Model
 
# raid
curl -s https://${BMC_IP}/redfish/v1/Chassis/HA-RAID.0.StorageEnclosure.0 -k -u ${BMC_USER}:${BMC_PASS} | python -m json.tool
curl -s https://${BMC_IP}/redfish/v1/Chassis/HA-RAID.0.StorageEnclosure.0/Drives/Disk.Bay.0 -k -u ${BMC_USER}:${BMC_PASS} | python -m json.tool
 
curl -k https://BMC_IP/registries/BiosAttributeRegistry.v1_0_0.json | python -m json.tool
 
curl -s https://BMC_IP/redfish/v1/Chassis/1/Thermal -k -u ADMIN:ADMIN |   python -m json.tool
 
# power consumption
curl -s https://${BMC_IP}/redfish/v1/Chassis/1/Power/ -k -u ${BMC_USER}:${BMC_PASS}  | jq .PowerControl[].PowerConsumedWatts
curl -s https://${BMC_IP}/redfish/v1/Chassis/1/Power/ -k -u ${BMC_USER}:${BMC_PASS}  | jq .PowerControl[].PowerMetrics.AverageConsumedWatts

Get NIC information

# get BMC mac
curl -s https://${BMC_IP}/redfish/v1/Managers/1/EthernetInterfaces/1 -k -u ${BMC_USER}:${BMC_PASS} | jq -r '.MACAddress | ascii_downcase'
 
# get NIC1 mac
for NIC_ID in {1..4}; do
  curl -s https://${BMC_IP}/redfish/v1/Systems/1/EthernetInterfaces/${NIC_ID} -k -u ${BMC_USER}:${BMC_PASS} | jq -r '.MACAddress | ascii_downcase'
done
# SuperMicro
https://www.supermicro.com/manuals/other/RedfishRefGuide.pdf
 
# HP
https://hewlettpackard.github.io/ilo-rest-api-docs/ilo5/#uefi-bios-standard-redfish-support
https://support.hpe.com/hpsc/doc/public/display?docId=c04423967
 
# Redfishtool (redfish CLI)
https://github.com/DMTF/Redfishtool
 
# boot to bios
python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems setBootOverride Once BiosSetup
python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems reset ForceRestart

Manage Redfish with Curl

curl -d '{
    "Boot": {
        "BootSourceOverrideEnabled": "Once",
        "BootSourceOverrideTarget": "Pxe"
    }
}'
-H "Content-Type: application/json"
-X PATCH
--insecure
--silent
https://${BMC_HOST}}/redfish/v1/Systems/1/
 
curl -sk -H "$token" -H "Content-Type: application/json" -X POST https://$1/redfish/v1/Systems/1/Actions/ComputerSystem.Reset/ -d '{"ResetType": "ForceRestart"}'
curl -sk -H "$token" -H "Content-Type: application/json" -X POST https://$1/redfish/v1/Systems/1/Actions/ComputerSystem.Reset/ -d '{"ResetType": "ForceOff"}'
curl -sk -H "$token" -H "Content-Type: application/json" -X POST https://$1/redfish/v1/Systems/1/Actions/ComputerSystem.Reset/ -d '{"ResetType": "On"}'

Links
https://www.thomas-krenn.com/de/wiki/Redfish