-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NVMe Support in SMART Stats module (#895)
* NVMe-Support Includes migration, fixes to script logic, enables SMART on drives before data is gathered, fixes blank keys not being nulled * Fixed missing columns * Updated listing * Updated ReadMe * Add failing badge to client tab
- Loading branch information
Showing
8 changed files
with
195 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
app/modules/smart_stats/migrations/004_smart_stats_add_nvme_columns.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
class Migration_smart_stats_add_nvme_columns extends \Model | ||
{ | ||
protected $new_columns = array( | ||
'model_number' => 'VARCHAR(255)', | ||
'pci_vender_subsystem_id' => 'VARCHAR(255)', | ||
'temperature_nvme' => 'BIGINT', | ||
'power_on_hours_nvme' => 'BIGINT', | ||
'power_cycle_count_nvme' => 'BIGINT', | ||
'critical_warning' => 'VARCHAR(255)', | ||
'available_spare' => 'BIGINT', | ||
'available_spare_threshold' => 'BIGINT', | ||
'percentage_used' => 'BIGINT', | ||
'data_units_read' => 'VARCHAR(255)', | ||
'data_units_written' => 'VARCHAR(255)', | ||
'host_read_commands' => 'BIGINT', | ||
'host_write_commands' => 'BIGINT', | ||
'controller_busy_time' => 'BIGINT', | ||
'unsafe_shutdowns' => 'BIGINT', | ||
'media_data_integrity_errors' => 'BIGINT', | ||
'error_info_log_entries' => 'BIGINT', | ||
'ieee_oui_id' => 'VARCHAR(255)', | ||
'controller_id' => 'BIGINT', | ||
'number_of_namespaces' => 'BIGINT', | ||
'firmware_updates' => 'VARCHAR(255)', | ||
'optional_admin_commands' => 'TEXT', | ||
'optional_nvm_commands' => 'TEXT', | ||
'max_data_transfer_size' => 'VARCHAR(255)', | ||
); | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->tablename = 'smart_stats'; | ||
} | ||
|
||
public function up() | ||
{ | ||
// Get database handle | ||
$dbh = $this->getdbh(); | ||
|
||
// Wrap in transaction | ||
$dbh->beginTransaction(); | ||
|
||
// Adding a column is simple... | ||
foreach ($this->new_columns as $column => $type) { | ||
$sql = "ALTER TABLE smart_stats ADD COLUMN $column $type"; | ||
$this->exec($sql); | ||
} | ||
|
||
$dbh->commit(); | ||
} | ||
|
||
public function down() | ||
{ | ||
// Can't go back. Just like we can't go back to the 1964 New York World's Fair and ride the Greyhound people movers :/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.