]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/scripts/makegraphs
neues Theme hinzugefuegt, geloeschtes icons wieder hinzugefuegt
[people/pmueller/ipfire-2.x.git] / src / scripts / makegraphs
index 03a53fedeb5ad517abb128e7648bd8cccad527d5..bbf1deb54576a0c69949c8ddd6ec62d2b41beb07 100644 (file)
@@ -55,7 +55,7 @@ if ((${Lang::language} eq 'el') ||
 
 # Settings
 my $rrdlog = "/var/log/rrd";
-my $graphs = "/home/httpd/html/graphs";
+my $graphs = "/srv/web/ipfire/html/graphs";
 $ENV{PATH}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
 my $hdd_device = "/dev/harddisk";
 my $temp = '';
@@ -69,15 +69,10 @@ my $dbg = 0;
 my $path_smartctl = "/usr/sbin/smartctl";
 my $path_hddtemp = "/usr/sbin/hddtemp";
 
-my %colors = ();
-$colors{"1"} = "#0000FF";
-$colors{"2"} = "#00FF00";
-$colors{"3"} = "#FF0000";
-$colors{"4"} = "#FFD700";
-$colors{"5"} = "#CCCCCC";
-$colors{"6"} = "#40E0D0";
-$colors{"7"} = "#90EE90";
-$colors{"8"} = "#F4A460";
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
 
 open(MBMON_OUT, ">/var/log/mbmon-values");
 open(FD, "/usr/bin/mbmon -rc1|" ) || die "ERROR: Cannot run mbmon\n" ;
@@ -123,9 +118,9 @@ sub updatecpugraph {
        RRDs::graph ("$graphs/cpu-$period.png",
                "--start", "-1$period", "-aPNG", "-i", "-z",
                "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-t $tr{'cpu usage per'} $tr{$period}",
                "DEF:user=$rrdlog/cpu.rrd:user:AVERAGE",
                "DEF:system=$rrdlog/cpu.rrd:system:AVERAGE",
@@ -134,9 +129,9 @@ sub updatecpugraph {
                "CDEF:userpct=100,user,total,/,*",
                "CDEF:systempct=100,system,total,/,*",
                "CDEF:idlepct=100,idle,total,/,*",
-               "AREA:userpct#0000FF:$tr{'user cpu usage'}\\j",
-               "STACK:systempct#FF0000:$tr{'system cpu usage'}\\j",
-               "STACK:idlepct#00FF00:$tr{'idle cpu usage'}\\j",
+               "AREA:userpct".$color{"color11"}.":$tr{'user cpu usage'}\\j",
+               "STACK:systempct".$color{"color13"}.":$tr{'system cpu usage'}\\j",
+               "STACK:idlepct".$color{"color12"}.":$tr{'idle cpu usage'}\\j",
                "GPRINT:userpct:MAX:$tr{'maximal'} $tr{'user cpu'}\\:%3.2lf%%",
                "GPRINT:userpct:AVERAGE:$tr{'average'} $tr{'user cpu'}\\:%3.2lf%%",
                "GPRINT:userpct:LAST:$tr{'current'} $tr{'user cpu'}\\:%3.2lf%%\\j",
@@ -191,20 +186,20 @@ sub updateloadgraph {
                "--start", "-1$period", "-aPNG",
                "-w 600", "-h 100", "-i", "-z", "-l 0", "-r", "--alt-y-grid",
                "-t Load Average",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "DEF:load1=$rrdlog/load.rrd:load1:AVERAGE",
                "DEF:load5=$rrdlog/load.rrd:load5:AVERAGE",
                "DEF:load15=$rrdlog/load.rrd:load15:AVERAGE",
-               "AREA:load1#ff0000:1 Minute, letzter\:",
-               "GPRINT:load1:LAST:%5.2lf\n",
-               "AREA:load5#ff9900:5 Minuten, letzter\:",
-               "GPRINT:load5:LAST:%5.2lf\n",
-               "AREA:load15#ffff00:15 Minuten, letzter\:",
-               "GPRINT:load15:LAST:%5.2lf",
-               "LINE1:load5#ff9900:",
-               "LINE1:load1#ff0000:");
+               "AREA:load1".$color{"color13"}.":1 Minute, letzter\\:",
+               "GPRINT:load1:LAST:%5.2lf\\j",
+               "AREA:load5".$color{"color18"}.":5 Minuten, letzter\\:",
+               "GPRINT:load5:LAST:%5.2lf\\j",
+               "AREA:load15".$color{"color14"}.":15 Minuten, letzter\\:",
+               "GPRINT:load15:LAST:%5.2lf\\j",
+               "LINE1:load5".$color{"color13"},
+               "LINE1:load1".$color{"color18"});
        $ERROR = RRDs::error;
        print "Error in RRD::graph for load: $ERROR\n" if $ERROR;
 }
@@ -231,9 +226,9 @@ sub updatememgraph {
        RRDs::graph ("$graphs/memory-$period.png",
                "--start", "-1$period", "-aPNG", "-i", "-z",
                "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-t $tr{'memory usage per'} $tr{$period}",
                "DEF:used=$rrdlog/mem.rrd:memused:AVERAGE",
                "DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE",
@@ -247,11 +242,11 @@ sub updatememgraph {
                "CDEF:bufferpct=100,buffer,total,/,*",
                "CDEF:cachepct=100,cache,total,/,*",
                "CDEF:freepct=100,free,total,/,*",
-               "AREA:usedpct#0000FF:$tr{'used memory'}\\j",
-               "STACK:sharedpct#FF0000:$tr{'shared memory'}\\j",
-               "STACK:bufferpct#FF00FF:$tr{'buffered memory'}\\j",
-               "STACK:cachepct#FFFF00:$tr{'cached memory'}\\j",
-               "STACK:freepct#00FF00:$tr{'free memory'}\\j",
+               "AREA:usedpct".$color{"color11"}.":$tr{'used memory'}\\j",
+               "STACK:sharedpct".$color{"color13"}.":$tr{'shared memory'}\\j",
+               "STACK:bufferpct".$color{"color23"}.":$tr{'buffered memory'}\\j",
+               "STACK:cachepct".$color{"color14"}.":$tr{'cached memory'}\\j",
+               "STACK:freepct".$color{"color12"}.":$tr{'free memory'}\\j",
                "GPRINT:usedpct:MAX:$tr{'maximal'} $tr{'used memory'}\\:%3.2lf%%",
                "GPRINT:usedpct:AVERAGE:$tr{'average'} $tr{'used memory'}\\:%3.2lf%%",
                "GPRINT:usedpct:LAST:$tr{'current'} $tr{'used memory'}\\:%3.2lf%%\\j",
@@ -273,17 +268,17 @@ sub updatememgraph {
        RRDs::graph ("$graphs/swap-$period.png",
                "--start", "-1$period", "-aPNG", "-i", "-z",
                "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-t $tr{'swap usage per'} $tr{$period}",
                "DEF:used=$rrdlog/mem.rrd:swapused:AVERAGE",
                "DEF:free=$rrdlog/mem.rrd:swapfree:AVERAGE",
                "CDEF:total=used,free,+",
                "CDEF:usedpct=100,used,total,/,*",
                "CDEF:freepct=100,free,total,/,*",
-               "AREA:usedpct#0000FF:$tr{'used swap'}\\j",
-               "STACK:freepct#00FF00:$tr{'free swap'}\\j",
+               "AREA:usedpct".$color{"color11"}.":$tr{'used swap'}\\j",
+               "STACK:freepct".$color{"color12"}.":$tr{'free swap'}\\j",
                "GPRINT:usedpct:MAX:$tr{'maximal'} $tr{'used swap'}\\:%3.2lf%%",
                "GPRINT:usedpct:AVERAGE:$tr{'average'} $tr{'used swap'}\\:%3.2lf%%",
                "GPRINT:usedpct:LAST:$tr{'current'} $tr{'used swap'}\\:%3.2lf%%\\j",
@@ -295,7 +290,7 @@ sub updatememgraph {
 }
 
 sub updatememdata {
-       my ($memused, $memfree, $memshared, $membuffers, $memcache, $swapused, $swapfree);
+       my ($memused, $memfree, $memshared, $membuffers, $memcache, $swapused, $swapfree, $swaptotal);
        if ( ! -e "$rrdlog/mem.rrd") {
                RRDs::create ("$rrdlog/mem.rrd", "--step=300",
                        "DS:memused:ABSOLUTE:600:0:5000000000",
@@ -316,21 +311,41 @@ sub updatememdata {
        open MEM, "/proc/meminfo";
        while(<MEM>) {
                chomp;
-               if ($_ =~ /^Mem:/) {
+               if ($_ =~ /^MemTotal:/) {
                        my @temp = split (/\s+/, $_);
-                       $memused    = $temp[2];
-                       $memfree    = $temp[3];
-                       $memshared  = $temp[4];
-                       $membuffers = $temp[5];
-                       $memcache   = $temp[6];
-               } elsif ($_ =~ /^Swap:/) {
+                       $memused    = $temp[1];
+               } elsif ($_ =~ /^MemFree:/) {
                        my @temp = split (/\s+/, $_);
-                       $swapused = $temp[2];
-                       $swapfree = $temp[3];
+                       $memfree    = $temp[1];
+               } elsif ($_ =~ /^Cached:/) {
+                       my @temp = split (/\s+/, $_);
+                       $memcache   = $temp[1];
+               } elsif ($_ =~ /^Buffers:/) {
+                       my @temp = split (/\s+/, $_);
+                       $membuffers = $temp[1];
+               } elsif ($_ =~ /^SwapTotal:/) {
+                       my @temp = split (/\s+/, $_);
+                       $swaptotal   = $temp[1];
+               } elsif ($_ =~ /^SwapFree:/) {
+                       my @temp = split (/\s+/, $_);
+                       $swapfree   = $temp[1];
                }
        }
        close MEM;
 
+       system("/bin/df > /tmp/diskfree");
+       open DF, "/tmp/diskfree";
+       while(<DF>) {
+               chomp;
+               if ($_ =~ /^shm/) {
+                       my @temp = split (/\s+/, $_);
+                       $memshared  = $temp[2];
+               }
+       }
+       close DF;
+       system("/bin/rm -f /tmp/diskfree");
+       
+       $swapused = $swaptotal-$swapfree;
        RRDs::update ("$rrdlog/mem.rrd",
                "-t", "memused:memfree:memshared:membuffers:memcache:swapused:swapfree",
                "N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree");
@@ -344,14 +359,14 @@ sub updatediskgraph {
        RRDs::graph ("$graphs/disk-$period.png",
                "--start", "-1$period", "-aPNG", "-i", "-z",
                "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-t $tr{'disk access per'} $tr{$period}",
                "DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE",
                "DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE",
-               "AREA:read#0000FF:$tr{'sectors read from disk per second'}\\j",
-               "STACK:write#00FF00:$tr{'sectors written to disk per second'}\\j",
+               "AREA:read".$color{"color11"}.":$tr{'sectors read from disk per second'}\\j",
+               "STACK:write".$color{"color12"}.":$tr{'sectors written to disk per second'}\\j",
                "GPRINT:read:MAX:$tr{'maximal'} $tr{'read sectors'}\\:%8.0lf",
                "GPRINT:read:AVERAGE:$tr{'average'} $tr{'read sectors'}\\:%8.0lf",
                "GPRINT:read:LAST:$tr{'current'} $tr{'read sectors'}\\:%8.0lf\\j",
@@ -425,9 +440,9 @@ sub updatediskgraphnew {
        RRDs::graph ("$graphs/disk-$disk-$period.png",
                "--start", "-1$period", "-aPNG", "-i", "-z",
                "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-t $tr{'disk access per'} $tr{$period}",
                "DEF:read=$rrdlog/disk-$disk.rrd:readsect:AVERAGE",
                "DEF:write=$rrdlog/disk-$disk.rrd:writesect:AVERAGE",
@@ -435,8 +450,8 @@ sub updatediskgraphnew {
                "CDEF:sl_state=sleep,INF,*",
 
                 "AREA:sl_state#a0a0a0:disk standby\\j",
-               "AREA:read#0000FF:$tr{'sectors read from disk per second'}\\j",
-               "STACK:write#00FF00:$tr{'sectors written to disk per second'}\\j",
+               "AREA:read".$color{"color11"}.":$tr{'sectors read from disk per second'}\\j",
+               "STACK:write".$color{"color12"}.":$tr{'sectors written to disk per second'}\\j",
        
                "GPRINT:read:MAX:$tr{'maximal'} $tr{'read sectors'}\\:%8.0lf",
                "GPRINT:read:AVERAGE:$tr{'average'} $tr{'read sectors'}\\:%8.0lf",
@@ -468,6 +483,8 @@ sub updatediskdatanew {
        my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
                $atime, $mtime, $ctime, $blksize, $blocks) = stat("/dev/$disk");
 
+       print "\n\n$dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks\n\n";
+
        my $major = $rdev >> 8;
        my $minor = ($rdev & 0xFF) >>6;
 
@@ -506,7 +523,7 @@ sub updatediskdatanew {
                if ($lastsleepstate==$readwritereq) {
                        $sleeping=1;
                }
-       }       
+       }
 
        if ($readsect && $writesect) {
                RRDs::update ("$rrdlog/disk-$disk.rrd",
@@ -526,15 +543,15 @@ sub updateifgraph {
        RRDs::graph ("$graphs/$interface-$period.png",
                "--start", "-1$period", "-aPNG", "-i", "-z",
                "--alt-y-grid", "-w 600", "-h 100",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-t $tr{'traffic on'} $interface ($tr{'graph per'} $tr{$period})",
                "-v$tr{'bytes per second'}",
                "DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE",
                "DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE",
-               "AREA:incoming#00FF00:$tr{'incoming traffic in bytes per second'}\\j",
-               "LINE1:outgoing#0000FF:$tr{'outgoing traffic in bytes per second'}\\j",
+               "AREA:incoming".$color{"color11"}.":$tr{'incoming traffic in bytes per second'}\\j",
+               "LINE1:outgoing".$color{"color12"}.":$tr{'outgoing traffic in bytes per second'}\\j",
                "GPRINT:incoming:MAX:$tr{'maximal'} $tr{'in'}\\:%8.3lf %sBps",
                "GPRINT:incoming:AVERAGE:$tr{'average'} $tr{'in'}\\:%8.3lf %sBps",
                "GPRINT:incoming:LAST:$tr{'current'} $tr{'in'}\\:%8.3lf %sBps\\j",
@@ -574,17 +591,17 @@ sub updatefwhitsgraph {
        RRDs::graph ("$graphs/firewallhits-$interval-area.png",
                "--start", "-1$interval", "-aPNG", "-i", "-z",
                "--alt-y-grid", "-w 600", "-h 200",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-t firewall hits over the last $interval",
                "DEF:amount=$rrdlog/firewallhits.rrd:amount:AVERAGE",
-               "AREA:amount#6464FF:firewallhits",
+               "AREA:amount".$color{"color24"}.":firewallhits",
                "GPRINT:amount:MAX:   $tr{'maximal'}\\: %2.2lf %S",
                "GPRINT:amount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
                "GPRINT:amount:LAST: $tr{'current'}\\: %2.2lf %Shits/5 min\\n",
                "DEF:portamount=$rrdlog/firewallhits.rrd:portamount:AVERAGE",
-               "AREA:portamount#FF6464:portscans",
+               "AREA:portamount".$color{"color25"}.":portscans",
                "GPRINT:portamount:MAX:      $tr{'maximal'}\\: %2.2lf %S",
                "GPRINT:portamount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
                "GPRINT:portamount:LAST: $tr{'current'}\\: %2.2lf %Shits/5 min");
@@ -594,17 +611,17 @@ sub updatefwhitsgraph {
        RRDs::graph ("$graphs/firewallhits-$interval-line.png",
                "--start", "-1$interval", "-aPNG", "-i", "-z",
                "--alt-y-grid", "-w 600", "-h 200",
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-t firewall hits over the last $interval",
                "DEF:amount=$rrdlog/firewallhits.rrd:amount:AVERAGE",
-               "LINE2:amount#6464FF:firewallhits",
+               "LINE2:amount".$color{"color24"}.":firewallhits",
                "GPRINT:amount:MAX:   $tr{'maximal'}\\: %2.2lf %S",
                "GPRINT:amount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
                "GPRINT:amount:LAST: $tr{'current'}\\: %2.2lf %Shits/5 min\\n",
                "DEF:portamount=$rrdlog/firewallhits.rrd:portamount:AVERAGE",
-               "LINE2:portamount#FF6464:portscans",
+               "LINE2:portamount".$color{"color25"}.":portscans",
                "GPRINT:portamount:MAX:      $tr{'maximal'}\\: %2.2lf %S",
                "GPRINT:portamount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
                "GPRINT:portamount:LAST: $tr{'current'}\\: %2.2lf %Shits/5 min");
@@ -702,7 +719,7 @@ sub updatelq {
        my $roundtrip=0;
        my $test=0;
 #      LQ_GATEWAY is the ip of your isp's public ip facing you
-       my $LQ_GATEWAY='www.heise.de';
+       my $LQ_GATEWAY=`netstat -rn | grep ^0.0.0.0 | awk '{print \$2}'`;
        my $NUMPINGS=10;
        my $pingoutput = `ping -c $NUMPINGS -q $LQ_GATEWAY`;
        chomp;
@@ -721,9 +738,9 @@ sub updatelqgraph {
                "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
                "-t $tr{'linkq'} ($tr{'graph per'} $tr{$period})",
                "--lazy", 
-               "--color", "SHADEA#EAE9EE",
-               "--color", "SHADEB#EAE9EE",
-               "--color", "BACK#FFFFFF",
+               "--color", "SHADEA".$color{"color19"},
+               "--color", "SHADEB".$color{"color20"},
+               "--color", "BACK".$color{"color21"},
                "-v ms / pkts (% x10)",
                "DEF:roundtrip=$rrdlog/lq.rrd:roundtrip:AVERAGE",
                "DEF:loss=$rrdlog/lq.rrd:loss:AVERAGE",
@@ -733,12 +750,12 @@ sub updatelqgraph {
                "CDEF:r1=roundtrip,70,MIN",
                "CDEF:r2=roundtrip,150,MIN",
                "CDEF:r3=roundtrip,300,MIN",
-               "AREA:roundtrip#EE7000:>300 ms",
-               "AREA:r3#D88E1B:150-300 ms",
-               "AREA:r2#B9B63F:70-150 ms",
-               "AREA:r1#99E064:30-70 ms",
-               "AREA:r0#80FF80:<30 ms",
-               "AREA:loss10#800000:Packet loss (x10)",
+               "AREA:roundtrip".$color{"color25"}.":>300 ms",
+               "AREA:r3".$color{"color18"}.":150-300 ms",
+               "AREA:r2".$color{"color14"}.":70-150 ms",
+               "AREA:r1".$color{"color17"}.":30-70 ms",
+               "AREA:r0".$color{"color12"}.":<30 ms",
+               "AREA:loss10".$color{"color13"}.":Packet loss (x10)",
                "LINE1:roundtrip#707070:",
                "GPRINT:roundtrip:MAX:$tr{'maximal'}\\:%3.2lf ms",
                "GPRINT:roundtrip:AVERAGE:$tr{'average'}\\:%3.2lf ms",
@@ -753,17 +770,18 @@ sub updatelqgraph {
 
 sub updatehdddata 
 {
-  if ( ! -e "$rrdlog/hddtemp.rrd") 
+  my $disk = $_[0];
+  if ( ! -e "$rrdlog/hddtemp-$disk.rrd") 
   {
     # database did not exist -> create
-    RRDs::create ("$rrdlog/hddtemp.rrd", "--step=300",
+    RRDs::create ("$rrdlog/hddtemp-$disk.rrd", "--step=300",
       "DS:temperature:GAUGE:600:0:100",
       "RRA:AVERAGE:0.5:1:576",
       "RRA:AVERAGE:0.5:6:672",
       "RRA:AVERAGE:0.5:24:732",
       "RRA:AVERAGE:0.5:144:1460");
     $ERROR = RRDs::error;
-    print "Error in RRD::create for hdd: $ERROR\n" if $ERROR;
+    print "Error in RRD::create for hdd-$disk: $ERROR\n" if $ERROR;
   }
 
   $temp = 0;
@@ -772,12 +790,12 @@ sub updatehdddata
 
   if ( -e "$path_smartctl" )
   {
-    system("$path_smartctl -iHA $hdd_device > /var/log/hddgraph_smartctl_out");
+    system("$path_smartctl -iHA /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");
   }
 
   if ( -e "$path_hddtemp" )
   {
-    $hdd_output = `$path_hddtemp -qn $hdd_device`;
+    $hdd_output = `$path_hddtemp -qn /dev/$disk`;
 
     # I know 4 response possible responses:
     #
@@ -794,7 +812,7 @@ sub updatehdddata
     {
       $temp = 1;
     }
-    elsif ( index($hdd_output, "$hdd_device") != -1 )
+    elsif ( index($hdd_output, "$disk") != -1 )
     {
       $hdd_output =~ /.*:.*:\s*(\d+).*\s/;
       $temp = $1;
@@ -805,9 +823,9 @@ sub updatehdddata
       $temp = $1;
     }
   }
-  elsif ( -e "/var/log/hddgraph_smartctl_out" )
+  elsif ( -e "/var/log/smartctl_out_hddtemp-$disk" )
   {
-    $hdd_output = `cat /var/log/hddgraph_smartctl_out | grep Temperature_`;
+    $hdd_output = `cat /var/log/smartctl_out_hddtemp-$disk | grep Temperature_`;
     my @t = split(/\s+/,$hdd_output);
     $temp = $t[9];
   }
@@ -819,30 +837,31 @@ sub updatehdddata
 #  print "hdd  $hdd_output \n";
 #  print "temp $temp \n";
 
-  RRDs::update ("$rrdlog/hddtemp.rrd", "-t", "temperature", "N:$temp");
+  RRDs::update ("$rrdlog/hddtemp-$disk.rrd", "-t", "temperature", "N:$temp");
 
   $ERROR = RRDs::error;
-  print "Error in RRD::update for hdd: $ERROR\n" if $ERROR;
+  print "Error in RRD::update for hdd-$disk: $ERROR\n" if $ERROR;
 }
 
 sub updatehddgraph {
-  my $period    = $_[0];
+  my $disk = $_[0];
+  my $period = $_[1];
 
-  RRDs::graph ("$graphs/hddtemp-$period.png",
+  RRDs::graph ("$graphs/hddtemp-$disk-$period.png",
     "--start", "-1$period", "-aPNG", "-i", "-z",
     "--alt-y-grid", "-w 600", "-h 100",
-    "--color", "SHADEA#EAE9EE",
-    "--color", "SHADEB#EAE9EE",
-    "--color", "BACK#FFFFFF",
+    "--color", "SHADEA".$color{"color19"},
+    "--color", "SHADEB".$color{"color20"},
+    "--color", "BACK".$color{"color21"},
     "-t $tr{'harddisk temperature'} ($tr{'graph per'} $tr{$period})",
-    "DEF:temperature=$rrdlog/hddtemp.rrd:temperature:AVERAGE",
-    "LINE2:temperature#0000FF:$tr{'hdd temperature in'} °C",
+    "DEF:temperature=$rrdlog/hddtemp-$disk.rrd:temperature:AVERAGE",
+    "LINE2:temperature".$color{"color11"}.":$tr{'hdd temperature in'} °C",
     "GPRINT:temperature:MAX:$tr{'maximal'}\\:%3.0lf °C",
     "GPRINT:temperature:AVERAGE:$tr{'average'}\\:%3.0lf °C",
     "GPRINT:temperature:LAST:$tr{'current'}\\:%3.0lf °C",
   );
   $ERROR = RRDs::error;
-  print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR;
+  print "Error in RRD::graph for hdd-$disk: $ERROR\n" if $ERROR;
 }
 
 sub updatembmondata 
@@ -898,12 +917,12 @@ sub updatetempgraph
 
   @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",
-    "--color", "BACK#FFFFFF",
+    "--color", "SHADEA".$color{"color19"},
+    "--color", "SHADEB".$color{"color20"},
+    "--color", "BACK".$color{"color21"},
     "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
 
-  $count = 1;
+  $count = 10;
   foreach $key ( sort(keys %mbmon_values) ) 
   {
     if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
@@ -914,7 +933,7 @@ sub updatetempgraph
       }
 
       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, "LINE2:$key$color{$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");
       push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.1lf °C\\j");
@@ -938,12 +957,12 @@ sub updatefangraph
 
   @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",
-    "--color", "BACK#FFFFFF",
+    "--color", "SHADEA".$color{"color19"},
+    "--color", "SHADEB".$color{"color20"},
+    "--color", "BACK".$color{"color21"},
     "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
 
-  $count = 1;
+  $count = 10;
   foreach $key ( sort(keys %mbmon_values) ) 
   {
     if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
@@ -954,7 +973,7 @@ sub updatefangraph
       }
 
       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, "LINE2:$key$color{$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");
       push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.0lf rpm\\j");
@@ -978,12 +997,12 @@ sub updatevoltgraph
 
   @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",
-    "--color", "BACK#FFFFFF",
+    "--color", "SHADEA".$color{"color19"},
+    "--color", "SHADEB".$color{"color20"},
+    "--color", "BACK".$color{"color21"},
     "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
 
-  $count = 1;
+  $count = 10;
   foreach $key ( sort(keys %mbmon_values) ) 
   {
     my $v = substr($key,0,1);
@@ -995,7 +1014,7 @@ sub updatevoltgraph
       }
 
       push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
-      push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} V");
+      push(@args, "LINE2:$key$color{$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");
       push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.2lf V\\j");
@@ -1020,7 +1039,7 @@ sleep 8;
 ### Squid Graphs
 ###
 if ( -e "/var/log/squid/access.log") {
-       system ("/usr/bin/squid-graph -o=/home/httpd/html/sgraph --tcp-only < /var/log/squid/access.log >/dev/null 2>&1");
+       system ("/usr/bin/squid-graph -o=/srv/web/ipfire/html/sgraph --tcp-only < /var/log/squid/access.log >/dev/null 2>&1");
 }
 
 ###
@@ -1198,11 +1217,109 @@ updatelqgraph("year");
 ###
 ### HDDTEMP-Graphs for /dev/harddisk
 ###
-updatehdddata();
-updatehddgraph ("day");
-updatehddgraph ("week");
-updatehddgraph ("month");
-updatehddgraph ("year");
+if (open STAT,"/dev/hda") {
+  close STAT; 
+  updatehdddata ("hda");
+  updatehddgraph ("hda","day");
+  updatehddgraph ("hda","week");
+  updatehddgraph ("hda","month");
+  updatehddgraph ("hda","year");
+} else {
+  if (-e "$graphs/hddtemp-hda-day.png") {
+     system("rm $graphs/hddtemp-hda-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdb") {
+  close STAT; 
+  updatehdddata ("hdb");
+  updatehddgraph ("hdb","day");
+  updatehddgraph ("hdb","week");
+  updatehddgraph ("hdb","month");
+  updatehddgraph ("hdb","year");
+} else {
+  if (-e "$graphs/hddtemp-hdb-day.png") {
+     system("rm $graphs/hddtemp-hdb-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdc") {
+  close STAT; 
+  updatehdddata ("hdc");
+  updatehddgraph ("hdc","day");
+  updatehddgraph ("hdc","week");
+  updatehddgraph ("hdc","month");
+  updatehddgraph ("hdc","year");
+} else {
+  if (-e "$graphs/hddtemp-hdc-day.png") {
+     system("rm $graphs/hddtemp-hdc-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdd") {
+  close STAT; 
+  updatehdddata ("hdd");
+  updatehddgraph ("hdd","day");
+  updatehddgraph ("hdd","week");
+  updatehddgraph ("hdd","month");
+  updatehddgraph ("hdd","year");
+} else {
+  if (-e "$graphs/hddtemp-hdd-day.png") {
+     system("rm $graphs/hddtemp-hdd-day.png");
+  }
+}
+
+if (open STAT,"/dev/hde") {
+  close STAT; 
+  updatehdddata ("hde");
+  updatehddgraph ("hde","day");
+  updatehddgraph ("hde","week");
+  updatehddgraph ("hde","month");
+  updatehddgraph ("hde","year");
+} else {
+  if (-e "$graphs/hddtemp-hde-day.png") {
+     system("rm $graphs/hddtemp-hde-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdf") {
+  close STAT; 
+  updatehdddata ("hdf");
+  updatehddgraph ("hdf","day");
+  updatehddgraph ("hdf","week");
+  updatehddgraph ("hdf","month");
+  updatehddgraph ("hdf","year");
+} else {
+  if (-e "$graphs/hddtemp-hdf-day.png") {
+     system("rm $graphs/hddtemp-hdf-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdg") {
+  close STAT; 
+  updatehdddata ("hdg");
+  updatehddgraph ("hdg","day");
+  updatehddgraph ("hdg","week");
+  updatehddgraph ("hdg","month");
+  updatehddgraph ("hdg","year");
+} else {
+  if (-e "$graphs/hddtemp-hdg-day.png") {
+     system("rm $graphs/hddtemp-hdg-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdh") {
+  close STAT; 
+  updatehdddata ("hdh");
+  updatehddgraph ("hdh","day");
+  updatehddgraph ("hdh","week");
+  updatehddgraph ("hdh","month");
+  updatehddgraph ("hdh","year");
+} else {
+  if (-e "$graphs/hddtemp-hdh-day.png") {
+     system("rm $graphs/hddtemp-hdh-day.png");
+  }
+}
 
 updatembmondata();
 
@@ -1270,6 +1387,6 @@ if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ && -e "$rrdlog/BLUE.rrd") {
        updateifgraph ("BLUE", "year");
 }
 
-system("chmod -R 0777 /home/httpd/html/graphs");
-system("chmod -R 0777 /home/httpd/html/sgraph");
+system("chmod -R 0777 /srv/web/ipfire/html/graphs");
+system("chmod -R 0777 /srv/web/ipfire/html/sgraph");