hddtemp.phps
<?php
/* hddtemp.php - php-script for showing temp of the disks in computers
* on homepages for easy monitoring using the program hddtemp.
* hddtemp homepage: http://coredump.free.fr/linux/hddtemp.php
*
* Quick usage: start hddtemp eg like hddtemp -d /dev/hda /dev/hdb and then
* point the script to the machine(s) running hddtemp, and you're done!
*
* Script poked together by Erik Andersson in 2003 - http://packy.se/
* erik AT packy DOT se
* Please feel free to drop me a line with url to your homepage if you
* put it up yourself. :) (Also -please- don't remove this, mmk?)
*/
function hddtemp($hd_host,$hd_port)
{
if(!$hd_host&&!$hd_port){
$hd_host='localhost';
$hd_port='7634';
} elseif(!$hd_port) {
$hd_port='7634';
} elseif(!$hd_host) {
$hd_host='localhost';
}
$sock=fsockopen($hd_host,$hd_port,$errno,$errstr,'3');
if($sock){
while(!feof($sock)) {
$data=fgets($sock,8192);
list($inittmp,$dev,$model,$temp,$unit,$extra)=explode("|",$data,6);
$hddtemp="$dev: " . $temp . "°" . $unit . " ($model)<br>\n";
while($extra){
list($inittmp,$dev,$model,$temp,$unit,$extra)=explode("|",$extra,6);
$hddtemp.="$dev: " . $temp . "°" . $unit . " ($model)<br>\n";
}
}
fclose($sock);
}
return($hddtemp);
}
?>
<p>temp-stats:</p>
sylvester.lan.crypto.tk:<br>
<?=hddtemp('crypto.tk','7634')?><br>
ghost.lan.crypto.tk:<br>
<?=hddtemp('192.168.0.35','7634')?><br>