my %mbmon_settings = ();
&General::readhash("${General::swroot}/mbmon/settings", \%mbmon_settings);
-
-
# Added for conversion of utf-8 characters
use Encode 'from_to';
my %tr=();
my $count = 0;
my $ERROR;
my $dbg = 0;
-my $path_rrd = "/var/log/rrd";
-my $path_graphs = "/home/httpd/html/graphs";
my $path_smartctl = "/usr/sbin/smartctl";
+my $path_hddtemp = "/usr/sbin/hddtemp";
my %colors = ();
$colors{"1"} = "#0000FF";
sub updatehdddata
{
- if ( ! -e "$path_rrd/hddtemp.rrd")
+ if ( ! -e "$rrdlog/hddtemp.rrd")
{
# database did not exist -> create
- RRDs::create ("$path_rrd/hddtemp.rrd", "--step=300",
+ RRDs::create ("$rrdlog/hddtemp.rrd", "--step=300",
"DS:temperature:GAUGE:600:0:100",
"RRA:AVERAGE:0.5:1:576",
"RRA:AVERAGE:0.5:6:672",
# print "hdd $hdd_output \n";
# print "temp $temp \n";
- RRDs::update ("$path_rrd/hddtemp.rrd", "-t", "temperature", "N:$temp");
+ RRDs::update ("$rrdlog/hddtemp.rrd", "-t", "temperature", "N:$temp");
$ERROR = RRDs::error;
print "Error in RRD::update for hdd: $ERROR\n" if $ERROR;
sub updatembmondata
{
- if ( ! -e "$path_rrd/mbmon.rrd" )
+ if ( ! -e "$rrdlog/mbmon.rrd" )
{
# database did not exist -> create
- @args = ("$path_rrd/mbmon.rrd");
+ @args = ("$rrdlog/mbmon.rrd");
push(@args, "--step=300");
foreach $key ( sort(keys %mbmon_values) )
print("update template = '$template'\n") if ( $dbg );
print("update value = '$value'\n") if ( $dbg );
- RRDs::update("$path_rrd/mbmon.rrd", "-t", $template, $value);
+ RRDs::update("$rrdlog/mbmon.rrd", "-t", $template, $value);
$ERROR = RRDs::error;
print("Error in RRD::update for mbmon: $ERROR\n") if $ERROR;
}
my $type = "temp";
my $period = $_[0];
- @args = ("$path_graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
+ @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
"--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
"--color", "SHADEA#EAE9EE",
"--color", "SHADEB#EAE9EE",
$mbmon_settings{'LABEL-'.$key} = $key;
}
- push(@args, "DEF:$key=$path_rrd/mbmon.rrd:$key:AVERAGE");
+ push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} $tr{'mbmon temp in'} °C");
push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.1lf °C");
push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.1lf °C");
my $type = "fan";
my $period = $_[0];
- @args = ("$path_graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
+ @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
"--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
"--color", "SHADEA#EAE9EE",
"--color", "SHADEB#EAE9EE",
$mbmon_settings{'LABEL-'.$key} = $key;
}
- push(@args, "DEF:$key=$path_rrd/mbmon.rrd:$key:AVERAGE");
+ push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} $tr{'mbmon fan in'} rpm");
push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.0lf rpm");
push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.0lf rpm");
my $type = "volt";
my $period = $_[0];
- @args = ("$path_graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
+ @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
"--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
"--color", "SHADEA#EAE9EE",
"--color", "SHADEB#EAE9EE",
$mbmon_settings{'LABEL-'.$key} = $key;
}
- push(@args, "DEF:$key=$path_rrd/mbmon.rrd:$key:AVERAGE");
+ push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} V");
push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.2lf V");
push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.2lf V");