NAME

Linux::hddtemp - monitors hard drive temperatures using the linux hddtemp utility

SYNOPSIS

use Linux::hddtemp;

my $hdt = Linux::hddtemp->new();
my $temps = $hdt->get();
print $temps->{/dev/hda}{temp};

## or:
print Linux::hddtemp->new()->get()->{/dev/hda}{temp};

DESCRIPTION

Linux::hddtemp will fetch hard drive temperatures from the linux hddtemp utility, see SEE ALSO below.

You will need hddtemp to run in daemon mode for this module to work. This can simply be done with the -d option of hddtemp, see the hddtemp manual for more information.

METHODS

The following methods can be used.

new

my $hdt = Linux::hddtemp->new(
  host => 'localhost',
  port => 7634,
  separator => '|',
);

new creates a new Linux::hddtemp object using the configuration passed to it.

options

The following options can be passed to new

host

Specifies the host/ip-address where hddtemp is run, defaults to localhost.

port

Specifies the port to which hddtemp is listening, as set with the -p option of hddtemp, defaults to 7634.

separator

Specifies the separator set with the -s option of hddtemp, defaults to |.

get

my $hashref = $hdt->get();
print $hashref->{/dev/hda}{name} . ": " . $hashref->{/dev/hda}{temp};

get returns a hashref containing temperatures and other information returned from the hddtemp daemon in the following format:

{
  /dev/hda => { # device (as specified with the hddtemp options)
    name => 'MAXTOR 6L200P0',  # name of the device
    temp => 32,  # the temperature of the device
    unit => 'C'  # temperature unit (normally degrees celcius)
  }
}

Note that temp is in most cases a normal integer, but can also be 'UKN' if the temperature of the disk is unknown or 'SLP' if the drive is sleeping. In those cases, unit will be '*'.

SEE ALSO

http://dev.yorhel.nl/Linux-hddtemp/, hddtemp(8), http://www.guzu.net/linux/hddtemp.php

BUGS

If you find a bug, please report it at http://rt.cpan.org/Public/Dist/Display.html?Name=Linux-hddtemp or send an e-mail to the author.

AUTHOR

Y. Heling, <yorhel@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Y. Heling

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.