]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/graphs.cgi
Source-Links gefixt.
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / graphs.cgi
index f19e5a618e4cc8cdf15a38badcb49c24df00a1b3..708387cf774bc540eedb3c850adfb90c97476cea 100644 (file)
@@ -15,7 +15,7 @@ use strict;
 #use warnings;
 #use CGI::Carp 'fatalsToBrowser';
 
-require 'CONFIG_ROOT/general-functions.pl';
+require '/var/ipfire/general-functions.pl';
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
@@ -28,7 +28,7 @@ my $iface='';
 
 &Header::showhttpheaders();
 
-my $graphdir = "/home/httpd/html/graphs";
+my $graphdir = "/srv/web/ipfire/html/graphs";
 &General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
 
 $ENV{'QUERY_STRING'} =~ s/&//g;
@@ -40,9 +40,28 @@ if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED|lq)/) {
 } else {
        &Header::openpage($Lang::tr{'system graphs'}, 1, '');
 }
+
+sub diskbox {
+ my $disk = $_[0];
+    if (-e "$graphdir/disk-$disk-day.png") {
+  
+         &Header::openbox('100%', 'center', "Disk /dev/$disk $Lang::tr{'graph'}");
+         my $ftime = localtime((stat("$graphdir/disk-$disk-day.png"))[9]);
+         print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+         print "<a href='/cgi-bin/graphs.cgi?graph=disk-$disk'>";
+         print "<img alt='' src='/graphs/disk-$disk-day.png' border='0' />";
+         print "</a>";
+         print "<br />\n";
+         if (-e "/usr/local/bin/hddshutdown-state") {
+           system("/usr/local/bin/hddshutdown-state $disk");
+         }     
+        &Header::closebox();
+  }
+}
+
 &Header::openbigbox('100%', 'left');
 
-if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
+if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk|load)/) {
        my $graph = $cgigraphs[1];
        my $graphname = ucfirst(lc($cgigraphs[1]));
        &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
@@ -51,10 +70,10 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
                my $ftime = localtime((stat("$graphdir/${graph}-day.png"))[9]);
                print "<center>";
                print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";
-               print "<img src='/graphs/${graph}-day.png' border='0' /><hr />";
-               print "<img src='/graphs/${graph}-week.png' border='0' /><hr />";
-               print "<img src='/graphs/${graph}-month.png' border='0' /><hr />";
-               print "<img src='/graphs/${graph}-year.png' border='0' />";
+               print "<img alt='' src='/graphs/${graph}-day.png' border='0' /><hr />";
+               print "<img alt='' src='/graphs/${graph}-week.png' border='0' /><hr />";
+               print "<img alt='' src='/graphs/${graph}-month.png' border='0' /><hr />";
+               print "<img alt='' src='/graphs/${graph}-year.png' border='0' />";
        } else {
                print $Lang::tr{'no information available'};
        }
@@ -83,7 +102,7 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
                        my $ftime = localtime((stat("$graphdir/${graphname}-day.png"))[9]);
                        print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
                        print "<a href='/cgi-bin/graphs.cgi?graph=$graphname'>";
-                       print "<img src='/graphs/${graphname}-day.png' border='0' />";
+                       print "<img alt='' src='/graphs/${graphname}-day.png' border='0' />";
                        print "</a>";
                } else {
                        print $Lang::tr{'no information available'};
@@ -97,7 +116,20 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
                my $ftime = localtime((stat("$graphdir/cpu-day.png"))[9]);
                print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
                print "<a href='/cgi-bin/graphs.cgi?graph=cpu'>";
-               print "<img src='/graphs/cpu-day.png' border='0' />";
+               print "<img alt='' src='/graphs/cpu-day.png' border='0' />";
+               print "</a>";
+       } else {
+               print $Lang::tr{'no information available'};
+       }
+       print "<br />\n";
+       &Header::closebox();
+
+       &Header::openbox('100%', 'center', "Load $Lang::tr{'graph'}");
+       if (-e "$graphdir/load-day.png") {
+               my $ftime = localtime((stat("$graphdir/load-day.png"))[9]);
+               print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+               print "<a href='/cgi-bin/graphs.cgi?graph=load'>";
+               print "<img alt='' src='/graphs/load-day.png' border='0' />";
                print "</a>";
        } else {
                print $Lang::tr{'no information available'};
@@ -110,7 +142,7 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
                my $ftime = localtime((stat("$graphdir/memory-day.png"))[9]);
                print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
                print "<a href='/cgi-bin/graphs.cgi?graph=memory'>";
-               print "<img src='/graphs/memory-day.png' border='0' />";
+               print "<img alt='' src='/graphs/memory-day.png' border='0' />";
                print "</a>";
        } else {
                print $Lang::tr{'no information available'};
@@ -123,7 +155,7 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
                my $ftime = localtime((stat("$graphdir/swap-day.png"))[9]);
                print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
                print "<a href='/cgi-bin/graphs.cgi?graph=swap'>";
-               print "<img src='/graphs/swap-day.png' border='0' />";
+               print "<img alt='' src='/graphs/swap-day.png' border='0' />";
                print "</a>";
        } else {
                print $Lang::tr{'no information available'};
@@ -136,13 +168,22 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
                my $ftime = localtime((stat("$graphdir/disk-day.png"))[9]);
                print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
                print "<a href='/cgi-bin/graphs.cgi?graph=disk'>";
-               print "<img src='/graphs/disk-day.png' border='0' />";
+               print "<img alt='' src='/graphs/disk-day.png' border='0' />";
                print "</a>";
        } else {
                print $Lang::tr{'no information available'};
        }
        print "<br />\n";
        &Header::closebox();
+
+    diskbox("hda");
+    diskbox("hdb");
+    diskbox("hdc");
+    diskbox("hdd");
+    diskbox("hde");
+    diskbox("hdf");
+    diskbox("hdg");
+    diskbox("hdh");
 }
 
 &Header::closebigbox();