Linux-AtaSmart

 view release on metacpan or  search on metacpan

lib/Linux/AtaSmart.pm  view on Meta::CPAN

B<HAVING GROUP WRITE PERMISSIONS IS NOT ENOUGH!>

=head1 METHODS

=head2 C<new(disk_device)>

Creates a new C<Linux::AtaSmart> object. Requires one argument, a string identifying
the disk to examine, e.g. F</dev/sda>, F</dev/disk/by-label/HOME>

Will C<croak> if there is any error, or the device does not support SMART.

=head2 C<get_size>

Returns the disk capacity in bytes.

=head2 C<check_sleep_mode>

Boolean, true if awake, false if sleeping. Reading SMART data will wake up the disk,
so check this first if you care.

=head2 C<dump>

Prints all the available SMART info for the disk to F<STDOUT>.

=head2 C<smart_status>

Boolean, true is GOOD, false is BAD.

=head2 C<get_temperature>

Returns current disk temperature in celsius, or C<undef> if not supported.

The C library actually uses millikelvins, complain if you'd prefer that.

=head2 C<get_bad>

Returns the number of bad sectors on the disk.

=head2 C<get_overall>

Returns an integer corresponding to the overall status of the drive.
See L<Linux::AtaSmart::Constants>.

=head2 C<get_power_cycle>

Returns number of times the disk has been power cycled.

=head2 C<get_power_on>

Returns the total time this disk has been powered-on as a L<Time::Seconds> object.
The C library actually uses milliseconds, complain if you'd prefer that.

=head2 C<self_test(TEST_TYPE)>

Starts a test of TEST_TYPE. See L<Linux::AtaSmart::Constants>.

=for Pod::Coverage BUILDARGS DEMOLISH

=head1 ALTERNATIVES

You may already have L<udisks|http://www.freedesktop.org/wiki/Software/udisks>
installed, which you can query via L<Net::DBus>.

=head1 INSTALLATION

You will need your system's C<libatasmart> development package installed.
On Debian-like systems, this is C<libatasmart-dev>. On Fedora it is
C<libatasmart-devel>.

=head1 DIFFERENCES FROM THE C API

=over

=item

Removed the C<sk_disk_> and C<sk_disk_smart_> prefixes for brevity.

=item

The C<SkDisk> item is handled inside this module, you don't need to pass it to every method.
You should create a new object to examine a different disk.

=item

Results are returned directly by the methods, you don't have to pass references to be filled.

=item

You don't have to manually call C<sk_disk_smart_read_data> or C<sk_disk_smart_parse_data>.
This will be handled automatically by those methods that require it.

=back

=head1 ERRORS

All errors will throw exceptions via C<croak>

=head1 SEE ALSO

=over

=item

L<libatasmart|http://0pointer.de/blog/projects/being-smart.html>

=item

L<Linux::AtaSmart::Constants>

=back

=head1 BUGS AND LIMITATIONS

You can make new bug reports, and view existing ones, through the
web interface at L<https://github.com/ioanrogers/Linux-AtaSmart/issues>.

=head1 AVAILABILITY

The project homepage is L<http://metacpan.org/release/Linux-AtaSmart/>.

The latest version of this module is available from the Comprehensive Perl



( run in 0.845 second using v1.01-cache-2.11-cpan-39bf76dae61 )