This is a simple Python library that wraps around MegaCli to provide an OO interface.
Pull requests to add additional API features are very welcome. I only implemented what I needed.
To install it simply issue the following command:
pip install megacli
See https://m4ce.github.io/megacli-python
Below a quick example
>>> from megacli import MegaCLI, MegaCLIError
>>> cli = MegaCLI()
>>> cli.adapters()
[{'current_size_of_cachecade': 0.0, 'phy_polarity': 0, 'min_strip_size': 65536.0, 'enable_web_bios': False, 'spin_down_mode': None, 'device_interface': 'pcie', 'time_taken_to_detect_cme': 60, 'smart_mode': 'mode 6', 'tpm': 'absent', 'auto_detect_backplane_enabled': 'sgpio/i2c sep', 'self_diagnostic': True, 'memory_size': 1073741824.0, 'support_temperature': True, 'disable_puncturing': False, 'battery_fru': None, 'max_strip_size': 1048576.0, 'degraded': 1, 'max_parallel_commands': 928, 'rebuild_rate': True, 'enable_copyback_to_ssd_on_smart_error': False, 'revision_no': 'a04', 'subdeviceid': '1f49', 'flash': 'present', 'host_interface': 'pcie', 'snapshot_enabled': False, 'controller_temperature': 63, 'write_policy': 'wb', 'enable_led_header': False, 'max_strips_perio': 42, 'pr_correct_unconfigured_areas': True, 'access_policy': True, 'power_saving_option': "don't spin down unconfigured drives", 'spin_down_time': 30, 'revertible_hot_spares': True, 'reconstruction': True, 'vendor_id': 1000, 'post_delay': 90, 'deny_smp_passthrough': False, 'ctrl-r_version': '5.14-0500', 'coercion_mode': 134217728.0, 'cluster_mode': 'disabled', 'block_ssd_write_disk_cache_change': False, 'temperature_sensor_for_roc': 'present', 'support_online_fw_update': True, 'global_hot_spares': True, 'allow_hdd_sas_sata_mix_in_vd': False, 'disks': 11, 'direct_pd_mapping': True, 'sas_address': 51866, 'mfg_date': '07/23/16', 'disable_online_controller_reset': False, 'tty_log_in_flash': True, 'dirty_led_shows_drive_activity': False, 'deny_force_good_bad': False, 'security_key_assigned': False, 'foreign_config_import': True, 'cluster_permitted': False, 'serial_no': '67j02vj', 'flush_time': 4, 'maintain_pd_fail_history': False, 'supported_drives': 'sas, sata', 'cluster_support': False, 'deny_missing_replace': False, 'chiprevision': 'c0', 'nvdata_version': '3.1511.00-0006', 'alarm_disable': False, 'physical_devices': 12, 'auto_detect_backplane_enable': 'sgpio/i2c sep', 'disk_cache_policy': True, 'memory_correctable_errors': 0, 'bgi_rate': True, 'support_ldpi_type2': True, 'support_ldpi_type3': False, 'support_ldpi_type1': False, 'max_arrays': 128, 'on_board_expander': 'absent', 'max_arms_per_vd': 32, 'check_consistency_rate': 30, 'offline': 0, 'reconstruct_rate': True, 'reconstruction_rate': 30, 'load_balance_mode': 'auto', 'bios_error_handling': 'pause on errors', 'strip_size': 65536.0, 'critical_disks': 0, 'deny_cc': False, 'un-certified_hard_disk_drives': 'allow', 'zcr_config': 'unknown', 'physical_drive_coercion_mode': 134217728.0, 'power_savings': True, 'delay_during_post': 0, 'use_fde_only': True, 'allow_mix_in_enclosure': True, 'disable_ctrl-r': False, 'use_disk_activity_for_locate': False, 'security_key_not_backedup': False, 'force_rebuild': True, 'enable_ldbbm': True, 'allow_hdd_ssd_mix_in_vd': False, 'cache_flush_interval': 4, 'alarm_control': True, 'current_size_of_fw_cache': 984612864.0, 'deny_scsi_passthrough': False, 'number_of_backend_port': 8, 'deny_locate': False, 'enablecrashdump': False, 'cc_rate': True, 'max_drives_to_spinup_at_one_time': 4, 'virtual_drives': 2, 'support_pfk': False, 'disable_spin_down_of_hot_spares': True, 'delay_among_spinup_groups': 12, 'support_the_oce_without_adding_drives': True, 'cluster_active': False, 'background_rate': 30, 'enableldbbm': True, 'cached_io': False, 'host_request_reordering': 'enabled', 'sas_disable': False, 'nvram': 'present', 'maximum_number_of_direct_attached_drives_to_spin_up_in_1_min': 0, 'rework_date': '07/23/16', 'patrol_read_rate': True, 'memory': 'present', 'bios_version': '6.29.00.0_4.16.07.00_0x06120100', 'bbu': True, 'deny_stp_passthrough': False, 'pr_rate': 30, 'memory_uncorrectable_errors': 0, 'temperature_sensor_for_controller': 'present', 'failed_disks': 0, 'deny_force_failed': False, 'default_spin_down_time_in_minutes': 30, 'current_boot_mode': 'normal', 'support_pi': True, 'pfk_in_nvram': False, 'max_number_of_vds': 64, 'enable_spin_down_of_unconfigured_drives': False, 'enable_shield_state': False, 'enable_copyback_on_smart': False, 'interrupt_throttle_active_count': 16, 'ecc_bucket_count': 0, 'cluster_disable': True, 'support_shield_state': True, 'ecc_bucket_leak_rate': 240, 'raid_level_supported': 'raid0, raid1, raid5, raid6, raid10, raid50, raid60, prl 11, prl 11 with spanning, prl11-rlq0 ddf layout with no span, prl11-rlq0 ddf layout with span', 'upgrade_key': 'absent', 'controller_id': 0, 'allow_sata_in_cluster': False, 'treat_single_span_r1e_as_r10': True, 'support_boot_time_pfk_change': False, 'roc_temperature': 63, 'subvendorid': 1028, 'restore_hotspare_on_insertion': 'disabled', 'disable_online_pfk_change': False, 'boot_block_version': '3.07.00.00-0003', 'read_policy': 'adaptive', 'restore_hot_spare_on_insertion': False, 'max_chained_enclosures': 4, 'disable_copyback': False, 'bios_enumerate_vds': True, 'led_show_drive_activity': True, 'fw_version': '4.260.00-7126', 'serial_debugger': 'present', 'io_policy': True, 'deny_clear': False, 'spanning': True, 'zero_based_enclosure_enumeration': True, 'id': 0, 'interrupt_throttle_completion': '50us', 'current_time': '10:18:36 11/3, 2016', 'allow_ssd_sas_sata_mix_in_vd': False, 'max_sge_count': 60, 'predictive_fail_poll_interval': 300, 'max_spans_per_vd': 8, 'port': 'address', 'bios_continue_on_error': 1, 'dedicated_hot_spare': True, 'auto_enhanced_import': False, 'ncq': False, 'auto_rebuild': 'enabled', 'allow_ctrl_encryption': False, 'force_offline': True, 'allow_mixed_redundancy_on_array': False, 'product_name': 'perc h730 mini', 'disable_join_mirror': True, 'support_breakmirror': True, 'number_of_frontend_port': 0, 'expose_enclosure_devices': False, 'breakmirror_raid_support': True, 'default_ld_powersave_policy': 'controller defined', 'battery_warning': 'enabled', 'link_speed': 3, 'cache_when_bbu_bad': 'disabled', 'fw_package_build': '25.4.1.0004', 'support_security': True, 'ecc_bucket_size': 255, 'device_id': 5, 'enable_ssd_patrol_read': False, 'any_offline_vd_cache_preserved': False, 'security_key_failed': False, 't10_power_state': True, 'force_online': True, 'alarm': 'disabled', 'max_data_transfer_size': 8192, 'enable_jbod': True, 'max_configurable_cachecade_size': 0.0, 'max_ld_per_array': 16, 'phy_polaritysplit': 0, 'allow_boot_with_preserved_cache': False, 'allowed_device_type': 'sas/sata mix', 'preboot_cli_enabled': False}]
>>> cli.enclosures()
[{'number_of_slots': 12, 'number_of_sim_modules': 1, 'adapter_id': 0, 'number_of_fans': 0, 'product_identification': 'bp13g+exp', 'id': 0, 'number_of_alarms': 0, 'enclosure_serial_number': None, 'status': 'normal', 'enclosure_type': 'ses', 'esm_serial_number': None, 'number_of_power_supplies': 0, 'vendor_identification': 'dp', 'device_id': 32, 'product_revision_level': 3.0, 'number_of_physical_drives': 12, 'partner_device_id': 65535, 'connector_name': 'unavailable', 'fru_part_number': None, 'position': 1, 'number_of_temperature_sensors': 0, 'enclosure_zoning_mode': None}]
>>> cli.bbu()
[{'battery_state': 'optimal', 'estimated_time_to_full_recharge': 'battery is not being charged.', 'learn_cycle_timeout': False, 'date_of_manufacture': '00/00, 0000', 'bbu_capacity_info_for_adapter': 0, 'pack_stat_configuration': '0x0000', 'bbu_properties_for_adapter': 0, 'voltage': 'ok', 'battery_fru': None, 'full_charge_capacity': 405, 'no_space_to_cache_offload': False, 'batterytype': 'bbu', 'charger_status': 'complete', 'learn_delay_interval': 0, 'auto_learn_period': 90, 'learn_cycle_active': False, 'manufacture_name': '0x129', 'temperature': 'ok', 'relative_state_of_charge': 98, 'bbu_design_info_for_adapter': 0, 'design_voltage': 0, 'current': 0, 'specification_info': 0, 'cache_offload_premium_feature_required': False, 'serial_number': 0, 'remaining_capacity_low': False, 'auto-learn_mode': 'transparent', 'module_microcode_update_required': False, 'battery_pack_missing': False, 'remaining_capacity': 394, 'bbu_status_for_adapter': 0, 'charging_status': None, 'periodic_learn_required': False, 'transparent_learn': False, 'learn_cycle_status': 'ok', 'bbu_gasgauge_status': '0x0038', 'battery_backup_charge_time': 0, 'average_time_to_empty': 32, 'next_learn_time': 'fri dec 9 15:20:59 2016', 'design_capacity': 0, 'issohgood': True, 'absolute_state_of_charge': 0, 'run_time_to_empty': 'battery is not being charged.', 'pack_is_about_to_fail_&_should_be_replaced': False, 'learn_cycle_requested': False, 'battery_replacement_required': False, 'i2c_errors_detected': False, 'cycle_count': 3, 'firmware_version': 0.0}]
>>> cli.logicaldrives()
[{'number_of_drives': 2, 'adapter_id': 0, 'strip_size': 65536.0, 'default_access_policy': 'read/write', 'id': 0, 'size': 3998923790221.312, 'current_access_policy': 'read/write', 'sector_size': 512, 'disk_cache_policy': 'enabled', 'encryption_type': None, 'default_power_savings_policy': 'controller defined', 'raid_level': 'primary-1, secondary-0, raid level qualifier-0', 'current_power_savings_policy': None, 'ld_io_profile_supports_max_power_savings_with_cached_writes': False, 'default_cache_policy': 'writeback, readadaptive, direct, no write cache if bad bbu', 'state': 'optimal', 'ld_has_drives_that_support_t10_power_conditions': False, 'mirror_data': 3998923790221.312, 'is_vd_cached': False, 'is_vd_emulated': True, 'current_cache_policy': 'writeback, readadaptive, direct, no write cache if bad bbu', 'can_spin_up_in_1_minute': True, 'name': 'dg1-rl1', 'span_depth': 1, 'bad_blocks_exist': False, 'pi_type': 'no pi'}, {'number_of_drives': 10, 'adapter_id': 0, 'strip_size': 65536.0, 'default_access_policy': 'read/write', 'id': 1, 'size': 32001285926420.48, 'current_access_policy': 'read/write', 'sector_size': 512, 'disk_cache_policy': "disk's default", 'encryption_type': None, 'default_power_savings_policy': 'controller defined', 'raid_level': 'primary-6, secondary-0, raid level qualifier-3', 'current_power_savings_policy': None, 'ld_io_profile_supports_max_power_savings_with_cached_writes': False, 'default_cache_policy': 'writeback, readadaptive, direct, no write cache if bad bbu', 'state': 'partially degraded', 'ld_has_drives_that_support_t10_power_conditions': False, 'is_vd_emulated': True, 'is_vd_cached': False, 'can_spin_up_in_1_minute': True, 'current_cache_policy': 'writeback, readadaptive, direct, no write cache if bad bbu', 'span_depth': 1, 'bad_blocks_exist': False, 'pi_type': 'no pi', 'parity_size': 8000046603698.176}]
>>> cli.physicaldrives()
[{'port_linkspeed': 6442450944.0, 'drive_temperature': '36c (96.80 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e2asxs5zwdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee262eb9643', 'drive_position': 'diskgroup:0, span:0, arm:0', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 0, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc0', 'device_id': 0, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '36c (96.80 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e1nh06j4wdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee262eb927e', 'drive_position': 'diskgroup:0, span:0, arm:1', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 1, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc1', 'device_id': 1, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '35c (95.00 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e4xp8pkvwdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee20d95e6c4', 'drive_position': 'diskgroup:1, span:0, arm:0', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 2, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc2', 'device_id': 2, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '33c (91.40 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e6ryx384wdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee262eb80e8', 'drive_position': 'diskgroup:1, span:0, arm:1', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 3, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc3', 'device_id': 3, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '33c (91.40 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e4xp89jlwdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee2b840b6cf', 'drive_position': 'diskgroup:1, span:0, arm:2', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 4, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc4', 'device_id': 4, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '33c (91.40 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e4vkfputwdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee20d95f862', 'drive_position': 'diskgroup:1, span:0, arm:3', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 5, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc5', 'device_id': 5, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '33c (91.40 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e2asxa4fwdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee262eb965f', 'drive_position': 'diskgroup:1, span:0, arm:4', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 6, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc6', 'device_id': 6, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '34c (93.20 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e2taxrrswdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee2b8414797', 'drive_position': 'diskgroup:1, span:0, arm:5', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 7, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc7', 'device_id': 7, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '35c (95.00 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e4vkffv8wdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee262eb900c', 'drive_position': 'diskgroup:1, span:0, arm:6', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 8, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc8', 'device_id': 8, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '34c (93.20 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e1nh0xudwdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee2b84154fc', 'drive_position': 'diskgroup:1, span:0, arm:7', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 9, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cc9', 'device_id': 9, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}, {'port_linkspeed': 6442450944.0, 'drive_temperature': '34c (93.20 f)', 'adapter_id': 0, 'needs_ekm_attention': False, 'device_firmware_level': '0a82', 'raw_size': 4000023301849.088, 'inquiry_data': 'wd-wcc4e0jyl397wdc wd40efrx-68wt0n0 82.00a82', 'wwn': '50014ee262eaff8a', 'drive_position': 'diskgroup:1, span:0, arm:8', 'sector_size': 512, 'fde_capable': 'not capable', 'pi_eligibility': False, 'secured': 'unsecured', 'pd_type': 'sata', 'device_speed': 6442450944.0, 'last_predictive_failure_event_seq_number': 0, 'drive_has_flagged_a_smart_alert': False, 'media_type': 'hard disk device', 'pi': 'no pi', 'logical_sector_size': 512, 'drive_is_formatted_for_pi_information': False, 'physical_sector_size': 4096, 'connected_port_number': '0(path0)', 'coerced_size': 3998923790221.312, 'predictive_failure_count': 0, 'fde_enable': 'disable', 'non_coerced_size': 3998923790221.312, 'successful_diagnostics_completion_on': None, 'port_status': 'active', 'media_error_count': 0, 'foreign_state': None, 'link_speed': 6442450944.0, 'firmware_state': 'online, spun up', 'slot_number': 10, 'shield_counter': 0, 'sas_address(0)': '0x500056b3186e7cca', 'device_id': 10, 'locked': 'unlocked', 'enclosure_id': 32, 'drive': 'not certified', 'enclosure_position': 1, 'other_error_count': 0, 'sequence_number': 2, 'drive_ncq_setting': None}]
Handling exceptions:
try:
cli.bbu()
except MegaCLIError as e:
print("Exitcode: {0}, Message: {1}".format(e.exitcode, e.message))
Matteo Cerutti - [email protected]