Linux::hddtemp - monitors hard drive temperatures using the linux hddtemp utility
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};
Linux::hddtemp will fetch hard drive temperatures from the linux hddtemp utility, see SEE ALSO below.
Linux::hddtemp
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.
The following methods can be used.
my $hdt = Linux::hddtemp->new( host => 'localhost', port => 7634, separator => '|', );
new creates a new Linux::hddtemp object using the configuration passed to it.
new
The following options can be passed to new
Specifies the host/ip-address where hddtemp is run, defaults to localhost.
Specifies the port to which hddtemp is listening, as set with the -p option of hddtemp, defaults to 7634.
Specifies the separator set with the -s option of hddtemp, defaults to |.
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:
get
{ /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 '*'.
temp
unit
http://dev.yorhel.nl/Linux-hddtemp/, hddtemp(8), http://www.guzu.net/linux/hddtemp.php
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.
Y. Heling, <yorhel@cpan.org>
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.
To install Linux::hddtemp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Linux::hddtemp
CPAN shell
perl -MCPAN -e shell install Linux::hddtemp
For more information on module installation, please visit the detailed CPAN module installation guide.