Initial commit
This commit is contained in:
commit
529efd53a1
140 changed files with 10310 additions and 0 deletions
61
rrdtools/archive/rrd-hddmon.pl
Executable file
61
rrdtools/archive/rrd-hddmon.pl
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
|
||||
# RRA:CF:xff:step:rows
|
||||
|
||||
$debug = 1;
|
||||
|
||||
$dbname = "dbase/hdtemp.rrd";
|
||||
$pic="temp.gif";
|
||||
|
||||
$step = 10; # 5min , 5*60sec
|
||||
$num_pdp=3600/$step; # 12 value of pdp = (5*60)*12 = 1 hour
|
||||
$rows_pdp=24; # 24 value of $num_pdp = 1 day
|
||||
|
||||
|
||||
$rrdtool = "/usr/local/bin/rrdtool";
|
||||
#$create = "$rrdtool create $dbname ".
|
||||
# " --start now-1h ".
|
||||
# " --step $step ".
|
||||
# " DS:hdtemp:GAUGE:".(2*$step).":0:100 ".
|
||||
# " RRA:AVERAGE:0.5:$num_pdp:$rows_pdp ".
|
||||
# " RRA:MIN:0.5:$num_pdp:$rows_pdp ".
|
||||
# " RRA:MAX:0.5:$num_pdp:$rows_pdp ";
|
||||
|
||||
$create = "$rrdtool create $dbname ".
|
||||
"--start now-1h ".
|
||||
"--step $step ".
|
||||
"DS:hdtemp:GAUGE:".(2*$step).":0:100 ".
|
||||
"RRA:MIN:0.5:1:".(6*$step)." ".
|
||||
"RRA:MAX:0.5:1:".(6*$step)." ".
|
||||
"RRA:LAST:0.5:1:".(6*$step)." ".
|
||||
"RRA:AVERAGE:0.5:1:".(6*$step);
|
||||
|
||||
system($create);
|
||||
|
||||
while(1) {
|
||||
|
||||
@hdparams = `smartctl -a /dev/ad0`;
|
||||
foreach $line (@hdparams) {
|
||||
if ($line =~ /Temperature_Celsius/){
|
||||
@temp = split (" ",$line);
|
||||
print $temp[9]." ";
|
||||
}
|
||||
}
|
||||
|
||||
$now = time();
|
||||
$update = "$rrdtool update $dbname $now:$temp[9]";
|
||||
system($update);
|
||||
|
||||
$graph ="$rrdtool graph $pic --title \"HD temp\" ".
|
||||
"--start now-1h ".
|
||||
"DEF:c=$dbname:hdtemp:AVERAGE ".
|
||||
"AREA:c#0000FF:Temperature ".
|
||||
"GPRINT:c:MIN:'Min\\: %3.1lf%S' ".
|
||||
"GPRINT:c:MAX:'Max\\: %3.1lf%S' ".
|
||||
"GPRINT:c:LAST:'Last\\: %3.1lf%S' ".
|
||||
"GPRINT:c:AVERAGE:'Avg\\: %3.1lf%S' ";
|
||||
|
||||
system($graph." > /dev/null");
|
||||
sleep $step;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue