banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Hardware

banshee/hardware-collection/hardware/redfish/https/

health

The overall health and power state of a server, as its management card rolls them up, by Redfish.

  • hardware
  • server
  • redfish
  • bmc
  • idrac
  • ilo
  • xcc
  • supermicro
  • health
  • https

by banshee1 installation1 version

v1Latest

Published on October 27, 2026. First version.

Keen 1.0.0 · 80 lines
// The overall health of a server, by the Redfish service of its management card (DMTF Redfish): the health
// and the power state of each computer system, and the health of each chassis, as the card rolls them up
// from everything under them. Any card that serves Redfish: Dell iDRAC, HPE iLO, Supermicro, Lenovo XCC,
// OpenBMC. The address of the service is the card's, the host's: https://<host:address>/redfish/v1/.
need('protocol:http');
$address = need('host:address');
$user = need('protocol:http:user');
$password = need('protocol:http:password');

per('component', 'Components');
output('health', 'text', array('label' => 'Health', 'per' => 'component'));
output('power-state', 'text', array('label' => 'Power state', 'per' => 'component'));

watch.state('unhealthy', 'Health degraded', 'health', array('warning' => array('warning'), 'critical' => array('critical')));
watch.state('unknown', 'Health unknown', 'health', array(
    'help'    => 'Raises when the card gives no health for a system or a chassis, as some do while the server is off.',
    'warning' => array('unknown'),
    'enabled' => false,
));
watch.expect('powered-off', 'System not powered on', 'power-state', array('critical' => array('on')));
watch.missing('missing', 'Component missing', 'health', array('enabled' => false));

// Returns one Redfish resource, read by its path (/redfish/v1/...), the account in Basic. The password only
// goes in the Basic header: the answer is not secret.
function redfish_get($address, $path, $user, $password) {
    $answer = http.get('https://' . $address . $path, headers=array('Accept' => 'application/json'), user=$user, password=$password);
    if ($answer['status'] == 401 || $answer['status'] == 403) {
        fail('misconfigured', 'The Redfish service refuses the account, code ' . $answer['status'], $path);
    }
    if ($answer['status'] != 200) {
        fail('unreachable', 'The Redfish service answers code ' . $answer['status'], $path);
    }
    return json.read($answer['body']);
}

// Returns the health of a resource, in lower case (ok, warning, critical): the health it rolls up from what
// is under it when it gives one, its own otherwise, unknown when it gives neither.
function health_of($resource) {
    $status = list.get($resource, 'Status', array());
    $health = list.get($status, 'HealthRollup', '');
    if ($health == '') {
        $health = list.get($status, 'Health', '');
    }
    if ($health == '') {
        return 'unknown';
    }
    return text.lower($health);
}

// {"Members": [{"@odata.id": "/redfish/v1/Systems/1"}]}. A system: {"Id": "1", "PowerState": "On",
// "Status": {"State": "Enabled", "Health": "OK", "HealthRollup": "Warning"}}. The power states of Redfish:
// On, Off, PoweringOn, PoweringOff, Paused.
$read = 0;
$systems = redfish_get($address, '/redfish/v1/Systems', $user, $password);
foreach (list.get($systems, 'Members', array()) as $member) {
    $system = redfish_get($address, $member['@odata.id'], $user, $password);
    $name = 'system ' . list.get($system, 'Id', $member['@odata.id']);
    value('health', health_of($system), $name);
    if (list.get($system, 'PowerState', '') != '') {
        value('power-state', text.lower($system['PowerState']), $name);
    }
    $read = $read + 1;
}

// A chassis: {"Id": "1", "ChassisType": "RackMount", "Status": {"State": "Enabled", "Health": "OK",
// "HealthRollup": "OK"}}. A chassis the card says absent (an empty enclosure slot) is left out.
$chassis_list = redfish_get($address, '/redfish/v1/Chassis', $user, $password);
foreach (list.get($chassis_list, 'Members', array()) as $member) {
    $chassis = redfish_get($address, $member['@odata.id'], $user, $password);
    $status = list.get($chassis, 'Status', array());
    if (list.get($status, 'State', '') == 'Absent') {
        continue;
    }
    value('health', health_of($chassis), 'chassis ' . list.get($chassis, 'Id', $member['@odata.id']));
    $read = $read + 1;
}

if ($read == 0) {
    fail('misconfigured', 'The Redfish service lists no system and no chassis');
}