NAME

Disk::SMART - Provides an interface to smartctl

SYNOPSIS

Disk::SMART is an object ooriented module that provides an interface to get SMART disk info from a device as well as initiate testing. use Disk::SMART;

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

CONSTRUCTOR

new(DEVICE)

Instantiates the Disk::SMART object

DEVICE - Device identifier of SSD / Hard Drive. The constructor takes either a single device name, or an array of device names.

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

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

USER METHODS

get_disk_attributes(DEVICE)

Returns hash of the SMART disk attributes and values

DEVICE - Device identifier of SSD/ Hard Drive

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

get_disk_errors(DEVICE)

Returns scalar of any listed errors

DEVICE - Device identifier of SSD/ Hard Drive

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

get_disk_health(DEVICE)

Returns the health of the disk. Output is "PASSED", "FAILED", or "N/A".

DEVICE - Device identifier of SSD / Hard Drive

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

get_disk_model(DEVICE)

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

DEVICE - Device identifier of SSD / Hard Drive

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

get_disk_temp(DEVICE)

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

DEVICE - Device identifier of SSD / Hard Drive

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

update_data

Updates the SMART output and attributes of a device. Returns undef.

DEVICE - Device identifier of SSD/ Hard Drive

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

run_short_test

Runs the SMART short self test and returns the result.

DEVICE - Device identifier of SSD/ Hard Drive

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

AUTHOR

Paul Trost <ptrost@cpan.org>

LICENSE AND COPYRIGHT

Copyright 2014 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.
<http://gnu.org/licenses/gpl.html>