Skip to content

Commit d9f3d0c

Browse files
committed
Merge branch 'next-release'
2 parents ada335d + 1f08757 commit d9f3d0c

21 files changed

Lines changed: 529 additions & 277 deletions

README.md

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ usage: check_redfish.py [-H HOST] [-u USERNAME] [-p PASSWORD] [-f AUTHFILE]
5757
[-d] [-m MAX] [-r RETRIES] [-t TIMEOUT]
5858
[--log_exclude LOG_EXCLUDE] [--ignore_missing_ps]
5959
[--ignore_unavailable_resources]
60+
[--ignore_unknown_on_critical_or_warning]
6061
[--enable_bmc_security_warning] [--storage] [--proc]
6162
[--memory] [--power] [--temp] [--fan] [--nic] [--bmc]
6263
[--info] [--firmware] [--sel] [--mel] [--all] [-i]
@@ -70,7 +71,7 @@ It will also create a inventory of all components of a system.
7071
7172
R.I.P. IPMI
7273
73-
Version: 1.12.1 (2025-08-07)
74+
Version: 2.0.0 (2025-10-15)
7475
7576
mandatory arguments:
7677
-H HOST, --host HOST define the host to request. To change the port just
@@ -116,6 +117,9 @@ optional arguments:
116117
--ignore_unavailable_resources
117118
ignore all 'UNKNOWN' errors which indicate missing
118119
resources and report as OK
120+
--ignore_unknown_on_critical_or_warning
121+
suppress all 'UNKNOWN' errors if other checks returned
122+
CRITICAL or WARNING
119123
--enable_bmc_security_warning
120124
return status WARNING if BMC security issues are
121125
detected (HPE iLO only)
@@ -231,6 +235,11 @@ WARNING and CRITICAL values can only be used properly if used with **ONE** query
231235
If for example **--all** or **--mel** and **--storage** are used in the same command then you will
232236
get inconsistent results/alarms.
233237

238+
Sometimes it is helpful to prioritize CRITICAL and WARNING status over UNKNOWN status results.
239+
In this case it is possible to use the `--ignore_unknown_on_critical_or_warning` cli option
240+
which returns for example `CRITICAL` if the plugin encountered an `UNKNONW` and a `CRITICAL` issue.
241+
see: https://github.com/bb-Ricardo/check_redfish/issues/174
242+
234243
#### Event Logs
235244
**--mel** and **--sel** (values are passed as "days")<br>
236245
define after how many days' event log entries which have a != OK severity shouldn't
@@ -328,7 +337,7 @@ suggestions for changes/improvements then please create a GitHub issue.
328337
```json
329338
{
330339
"inventory": {
331-
"chassi": [],
340+
"chassis": [],
332341
"fan": [],
333342
"firmware": [],
334343
"logical_drive": [],
@@ -339,7 +348,7 @@ suggestions for changes/improvements then please create a GitHub issue.
339348
"physical_drive": [],
340349
"power_control": [
341350
{
342-
"chassi_ids": [
351+
"chassis_ids": [
343352
"1"
344353
],
345354
"health_state": null,
@@ -357,7 +366,7 @@ suggestions for changes/improvements then please create a GitHub issue.
357366
{
358367
"bay": 1,
359368
"capacity_in_watt": 500,
360-
"chassi_ids": [
369+
"chassis_ids": [
361370
1
362371
],
363372
"efficiency_percent": null,
@@ -377,7 +386,7 @@ suggestions for changes/improvements then please create a GitHub issue.
377386
{
378387
"bay": 2,
379388
"capacity_in_watt": 500,
380-
"chassi_ids": [
389+
"chassis_ids": [
381390
1
382391
],
383392
"firmware": "1.03",
@@ -406,8 +415,8 @@ suggestions for changes/improvements then please create a GitHub issue.
406415
"host_that_collected_inventory": "inventory-collector.example.com",
407416
"inventory_id": null,
408417
"inventory_name": null,
409-
"inventory_layout_version": "1.12.0",
410-
"script_version": "1.12.0",
418+
"inventory_layout_version": "2.0.0",
419+
"script_version": "2.0.0",
411420
"start_of_data_collection": "2024-02-13T19:09:07+02:00"
412421
}
413422
}
@@ -460,6 +469,9 @@ Models:
460469
* ProLiant RL300 Gen11
461470
* ProLiant XL450 Gen10
462471

472+
* Compute Scale-up Server 3200
473+
* Superdome Flex
474+
463475
### Lenovo
464476
* ThinkSystem SR650 (BMC Version 2.12)
465477
* ThinkSystem SR650 V2 (BMC Version 12I-1.15)
@@ -510,6 +522,9 @@ Models:
510522
### GIGABYTE (limited support)
511523
* H262-Z61
512524

525+
### Bull
526+
* BullSequana SH120
527+
513528
## License
514529
>You can check out the full license [here](LICENSE.txt)
515530

check_redfish.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616
R.I.P. IPMI
1717
"""
1818

19-
__version__ = "1.12.1"
20-
__version_date__ = "2025-08-07"
19+
__version__ = "2.0.0"
20+
__version_date__ = "2025-10-15"
2121
__author__ = "Ricardo Bartels <ricardo@bitchbrothers.com>"
2222
__description__ = "Check Redfish Plugin"
2323
__license__ = "MIT"
2424

2525
import logging
2626

2727
from cr_module.classes.plugin import PluginData
28-
from cr_module.system_chassi import get_system_info, get_chassi_data, get_system_data
28+
from cr_module.system_chassis import get_system_info, get_chassis_data, get_system_data
2929
from cr_module.nic import get_network_interfaces
3030
from cr_module.storage import get_storage
3131
from cr_module.bmc import get_bmc_info
@@ -55,9 +55,9 @@ def main(self):
5555
# get basic information
5656
plugin.rf.determine_vendor()
5757

58-
if any(x in self.args.requested_query for x in ['power', 'all']): get_chassi_data(PowerSupply)
59-
if any(x in self.args.requested_query for x in ['temp', 'all']): get_chassi_data(Temperature)
60-
if any(x in self.args.requested_query for x in ['fan', 'all']): get_chassi_data(Fan)
58+
if any(x in self.args.requested_query for x in ['power', 'all']): get_chassis_data(PowerSupply)
59+
if any(x in self.args.requested_query for x in ['temp', 'all']): get_chassis_data(Temperature)
60+
if any(x in self.args.requested_query for x in ['fan', 'all']): get_chassis_data(Fan)
6161
if any(x in self.args.requested_query for x in ['proc', 'all']): get_system_data(Processor)
6262
if any(x in self.args.requested_query for x in ['memory', 'all']): get_system_data(Memory)
6363
if any(x in self.args.requested_query for x in ['nic', 'all']): get_network_interfaces()

contrib/icinga2_check_redfish_command.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ object CheckCommand "redfish" {
144144
set_if = "$redfish_ignore_unavailable_resources$"
145145
description = "ignore all 'UNKNOWN' errors which indicate missing resources and report as OK"
146146
}
147+
"--ignore_unknown_on_critical_or_warning" = {
148+
set_if = "$redfish_ignore_unknown_on_critical_and_warning$"
149+
description = "suppress all 'UNKNOWN' errors if other checks returned CRITICAL or WARNING"
150+
}
147151
}
148152

149153
env = {

contrib/icinga2_check_redfish_director_basket.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@
138138
"--ignore_unavailable_resources": {
139139
"description": "ignore all 'UNKNOWN' errors which indicate missing resources and report as OK",
140140
"set_if": "$redfish_ignore_unavailable_resources$"
141+
},
142+
"--ignore_unknown_on_critical_or_warning": {
143+
"description": "suppress all 'UNKNOWN' errors if other checks returned CRITICAL or WARNING",
144+
"set_if": "$redfish_ignore_unknown_on_critical_and_warning$"
141145
}
142146
},
143147
"command": "check_redfish.py",

cr_module/args.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ def parse_command_line(description: str, version: str, version_date: str):
6161
"of the power subsystem")
6262
group.add_argument("--ignore_unavailable_resources", action='store_true',
6363
help="ignore all 'UNKNOWN' errors which indicate missing resources and report as OK")
64+
group.add_argument("--ignore_unknown_on_critical_or_warning", action='store_true',
65+
help="suppress all 'UNKNOWN' errors if other checks returned CRITICAL or WARNING")
6466
group.add_argument("--enable_bmc_security_warning", action='store_true',
6567
help="return status WARNING if BMC security issues are detected (HPE iLO only)")
6668

cr_module/bmc.py

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,12 @@ def get_bmc_info_generic(redfish_url):
5656
manager_response = view_response
5757

5858
# get model
59-
bmc_model = manager_response.get("Model")
60-
bmc_fw_version = manager_response.get("FirmwareVersion")
61-
62-
if plugin_object.rf.vendor == "HPE":
63-
bmc_model = " ".join(bmc_fw_version.split(" ")[0:2])
64-
65-
if plugin_object.rf.vendor == "Dell":
66-
if bmc_model == "13G Monolithic":
67-
bmc_model = "iDRAC 8"
68-
if bmc_model in ["14G Monolithic", "15G Monolithic"]:
69-
bmc_model = "iDRAC 9"
59+
if len(plugin_object.rf.get_system_properties("managers")) == 1:
60+
bmc_model = plugin_object.rf.vendor_data.get_bmc_model()
61+
bmc_fw_version = plugin_object.rf.vendor_data.get_bmc_firmware_version()
62+
else:
63+
bmc_model = manager_response.get("Model")
64+
bmc_fw_version = manager_response.get("FirmwareVersion")
7065

7166
# some Cisco Systems have a second manager with no attributes which needs to be skipped
7267
if plugin_object.rf.vendor == "Cisco":
@@ -172,7 +167,7 @@ def get_bmc_info_generic(redfish_url):
172167
addresses=format_interface_addresses(mac_address),
173168
manager_ids=manager_inventory.id,
174169
system_ids=manager_inventory.system_ids,
175-
chassi_ids=manager_inventory.chassi_ids,
170+
chassis_ids=manager_inventory.chassis_ids,
176171
ipv4_addresses=get_interface_ip_addresses(manager_nic, "IPv4Addresses"),
177172
ipv6_addresses=get_interface_ip_addresses(manager_nic, "IPv6Addresses"),
178173
link_type="Ethernet",
@@ -251,7 +246,8 @@ def get_bmc_info_generic(redfish_url):
251246
ilo_license_string = grab(vendor_data, "License.LicenseString")
252247
ilo_license_key = grab(vendor_data, "License.LicenseKey")
253248

254-
bmc_licenses.append(f"{ilo_license_string} ({ilo_license_key})")
249+
if ilo_license_string and ilo_license_key:
250+
bmc_licenses.append(f"{ilo_license_string} ({ilo_license_key})")
255251

256252
elif plugin_object.rf.vendor == "Lenovo":
257253

@@ -307,15 +303,15 @@ def get_bmc_info_generic(redfish_url):
307303

308304
elif plugin_object.rf.vendor == "Huawei":
309305

310-
ibmc_license_link = vendor_data.get("LicenseService")
306+
bmc_license_link = vendor_data.get("LicenseService")
311307

312-
if ibmc_license_link is not None and len(ibmc_license_link) > 0:
313-
ibmc_lic = plugin_object.rf.get(ibmc_license_link.get("@odata.id"))
308+
if bmc_license_link is not None and len(bmc_license_link) > 0:
309+
bmc_lic = plugin_object.rf.get(bmc_license_link.get("@odata.id"))
314310

315-
if ibmc_lic.get("error"):
316-
plugin_object.add_data_retrieval_error(Manager, ibmc_lic, ibmc_license_link.get("@odata.id"))
311+
if bmc_lic.get("error"):
312+
plugin_object.add_data_retrieval_error(Manager, bmc_lic, bmc_license_link.get("@odata.id"))
317313

318-
bmc_licenses.append("%s (%s)" % (ibmc_lic.get("InstalledStatus"), ibmc_lic.get("LicenseClass")))
314+
bmc_licenses.append("%s (%s)" % (bmc_lic.get("InstalledStatus"), bmc_lic.get("LicenseClass")))
319315

320316
manager_inventory.licenses = bmc_licenses
321317

@@ -326,7 +322,7 @@ def get_bmc_info_generic(redfish_url):
326322
if plugin_object.rf.vendor == "HPE":
327323

328324
# iLO Self Test
329-
for self_test in vendor_data.get("iLOSelfTestResults"):
325+
for self_test in vendor_data.get("iLOSelfTestResults", []):
330326

331327
self_test_status = self_test.get("Status")
332328

@@ -403,16 +399,16 @@ def get_bmc_info_generic(redfish_url):
403399

404400
# Lenovo specific stuff
405401
if plugin_object.rf.vendor == "Lenovo":
406-
redfish_chassi_url = grab(manager_response, "Links/ManagerForChassis/0/@odata.id", separator="/")
402+
redfish_chassis_url = grab(manager_response, "Links/ManagerForChassis/0/@odata.id", separator="/")
407403

408-
chassi_response = None
409-
if redfish_chassi_url is not None:
410-
chassi_response = plugin_object.rf.get(redfish_chassi_url)
404+
chassis_response = None
405+
if redfish_chassis_url is not None:
406+
chassis_response = plugin_object.rf.get(redfish_chassis_url)
411407

412-
if chassi_response.get("error"):
413-
plugin_object.add_data_retrieval_error(Manager, chassi_response, redfish_chassi_url)
408+
if chassis_response.get("error"):
409+
plugin_object.add_data_retrieval_error(Manager, chassis_response, redfish_chassis_url)
414410

415-
located_data = grab(chassi_response, f"Oem.{plugin_object.rf.vendor_dict_key}.LocatedIn")
411+
located_data = grab(chassis_response, f"Oem.{plugin_object.rf.vendor_dict_key}.LocatedIn")
416412

417413
if located_data is not None:
418414
descriptive_name = located_data.get("DescriptiveName")
@@ -436,10 +432,10 @@ def get_bmc_info_generic(redfish_url):
436432
# get Huawei Server location data
437433
if plugin_object.rf.vendor == "Huawei":
438434

439-
ibmc_location = vendor_data.get("DeviceLocation")
440-
if ibmc_location is not None and len(ibmc_location) > 0:
435+
bmc_location = vendor_data.get("DeviceLocation")
436+
if bmc_location is not None and len(bmc_location) > 0:
441437

442-
location_string = f"Location: {ibmc_location}"
438+
location_string = f"Location: {bmc_location}"
443439
if plugin_object.cli_args.detailed:
444440
plugin_object.add_output_data("OK", f"BMC {location_string}",
445441
location=f"Manager {manager_inventory.id}")

cr_module/classes/inventory.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
# inventory definition
20-
inventory_layout_version_string = "1.12.0"
20+
inventory_layout_version_string = "2.0.0"
2121

2222

2323
# noinspection PyBroadException
@@ -64,7 +64,7 @@ def add_relation(self, system_properties, relations_data):
6464

6565
# set inventory attributes for system properties
6666
relations = {
67-
"chassis": "chassi_ids",
67+
"chassis": "chassis_ids",
6868
"systems": "system_ids",
6969
"managers": "manager_ids"
7070
}
@@ -314,7 +314,7 @@ class PowerSupply(InventoryItem):
314314
"bay": str,
315315
"capacity_in_watt": int,
316316
"efficiency_percent": int,
317-
"chassi_ids": list,
317+
"chassis_ids": list,
318318
"firmware": str,
319319
"health_status": str,
320320
"id": str,
@@ -337,7 +337,7 @@ class PowerControl(InventoryItem):
337337
"name": str,
338338
"health_status": str,
339339
"health_state": str,
340-
"chassi_ids": list,
340+
"chassis_ids": list,
341341
"power_capacity_watts": int,
342342
"power_allocated_watts": int,
343343
"power_available_watts": int,
@@ -349,7 +349,7 @@ class PowerControl(InventoryItem):
349349
class Temperature(InventoryItem):
350350
inventory_item_name = "temperature"
351351
valid_attributes = {
352-
"chassi_ids": list,
352+
"chassis_ids": list,
353353
"health_status": str,
354354
"id": str,
355355
"location": str,
@@ -377,7 +377,7 @@ class Fan(InventoryItem):
377377
class NetworkAdapter(InventoryItem):
378378
inventory_item_name = "network_adapter"
379379
valid_attributes = {
380-
"chassi_ids": list,
380+
"chassis_ids": list,
381381
"firmware": str,
382382
"health_status": str,
383383
"id": str,
@@ -401,7 +401,7 @@ class NetworkPort(InventoryItem):
401401
"addresses": list,
402402
"autoneg": bool,
403403
"capable_speed": int,
404-
"chassi_ids": list,
404+
"chassis_ids": list,
405405
"current_speed": int,
406406
"full_duplex": bool,
407407
"health_status": str,
@@ -426,7 +426,7 @@ class System(InventoryItem):
426426
inventory_item_name = "system"
427427
valid_attributes = {
428428
"bios_version": str,
429-
"chassi_ids": list,
429+
"chassis_ids": list,
430430
"cpu_num": int,
431431
"health_status": str,
432432
"host_name": str,
@@ -461,7 +461,7 @@ class Firmware(InventoryItem):
461461
class Manager(InventoryItem):
462462
inventory_item_name = "manager"
463463
valid_attributes = {
464-
"chassi_ids": list,
464+
"chassis_ids": list,
465465
"firmware": str,
466466
"health_status": str,
467467
"id": str,
@@ -474,8 +474,8 @@ class Manager(InventoryItem):
474474
}
475475

476476

477-
class Chassi(InventoryItem):
478-
inventory_item_name = "chassi"
477+
class Chassis(InventoryItem):
478+
inventory_item_name = "chassis"
479479
valid_attributes = {
480480
"health_status": str,
481481
"id": str,

0 commit comments

Comments
 (0)