Няма описание

George S. Baugh f55e8858d4 Merge pull request #3 from Ilya33/master преди 8 години
dist c836958854 Updated to v0.18, check Changes file for details преди 10 години
lib 14fc9e47a3 typo fixes (get_smart_output => _get_smart_output) преди 8 години
t 855049c6d1 Added root check to constructer, and updated unit test преди 10 години
Changes c836958854 Updated to v0.18, check Changes file for details преди 10 години
INSTALL 9841e214e5 Bumped version number for new version cpan testing преди 10 години
LICENSE 9bf3181a9b Initial commit преди 11 години
MANIFEST c836958854 Updated to v0.18, check Changes file for details преди 10 години
MANIFEST.SKIP c836958854 Updated to v0.18, check Changes file for details преди 10 години
Makefile.PL 7aba380482 v0.13 - see Changes for detals преди 10 години
README.pod c836958854 Updated to v0.18, check Changes file for details преди 10 години

README.pod

=head1 NAME

Disk::SMART - Provides an interface to smartctl to return disk stats and to run tests.

=head1 SYNOPSIS

Disk::SMART is an object oriented module that provides an interface to get SMART disk info from a device as well as initiate testing. An exmple script using this module can be found at https://github.com/paultrost/linux-geek/blob/master/sysinfo.pl

use Disk::SMART;

my $smart = Disk::SMART->new('/dev/sda', '/dev/sdb');

my $disk_health = $smart->get_disk_health('/dev/sda');

=head1 CONSTRUCTOR

=head2 B

Instantiates the Disk::SMART object

C - Device identifier of a single SSD / Hard Drive, or a list. If no devices are supplied then it runs get_disk_list() which will return an array of detected sdX and hdX devices.

my $smart = Disk::SMART->new();
my $smart = Disk::SMART->new( '/dev/sda', '/dev/sdb' );
my @disks = $smart->get_disk_list();

Returns C object if smartctl is available and can poll the given device(s).

=head1 USER METHODS

=head2 B

Returns hash of the SMART disk attributes and values

C - Device identifier of a single SSD / Hard Drive

my %disk_attributes = $smart->get_disk_attributes('/dev/sda');

=head2 B

Returns scalar of any listed errors

C - Device identifier of a single SSD/ Hard Drive

my $disk_errors = $smart->get_disk_errors('/dev/sda');

=head2 B

Returns the health of the disk. Output is "PASSED", "FAILED", or "N/A". If the device has positive values for the attributes listed below then the status will output that information.

Eg. "FAILED - Reported_Uncorrectable_Errors = 1"

The attributes are:

5 - Reallocated_Sector_Count

187 - Reported_Uncorrectable_Errors

188 - Command_Timeout

197 - Current_Pending_Sector_Count

198 - Offline_Uncorrectable

If Reported_Uncorrectable_Errors is greater than 0 then the drive should be replaced immediately. This list is taken from a study shown at https://www.backblaze.com/blog/hard-drive-smart-stats/


C - Device identifier of a single SSD / Hard Drive

my $disk_health = $smart->get_disk_health('/dev/sda');

=head2 B

Returns list of detected hda and sda devices. This method can be called manually if unsure what devices are present.

$smart->get_disk_list;

=head2 B

Returns the model of the device. eg. "ST3250410AS".

C - Device identifier of a single SSD / Hard Drive

my $disk_model = $smart->get_disk_model('/dev/sda');

=head2 B

Returns an array with the temperature of the device in Celsius and Farenheit, or N/A.

C - Device identifier of a single SSD / Hard Drive

my ($temp_c, $temp_f) = $smart->get_disk_temp('/dev/sda');

=head2 B

Runs the SMART short self test and returns the result.

C - Device identifier of SSD/ Hard Drive

$smart->run_short_test('/dev/sda');

=head2 B

Updates the SMART output and attributes for each device. Returns undef.

C - Device identifier of a single SSD / Hard Drive or a list of devices. If none are specified then get_disk_list() is called to detect devices.

$smart->update_data('/dev/sda');

=head1 COMPATIBILITY

This module should run on any UNIX like OS with Perl 5.10+ and the smartctl progam installed from the smartmontools package.

=head1 AUTHOR

Paul Trost

=head1 LICENSE AND COPYRIGHT

Copyright 2015 by Paul Trost
This script is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2, or at your option any later version.