]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
Ueberarbeitung der Status-Seiten.
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 26 Apr 2007 08:12:20 +0000 (08:12 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Thu, 26 Apr 2007 08:12:20 +0000 (08:12 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@503 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/menu/20-status.menu
config/rootfiles/common/apache2
html/cgi-bin/graphs.cgi
html/cgi-bin/media.cgi [new file with mode: 0644]
html/cgi-bin/memory.cgi [new file with mode: 0644]
html/cgi-bin/netstatus.cgi [deleted file]
html/cgi-bin/network.cgi [new file with mode: 0644]
html/cgi-bin/status.cgi [deleted file]
html/cgi-bin/system.cgi [new file with mode: 0644]
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl

index 19f1c925eb8e38b555f7300bc4a16a7fbec7398c..37cd984af821965ebd51a19d64bc563f32c8e975 100644 (file)
@@ -1,54 +1,66 @@
     $substatus->{'10.systemstatus'} = {
-                                'caption' => $Lang::tr{'status'},
-                                'uri' => '/cgi-bin/status.cgi',
-                                'title' => "$Lang::tr{'status'}",
+                                'caption' => $Lang::tr{'system'},
+                                'uri' => '/cgi-bin/system.cgi',
+                                'title' => "$Lang::tr{'system'}",
                                 'enabled' => 1,
                                 };
-    $substatus->{'20.systemgraphs'} = {
-                               'caption' => $Lang::tr{'system graphs'},
-                               'uri' => '/cgi-bin/graphs.cgi',
-                               'novars' => 1,
-                               'title' => "$Lang::tr{'system graphs'}",
+    $substatus->{'20.memory'} = {
+                               'caption' => $Lang::tr{'memory'},
+                               'uri' => '/cgi-bin/memory.cgi',
+                               'title' => "$Lang::tr{'memory'}",
                                'enabled' => 1,
                                };
-    $substatus->{'30.trafficgraphs'} = {
-                               'caption' => $Lang::tr{'sstraffic graphs'},
-                               'uri' => '/cgi-bin/graphs.cgi',
-                               'vars' => 'graph=network',
-                               'title' => "$Lang::tr{'sstraffic graphs'}",
+    $substatus->{'30.media'} = {
+                               'caption' => $Lang::tr{'media'},
+                               'uri' => '/cgi-bin/media.cgi',
+                               'title' => "$Lang::tr{'media'}",
                                'enabled' => 1,
                                };
-    $substatus->{'40.proxygraphs'} = {
+    $substatus->{'40.networkred'} = {
+                               'caption' => "$Lang::tr{'network red'}",
+                               'uri' => '/cgi-bin/network.cgi',
+                               'vars' => 'network=red',
+                               'title' => "$Lang::tr{'network red'}",
+                               'enabled' => 1,
+                         };
+    $substatus->{'41.networkother'} = {
+                               'caption' => "$Lang::tr{'network other'}",
+                               'uri' => '/cgi-bin/network.cgi',
+                               'vars' => 'network=other',
+                               'title' => "$Lang::tr{'network other'}",
+                               'enabled' => 1,
+                         };
+               $substatus->{'50.proxygraphs'} = {
                                'caption' => $Lang::tr{'ssproxy graphs'},
                                'uri' => '/cgi-bin/proxygraphs.cgi',
                                'title' => "$Lang::tr{'ssproxy graphs'}",
                                'enabled' => 1,
                                };
-    $substatus->{'50.fwhits'} = {
-                               'caption' => 'Firewall-Diagramme',
-                               'uri' => '/cgi-bin/fwhits.cgi',
-                               'title' => "Firewall-Diagramme",
-                               'enabled' => 1,
-                               };
     $substatus->{'60.hardwaregraphs'} = {
                                'caption' => "$Lang::tr{'hardware graphs'}",
                                'uri' => '/cgi-bin/hardwaregraphs.cgi',
                                'title' => "$Lang::tr{'hardware graphs'}",
                                'enabled' => 1,
                          };
-    $substatus->{'70.connections'} = {
+               $substatus->{'70.fwhits'} = {
+                               'caption' => "$Lang::tr{'firewall graphs'}",
+                               'uri' => '/cgi-bin/fwhits.cgi',
+                               'title' => "$Lang::tr{'firewall graphs'}",
+                               'enabled' => 1,
+                               };
+    $substatus->{'71.connections'} = {
                                'caption' => $Lang::tr{'connections'},
                                'uri' => '/cgi-bin/connections.cgi',
                                'title' => "$Lang::tr{'connections'}",
                                'enabled' => 1,
                                };
-    $substatus->{'80.nettraf'} = {
+    $substatus->{'72.nettraf'} = {
                                'caption' => $Lang::tr{'sstraffic'},
                                'uri' => '/cgi-bin/traffic.cgi',
                                'title' => "$Lang::tr{'sstraffic'}",
                                'enabled' => 1,
                          };
-    $substatus->{'90.iptable'} = {
+    $substatus->{'73.iptables'} = {
                                'caption' => $Lang::tr{'iptable rules'},
                                'uri' => '/cgi-bin/iptables.cgi',
                                'title' => "$Lang::tr{'iptable rules'}",
index de77998b0f02cd221a1f7723d84a4f020846f731..9ca53eb7ca74c1a4af81754cb2f5c93f6d1a48a9 100644 (file)
@@ -1297,9 +1297,11 @@ srv/web/ipfire/cgi-bin/logs.cgi
 #srv/web/ipfire/cgi-bin/logs.cgi/showrequestfromport.dat
 #srv/web/ipfire/cgi-bin/logs.cgi/summary.dat
 #srv/web/ipfire/cgi-bin/logs.cgi/urlfilter.dat
+srv/web/ipfire/cgi-bin/media.cgi
+srv/web/ipfire/cgi-bin/memory.cgi
 srv/web/ipfire/cgi-bin/modem.cgi
 srv/web/ipfire/cgi-bin/netconfig.cgi
-srv/web/ipfire/cgi-bin/netstatus.cgi
+srv/web/ipfire/cgi-bin/network.cgi
 srv/web/ipfire/cgi-bin/networks.cgi
 srv/web/ipfire/cgi-bin/optionsfw.cgi
 srv/web/ipfire/cgi-bin/outgoingfw.cgi
@@ -1316,7 +1318,7 @@ srv/web/ipfire/cgi-bin/samba.cgi
 srv/web/ipfire/cgi-bin/services.cgi
 srv/web/ipfire/cgi-bin/shaping.cgi
 srv/web/ipfire/cgi-bin/shutdown.cgi
-srv/web/ipfire/cgi-bin/status.cgi
+srv/web/ipfire/cgi-bin/system.cgi
 srv/web/ipfire/cgi-bin/time.cgi
 srv/web/ipfire/cgi-bin/traffic.cgi
 srv/web/ipfire/cgi-bin/traffics.cgi
index 708387cf774bc540eedb3c850adfb90c97476cea..82357e729ec93b47c0c049449a3d000e172daed3 100644 (file)
@@ -6,7 +6,6 @@
 #
 # (c) The SmoothWall Team
 #
-# $Id: graphs.cgi,v 1.9.2.6 2005/02/22 22:21:55 gespinasse Exp $
 #
 
 use strict;
@@ -41,24 +40,6 @@ if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED|lq)/) {
        &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|load)/) {
@@ -78,14 +59,6 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk|load)/) {
                print $Lang::tr{'no information available'};
        }
        &Header::closebox();
-       print "<div align='center'><table width='80%'><tr><td align='center'>";
-       if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq)/) {
-               print "<a href='/cgi-bin/graphs.cgi?graph=network'>";
-       } else {
-               print "<a href='/cgi-bin/graphs.cgi'>";
-       }
-       print "$Lang::tr{'back'}</a></td></tr></table></div>\n";
-       ;
 } elsif ($cgigraphs[1] =~ /network/) {
        push (@graphs, ('GREEN'));
        if ($netsettings{'BLUE_DEV'}) {
@@ -110,80 +83,6 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk|load)/) {
                print "<br />\n";
                &Header::closebox();
        }
-} else {
-       &Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");
-       if (-e "$graphdir/cpu-day.png") {
-               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 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'};
-       }
-       print "<br />\n";
-       &Header::closebox();
-
-       &Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}");
-       if (-e "$graphdir/memory-day.png") {
-               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 alt='' src='/graphs/memory-day.png' border='0' />";
-               print "</a>";
-       } else {
-               print $Lang::tr{'no information available'};
-       }
-       print "<br />\n";
-       &Header::closebox();
-
-       &Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}");
-       if (-e "$graphdir/swap-day.png") {
-               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 alt='' src='/graphs/swap-day.png' border='0' />";
-               print "</a>";
-       } else {
-               print $Lang::tr{'no information available'};
-       }
-       print "<br />\n";
-       &Header::closebox();
-
-       &Header::openbox('100%', 'center', "Disk $Lang::tr{'graph'}");
-       if (-e "$graphdir/disk-day.png") {
-               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 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();
diff --git a/html/cgi-bin/media.cgi b/html/cgi-bin/media.cgi
new file mode 100644 (file)
index 0000000..0070151
--- /dev/null
@@ -0,0 +1,211 @@
+#!/usr/bin/perl
+#
+# SmoothWall CGIs
+#
+# This code is distributed under the terms of the GPL
+#
+# (c) The SmoothWall Team
+#
+#
+
+use strict;
+
+# enable only the following on debugging purpose
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+#workaround to suppress a warning when a variable is used only once
+my @dummy = ( ${Header::colourred} );
+undef (@dummy);
+
+my %cgiparams=();
+
+&Header::showhttpheaders();
+
+&Header::getcgihash(\%cgiparams);
+
+&Header::openpage($Lang::tr{'media information'}, 1, '');
+
+&Header::openbigbox('100%', 'left');
+
+&Header::openbox('100%', 'center', "Disk $Lang::tr{'graph'}");
+if (-e "$Header::graphdir/disk-day.png") {
+       my $ftime = localtime((stat("$Header::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 alt='' src='/graphs/disk-day.png' border='0' />";
+       print "</a>";
+} else {
+       print $Lang::tr{'no information available'};
+}
+print "<br />\n";
+&Header::closebox();
+
+my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
+
+foreach (@devices) {
+       my $device = $_;
+       chomp($device);
+       diskbox("$device");
+}
+
+&Header::openbox('100%', 'center', $Lang::tr{'disk usage'});
+print "<table width='95%' cellspacing='5'>\n";
+open(DF,'/bin/df -B M -x rootfs|');
+while(<DF>)
+{
+        if ($_ =~ m/^Filesystem/ )
+        {
+                print <<END
+<tr>
+<td align='center' class='boldbase'><b>$Lang::tr{'device'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'mounted on'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'size'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'used'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'free'}</b></td>
+<td align='left' class='boldbase' colspan='2'><b>$Lang::tr{'percentage'}</b></td>
+</tr>
+END
+;
+        }
+        else
+        {
+                my ($device,$size,$used,$free,$percent,$mount) = split;
+                print <<END
+<tr>
+<td align='center'>$device</td>
+<td align='center'>$mount</td>
+<td align='center'>$size</td>
+<td align='center'>$used</td>
+<td align='center'>$free</td>
+<td align='left'>
+END
+;
+                &percentbar($percent);
+                print <<END
+</td>
+<td align='left'>$percent</td>
+</tr>
+END
+;
+        }
+}
+close DF;
+print "<tr><td colspan='7'>&nbsp;\n<tr><td colspan='7'><h3>Inodes</h3>\n";
+
+open(DF,'/bin/df -i -x rootfs|');
+while(<DF>)
+{
+   if ($_ =~ m/^Filesystem/ )
+   {
+      print <<END
+<tr>
+<td align='center' class='boldbase'><b>$Lang::tr{'device'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'mounted on'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'size'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'used'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'free'}</b></td>
+<td align='left' class='boldbase' colspan='2'><b>$Lang::tr{'percentage'}</b></td>
+</tr>
+END
+;
+   }
+   else
+   {
+      my ($device,$size,$used,$free,$percent,$mount) = split;
+      print <<END
+<tr>
+<td align='center'>$device</td>
+<td align='center'>$mount</td>
+<td align='center'>$size</td>
+<td align='center'>$used</td>
+<td align='center'>$free</td>
+<td>
+END
+;
+      &percentbar($percent);
+      print <<END
+</td>
+<td align='left'>$percent</td>
+</tr>
+END
+;
+   }
+}
+close DF;
+my @iostat1 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$1}');
+my @iostat2 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$5}');
+my @iostat3 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$6}');
+print "<tr><td colspan='3'>&nbsp;\n<tr><td colspan='3'><h3>transfers</h3></td></tr>";
+my $i=0;
+
+for(my $i = 1; $i <= $#iostat1; $i++)
+{
+if ( $i eq '1' ){print "<tr><td align='center' class='boldbase'><b>Device</b></td><td align='center' class='boldbase'><b>MB read</b></td><td align='center' class='boldbase'><b>MB writen</b></td></tr>";}
+else {print "<tr><td align='center'>@iostat1[$i]</td><td align='center'>@iostat2[$i]</td><td align='center'>@iostat3[$i]</td></tr>";}
+}
+print "</table>\n";
+&Header::closebox();
+
+&Header::closebigbox();
+
+&Header::closepage();
+
+sub percentbar
+{
+  my $percent = $_[0];
+  my $fg = '#a0a0a0';
+  my $bg = '#e2e2e2';
+
+  if ($percent =~ m/^(\d+)%$/ )
+  {
+    print <<END
+<table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
+<tr>
+END
+;
+    if ($percent eq "100%") {
+      print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
+    } elsif ($percent eq "0%") {
+      print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
+    } else {
+      print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
+    }
+    print <<END
+<img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
+END
+;
+  }
+}
+
+sub diskbox {
+ my $disk = $_[0];
+    if (-e "$Header::graphdir/disk-$disk-day.png") {
+                 &Header::openbox('100%', 'center', "Disk /dev/$disk $Lang::tr{'graph'}");
+                 my $ftime = localtime((stat("$Header::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");
+                 }
+                 my $smart = `smartctrl $disk`;
+                       $smart = &Header::cleanhtml($smart);
+                       print <<END
+                               <br /><input type="button" onClick="swapVisibility('smart_$disk')" value="$Lang::tr{'smart information'}" />
+                               <div id='smart_$disk' style='display: none'>
+                                       <hr /><table border=0><tr><td align=left><pre>$smart</pre></table>
+                               </div>
+END
+;
+      &Header::closebox();
+               }
+
+  
+}
diff --git a/html/cgi-bin/memory.cgi b/html/cgi-bin/memory.cgi
new file mode 100644 (file)
index 0000000..07f7b43
--- /dev/null
@@ -0,0 +1,166 @@
+#!/usr/bin/perl
+#
+# SmoothWall CGIs
+#
+# This code is distributed under the terms of the GPL
+#
+# (c) The SmoothWall Team
+#
+#
+
+use strict;
+
+# enable only the following on debugging purpose
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+my %cgiparams=();
+
+&Header::showhttpheaders();
+
+&Header::getcgihash(\%cgiparams);
+
+&Header::openpage($Lang::tr{'memory information'}, 1, '');
+
+&Header::openbigbox('100%', 'left');
+
+&Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}");
+if (-e "$Header::graphdir/memory-day.png") {
+       my $ftime = localtime((stat("$Header::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 alt='' src='/graphs/memory-day.png' border='0' />";
+       print "</a>";
+} else {
+       print $Lang::tr{'no information available'};
+}
+print "<br />\n";
+&Header::closebox();
+
+&Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}");
+if (-e "$Header::graphdir/swap-day.png") {
+       my $ftime = localtime((stat("$Header::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 alt='' src='/graphs/swap-day.png' border='0' />";
+       print "</a>";
+} else {
+       print $Lang::tr{'no information available'};
+}
+print "<br />\n";
+&Header::closebox();
+
+&Header::openbox('100%', 'center', $Lang::tr{'memory'});
+print "<table width='95%' cellspacing='5'>";
+my $ram=0;
+my $size=0;
+my $used=0;
+my $free=0;
+my $percent=0;
+my $shared=0;
+my $buffers=0;
+my $cached=0;
+open(FREE,'/usr/bin/free |');
+while(<FREE>)
+{
+        if ($_ =~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cached$/ )
+        {
+    print <<END
+<tr>
+<td align='center'>&nbsp;</td>
+<td align='center' class='boldbase'><b>$Lang::tr{'size'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'used'}</b></td>
+<td align='center' class='boldbase'><b>$Lang::tr{'free'}</b></td>
+<td align='left' class='boldbase' colspan='2'><b>$Lang::tr{'percentage'}</b></td>
+</tr>
+END
+;
+  } else {
+    if ($_ =~ m/^Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/) {
+      ($ram,$size,$used,$free,$shared,$buffers,$cached) = ($1,$1,$2,$3,$4,$5,$6);
+      ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
+      print <<END
+<tr>
+<td class='boldbase'><b>$Lang::tr{'ram'}</b></td>
+<td align='center'>$size</td>
+END
+;
+    } elsif ($_ =~ m/^Swap:\s+(\d+)\s+(\d+)\s+(\d+)$/) {
+      ($size,$used,$free) = ($1,$2,$3);
+      if ($size != 0)
+      {
+        ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
+      } else {
+        ($percent = '');
+      }
+      print <<END
+<tr>
+<td class='boldbase'><b>$Lang::tr{'swap'}</b></td>
+<td align='center'>$size</td>
+END
+;
+    } elsif ($ram and $_ =~ m/^-\/\+ buffers\/cache:\s+(\d+)\s+(\d+)$/ ) {
+      ($used,$free) = ($1,$2);
+      ($percent = ($used/$ram)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
+      print "<tr><td colspan='2' class='boldbase'><b>$Lang::tr{'excluding buffers and cache'}</b></td>"
+    }
+    print <<END
+<td align='center'>$used</td>
+<td align='center'>$free</td>
+<td>
+END
+;
+    &percentbar($percent);
+    print <<END
+</td>
+<td align='left'>$percent</td>
+</tr>
+END
+;
+  }
+}
+close FREE;
+print <<END
+<tr><td class='boldbase' colspan='2'><br /></td></tr>
+<tr><td class='boldbase'><b>$Lang::tr{'shared'}</b></td><td align='center'>$shared</td></tr>
+<tr><td class='boldbase'><b>$Lang::tr{'buffers'}</b></td><td align='center'>$buffers</td></tr>
+<tr><td class='boldbase'><b>$Lang::tr{'cached'}</b></td><td align='center'>$cached</td></tr>
+</table>
+END
+;
+&Header::closebox();
+
+&Header::closebigbox();
+
+&Header::closepage();
+
+sub percentbar
+{
+  my $percent = $_[0];
+  my $fg = '#a0a0a0';
+  my $bg = '#e2e2e2';
+
+  if ($percent =~ m/^(\d+)%$/ )
+  {
+    print <<END
+<table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
+<tr>
+END
+;
+    if ($percent eq "100%") {
+      print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
+    } elsif ($percent eq "0%") {
+      print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
+    } else {
+      print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
+    }
+    print <<END
+<img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
+END
+;
+  }
+}
diff --git a/html/cgi-bin/netstatus.cgi b/html/cgi-bin/netstatus.cgi
deleted file mode 100644 (file)
index f5aba50..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/perl
-#
-# SmoothWall CGIs
-#
-# This code is distributed under the terms of the GPL
-#
-# (c) The SmoothWall Team
-#
-
-use strict;
-
-# enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
-
-require '/var/ipfire/general-functions.pl';
-require "${General::swroot}/lang.pl";
-require "${General::swroot}/header.pl";
-
-my %dhcpsettings=();
-my %netsettings=();
-my %dhcpinfo=();
-my %pppsettings=();
-my $output='';
-
-&General::readhash("${General::swroot}/dhcp/settings", \%dhcpsettings);
-&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
-&General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
-&Header::showhttpheaders();
-&Header::openpage($Lang::tr{'network status information'}, 1, '');
-
-&Header::openbigbox('100%', 'left');
-
-&Header::openbox('100%', 'left', $Lang::tr{'interfaces'});
-$output = `/sbin/ip addr show`;
-$output = &Header::cleanhtml($output,"y");
-
-my @itfs = ('ORANGE','BLUE','GREEN');
-foreach my $itf (@itfs) {
-    my $ColorName='';
-    my $lc_itf=lc($itf);
-    my $dev = $netsettings{"${itf}_DEV"};
-    if ($dev){
-       $ColorName = "${lc_itf}"; #dereference variable name...
-       $output =~ s/$dev/<b><font color="$ColorName">$dev<\/font><\/b>/ ;
-    }
-}
-
-if (open(REDIFACE, "${General::swroot}/red/iface")) {
-    my $lc_itf='red';
-    my $reddev = <REDIFACE>;
-    close(REDIFACE);
-    chomp $reddev;
-    $output =~ s/$reddev/<b><font color='red'>${reddev}<\/font><\/b>/;
-}
-print "<pre>$output</pre>\n";
-&Header::closebox();
-
-
-if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/  && $netsettings{'RED_TYPE'} eq "DHCP") {
-
-       print "<a name='reddhcp'/>\n";
-       &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
-       if (-s "${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
-
-               &General::readhash("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \%dhcpinfo);
-
-               my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
-               my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
-
-               my $lsetme=0;
-               my $leasetime="";
-               if ($dhcpinfo{'LEASETIME'} ne "") {
-                       $lsetme=$dhcpinfo{'LEASETIME'};
-                       $lsetme=($lsetme/60);
-                       if ($lsetme > 59) {
-                               $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
-                       } else {
-                       $leasetime=$lsetme." Minute"; 
-                       }
-                       if ($lsetme > 1) {
-                               $leasetime=$leasetime."s";
-                       }
-               }
-               my $rentme=0;
-               my $rnwltime="";
-               if ($dhcpinfo{'RENEWALTIME'} ne "") {
-                       $rentme=$dhcpinfo{'RENEWALTIME'};
-                       $rentme=($rentme/60);
-                       if ($rentme > 59){
-                               $rentme=($rentme/60); $rnwltime=$rentme." Hour";
-                       } else {
-                               $rnwltime=$rentme." Minute";
-                       }
-                       if ($rentme > 1){
-                               $rnwltime=$rnwltime."s";
-                       }
-               }
-               my $maxtme=0;
-               my $maxtime="";
-               if ($dhcpinfo{'REBINDTIME'} ne "") {
-                       $maxtme=$dhcpinfo{'REBINDTIME'};
-                       $maxtme=($maxtme/60);
-                       if ($maxtme > 59){
-                               $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
-                       } else {
-                               $maxtime=$maxtme." Minute";
-                       }
-                       if ($maxtme > 1) {
-                               $maxtime=$maxtime."s";
-                       }
-               }
-
-               print "<table width='100%'>";
-               if ($dhcpinfo{'HOSTNAME'}) {
-                       print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
-               } else {
-                       print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
-               }
-               print <<END
-       <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
-       <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
-       <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
-       <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
-       <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
-       <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
-       <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
-    </table>
-END
-    ;
-       }
-       else
-       {
-               print "$Lang::tr{'no dhcp lease'}";
-       }
-       &Header::closebox();
-}
-
-if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
-
-       print "<a name='leases'/>";
-       &Header::CheckSortOrder;
-       &Header::PrintActualLeases;
-}
-
-&Header::openbox('100%', 'left', $Lang::tr{'routing table entries'});
-$output = `/sbin/ip show show`;
-$output = &Header::cleanhtml($output,"y");
-print "<pre>$output</pre>\n";
-&Header::closebox();
-
-&Header::openbox('100%', 'left', $Lang::tr{'arp table entries'});
-$output = `/sbin/ip neigh show`;
-$output = &Header::cleanhtml($output,"y");
-print "<pre>$output</pre>\n";
-&Header::closebox();
-
-&Header::closebigbox();
-
-&Header::closepage();
diff --git a/html/cgi-bin/network.cgi b/html/cgi-bin/network.cgi
new file mode 100644 (file)
index 0000000..eee47c6
--- /dev/null
@@ -0,0 +1,172 @@
+#!/usr/bin/perl
+#
+# SmoothWall CGIs
+#
+# This code is distributed under the terms of the GPL
+#
+# (c) The SmoothWall Team
+#
+#
+
+use strict;
+
+# enable only the following on debugging purpose
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+my %cgiparams=();
+my %pppsettings=();
+my %netsettings=();
+my @cgiparams=();
+my @graphs=();
+my $iface='';
+my %dhcpsettings=();
+my %dhcpinfo=();
+my $output='';
+
+&Header::showhttpheaders();
+
+&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
+
+$ENV{'QUERY_STRING'} =~ s/&//g;
+@cgiparams = split(/network=/,$ENV{'QUERY_STRING'});
+$cgiparams[1] = '' unless defined $cgiparams[1];
+
+if ($cgiparams[1] =~ /red/) {
+       &Header::openpage($Lang::tr{'network traffic graphs external'}, 1, '');
+       push (@graphs, ("RED"));
+       push (@graphs, ('lq'));
+} else {
+       &Header::openpage($Lang::tr{'network traffic graphs internal'}, 1, '');
+       push (@graphs, ('GREEN'));
+       if ($netsettings{'BLUE_DEV'}) {
+               push (@graphs, ('BLUE')); }
+       if ($netsettings{'ORANGE_DEV'}) {
+               push (@graphs, ('ORANGE')); }
+}
+
+&Header::openbigbox('100%', 'left');
+
+foreach my $graphname (@graphs) {
+
+       &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
+       if (-e "$Header::graphdir/${graphname}-day.png") {
+               my $ftime = localtime((stat("$Header::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 alt='' src='/graphs/${graphname}-day.png' border='0' />";
+               print "</a>";
+       } else {
+               print $Lang::tr{'no information available'};
+       }
+       print "<br />\n";
+       &Header::closebox();
+}
+
+if ($cgiparams[1] =~ /red/) {
+       
+       if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/  && $netsettings{'RED_TYPE'} eq "DHCP") {
+
+               &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
+               if (-s "${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
+
+                       &General::readhash("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \%dhcpinfo);
+
+                       my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
+                       my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
+
+                       my $lsetme=0;
+                       my $leasetime="";
+                       if ($dhcpinfo{'LEASETIME'} ne "") {
+                               $lsetme=$dhcpinfo{'LEASETIME'};
+                               $lsetme=($lsetme/60);
+                               if ($lsetme > 59) {
+                                       $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
+                               } else {
+                               $leasetime=$lsetme." Minute";
+                               }
+                               if ($lsetme > 1) {
+                                       $leasetime=$leasetime."s";
+                               }
+                       }
+                       my $rentme=0;
+                       my $rnwltime="";
+                       if ($dhcpinfo{'RENEWALTIME'} ne "") {
+                               $rentme=$dhcpinfo{'RENEWALTIME'};
+                               $rentme=($rentme/60);
+                               if ($rentme > 59){
+                                       $rentme=($rentme/60); $rnwltime=$rentme." Hour";
+                               } else {
+                                       $rnwltime=$rentme." Minute";
+                               }
+                               if ($rentme > 1){
+                                       $rnwltime=$rnwltime."s";
+                               }
+                       }
+                       my $maxtme=0;
+                       my $maxtime="";
+                       if ($dhcpinfo{'REBINDTIME'} ne "") {
+                               $maxtme=$dhcpinfo{'REBINDTIME'};
+                               $maxtme=($maxtme/60);
+                               if ($maxtme > 59){
+                                       $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
+                               } else {
+                                       $maxtime=$maxtme." Minute";
+                               }
+                               if ($maxtme > 1) {
+                                       $maxtime=$maxtime."s";
+                               }
+                       }
+
+                       print "<table width='100%'>";
+                       if ($dhcpinfo{'HOSTNAME'}) {
+                               print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
+                       } else {
+                               print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
+                       }
+                       print <<END
+               <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
+               <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
+               <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
+               <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
+               <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
+               <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
+               <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
+           </table>
+END
+           ;
+               }
+               else
+               {
+                       print "$Lang::tr{'no dhcp lease'}";
+               }
+               &Header::closebox();
+       }
+
+       if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
+               &Header::CheckSortOrder;
+               &Header::PrintActualLeases;
+       }
+       
+} else {
+
+       &Header::openbox('100%', 'left', $Lang::tr{'routing table entries'});
+       $output = `/sbin/ip route show`;
+       $output = &Header::cleanhtml($output,"y");
+       print "<pre>$output</pre>\n";
+       &Header::closebox();
+       
+       &Header::openbox('100%', 'left', $Lang::tr{'arp table entries'});
+       $output = `/sbin/ip neigh show`;
+       $output = &Header::cleanhtml($output,"y");
+       print "<pre>$output</pre>\n";
+       &Header::closebox();
+       
+}
+
+&Header::closebigbox();
+&Header::closepage();
diff --git a/html/cgi-bin/status.cgi b/html/cgi-bin/status.cgi
deleted file mode 100644 (file)
index a61ccf8..0000000
+++ /dev/null
@@ -1,496 +0,0 @@
-#!/usr/bin/perl
-#
-# SmoothWall CGIs
-#
-# This code is distributed under the terms of the GPL
-#
-# (c) The SmoothWall Team
-#
-#
-
-use strict;
-
-# enable only the following on debugging purpose
-use warnings;
-use CGI::Carp 'fatalsToBrowser';
-
-require '/var/ipfire/general-functions.pl';
-require "${General::swroot}/lang.pl";
-require "${General::swroot}/header.pl";
-
-#workaround to suppress a warning when a variable is used only once
-my @dummy = ( ${Header::colourred} );
-undef (@dummy);
-
-my %netsettings=();
-&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
-
-my %cgiparams=();
-# Maps a nice printable name to the changing part of the pid file, which
-# is also the name of the program
-my %servicenames =
-(
-        $Lang::tr{'dhcp server'} => 'dhcpd',
-        $Lang::tr{'web server'} => 'httpd',
-        $Lang::tr{'cron server'} => 'fcron',
-        $Lang::tr{'dns proxy server'} => 'dnsmasq',
-        $Lang::tr{'logging server'} => 'syslogd',
-        $Lang::tr{'kernel logging server'} => 'klogd',
-        $Lang::tr{'ntp server'} => 'ntpd',
-        $Lang::tr{'secure shell server'} => 'sshd',
-        $Lang::tr{'vpn'} => 'pluto',
-        $Lang::tr{'web proxy'} => 'squid',
-        'OpenVPN' => 'openvpn'
-);
-
-my $iface = '';
-if (open(FILE, "${General::swroot}/red/iface"))
-{
-        $iface = <FILE>;
-        close FILE;
-        chomp $iface;
-}
-$servicenames{"$Lang::tr{'intrusion detection system'} (RED)"}   = "snort_${iface}";
-$servicenames{"$Lang::tr{'intrusion detection system'} (GREEN)"} = "snort_$netsettings{'GREEN_DEV'}";
-if ($netsettings{'ORANGE_DEV'} ne '') {
-        $servicenames{"$Lang::tr{'intrusion detection system'} (ORANGE)"} = "snort_$netsettings{'ORANGE_DEV'}";
-}
-if ($netsettings{'BLUE_DEV'} ne '') {
-        $servicenames{"$Lang::tr{'intrusion detection system'} (BLUE)"} = "snort_$netsettings{'BLUE_DEV'}";
-}
-
-my %dhcpsettings=();
-my %netsettings=();
-my %dhcpinfo=();
-my %pppsettings=();
-my $output='';
-
-&General::readhash("${General::swroot}/dhcp/settings", \%dhcpsettings);
-&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
-&General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
-
-&Header::showhttpheaders();
-
-&Header::getcgihash(\%cgiparams);
-
-&Header::openpage($Lang::tr{'status information'}, 1, '');
-
-&Header::openbigbox('100%', 'left');
-
-&Header::openbox('100%', 'left', $Lang::tr{'services'});
-
-print <<END
-<div align='center'>
-<table width='60%' cellspacing='0' border='0'>
-END
-;
-
-my $lines = 0;
-my $key = '';
-foreach $key (sort keys %servicenames)
-{
-        if ($lines % 2) {
-                print "<tr bgcolor='${Header::table1colour}'>\n"; }
-        else {
-                print "<tr bgcolor='${Header::table2colour}'>\n"; }
-        print "<td align='left'>$key</td>\n";
-        my $shortname = $servicenames{$key};
-        my $status = &isrunning($shortname);
-        print "$status\n";
-        print "</tr>\n";
-        $lines++;
-}
-
-
-print "</table></div>\n";
-
-&Header::closebox();
-
-&Header::openbox('100%', 'center', $Lang::tr{'memory'});
-print "<table width='95%' cellspacing='5'>";
-my $ram=0;
-my $size=0;
-my $used=0;
-my $free=0;
-my $percent=0;
-my $shared=0;
-my $buffers=0;
-my $cached=0;
-open(FREE,'/usr/bin/free |');
-while(<FREE>)
-{
-        if ($_ =~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cached$/ )
-        {
-    print <<END
-<tr>
-<td align='center'>&nbsp;</td>
-<td align='center' class='boldbase'><b>$Lang::tr{'size'}</b></td>
-<td align='center' class='boldbase'><b>$Lang::tr{'used'}</b></td>
-<td align='center' class='boldbase'><b>$Lang::tr{'free'}</b></td>
-<td align='left' class='boldbase' colspan='2'><b>$Lang::tr{'percentage'}</b></td>
-</tr>
-END
-;
-  } else {
-    if ($_ =~ m/^Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/) {
-      ($ram,$size,$used,$free,$shared,$buffers,$cached) = ($1,$1,$2,$3,$4,$5,$6);
-      ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
-      print <<END
-<tr>
-<td class='boldbase'><b>$Lang::tr{'ram'}</b></td>
-<td align='right'>$size</td>
-END
-;
-    } elsif ($_ =~ m/^Swap:\s+(\d+)\s+(\d+)\s+(\d+)$/) {
-      ($size,$used,$free) = ($1,$2,$3);
-      if ($size != 0)
-      {
-        ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
-      } else {
-        ($percent = '');
-      }
-      print <<END
-<tr>
-<td class='boldbase'><b>$Lang::tr{'swap'}</b></td>
-<td align='right'>$size</td>
-END
-;
-    } elsif ($ram and $_ =~ m/^-\/\+ buffers\/cache:\s+(\d+)\s+(\d+)$/ ) {
-      ($used,$free) = ($1,$2);
-      ($percent = ($used/$ram)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
-      print "<tr><td colspan='2' class='boldbase'><b>$Lang::tr{'excluding buffers and cache'}</b></td>"
-    }
-    print <<END
-<td align='right'>$used</td>
-<td align='right'>$free</td>
-<td>
-END
-;
-    &percentbar($percent);
-    print <<END
-</td>
-<td align='right'>$percent</td>
-</tr>
-END
-;
-  }
-}
-close FREE;
-print <<END
-<tr><td class='boldbase' colspan='2'><br /></td></tr>
-<tr><td class='boldbase'><b>$Lang::tr{'shared'}</b></td><td align='right'>$shared</td></tr>
-<tr><td class='boldbase'><b>$Lang::tr{'buffers'}</b></td><td align='right'>$buffers</td></tr>
-<tr><td class='boldbase'><b>$Lang::tr{'cached'}</b></td><td align='right'>$cached</td></tr>
-</table>
-END
-;
-&Header::closebox();
-
-&Header::openbox('100%', 'center', $Lang::tr{'disk usage'});
-print "<table width='95%' cellspacing='5'>\n";
-open(DF,'/bin/df -B M -x rootfs|');
-while(<DF>)
-{
-        if ($_ =~ m/^Filesystem/ )
-        {
-                print <<END
-<tr>
-<td align='left' class='boldbase'><b>$Lang::tr{'device'}</b></td>
-<td align='left' class='boldbase'><b>$Lang::tr{'mounted on'}</b></td>
-<td align='center' class='boldbase'><b>$Lang::tr{'size'}</b></td>
-<td align='center' class='boldbase'><b>$Lang::tr{'used'}</b></td>
-<td align='center' class='boldbase'><b>$Lang::tr{'free'}</b></td>
-<td align='left' class='boldbase' colspan='2'><b>$Lang::tr{'percentage'}</b></td>
-</tr>
-END
-;
-        }
-        else
-        {
-                my ($device,$size,$used,$free,$percent,$mount) = split;
-                print <<END
-<tr>
-<td>$device</td>
-<td>$mount</td>
-<td align='right'>$size</td>
-<td align='right'>$used</td>
-<td align='right'>$free</td>
-<td>
-END
-;
-                &percentbar($percent);
-                print <<END
-</td>
-<td align='right'>$percent</td>
-</tr>
-END
-;
-        }
-}
-close DF;
-print "<tr><td colspan='7'>&nbsp;\n<tr><td colspan='7'><h3>Inodes</h3>\n";
-
-open(DF,'/bin/df -i -x rootfs|');
-while(<DF>)
-{
-   if ($_ =~ m/^Filesystem/ )
-   {
-      print <<END
-<tr>
-<td align='left' class='boldbase'><b>$Lang::tr{'device'}</b></td>
-<td align='left' class='boldbase'><b>$Lang::tr{'mounted on'}</b></td>
-<td align='center' class='boldbase'><b>$Lang::tr{'size'}</b></td>
-<td align='center' class='boldbase'><b>$Lang::tr{'used'}</b></td>
-<td align='center' class='boldbase'><b>$Lang::tr{'free'}</b></td>
-<td align='left' class='boldbase' colspan='2'><b>$Lang::tr{'percentage'}</b></td>
-</tr>
-END
-;
-   }
-   else
-   {
-      my ($device,$size,$used,$free,$percent,$mount) = split;
-      print <<END
-<tr>
-<td>$device</td>
-<td>$mount</td>
-<td align='right'>$size</td>
-<td align='right'>$used</td>
-<td align='right'>$free</td>
-<td>
-END
-;
-      &percentbar($percent);
-      print <<END
-</td>
-<td align='right'>$percent</td>
-</tr>
-END
-;
-   }
-}
-close DF;
-my $iostat = qx(/usr/bin/iostat -dm -p | grep -v "Linux");
-print "<tr><td colspan='7'>&nbsp;\n<tr><td colspan='7'><h3>transfers</h3></td></tr>\n<tr><td align='center' colspan='7'><pre>$iostat</pre></td></tr>";
-
-print "</table>\n";
-&Header::closebox();
-
-&Header::openbox('100%', 'left', $Lang::tr{'interfaces'});
-$output = `/sbin/ip link show`;
-$output = &Header::cleanhtml($output,"y");
-
-my @itfs = ('ORANGE','BLUE','GREEN');
-foreach my $itf (@itfs) {
-    my $ColorName='';
-    my $lc_itf=lc($itf);
-    my $dev = $netsettings{"${itf}_DEV"};
-    if ($dev){
-       $ColorName = "${lc_itf}"; #dereference variable name...
-       $output =~ s/$dev/<b><font color="$ColorName">$dev<\/font><\/b>/ ;
-    }
-}
-
-if (open(REDIFACE, "${General::swroot}/red/iface")) {
-    my $lc_itf='red';
-    my $reddev = <REDIFACE>;
-    close(REDIFACE);
-    chomp $reddev;
-    $output =~ s/$reddev/<b><font color='red'>${reddev}<\/font><\/b>/;
-}
-print "<pre>$output</pre>\n";
-&Header::closebox();
-
-
-if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/  && $netsettings{'RED_TYPE'} eq "DHCP") {
-
-       &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
-       if (-s "${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
-
-               &General::readhash("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \%dhcpinfo);
-
-               my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
-               my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
-
-               my $lsetme=0;
-               my $leasetime="";
-               if ($dhcpinfo{'LEASETIME'} ne "") {
-                       $lsetme=$dhcpinfo{'LEASETIME'};
-                       $lsetme=($lsetme/60);
-                       if ($lsetme > 59) {
-                               $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
-                       } else {
-                       $leasetime=$lsetme." Minute"; 
-                       }
-                       if ($lsetme > 1) {
-                               $leasetime=$leasetime."s";
-                       }
-               }
-               my $rentme=0;
-               my $rnwltime="";
-               if ($dhcpinfo{'RENEWALTIME'} ne "") {
-                       $rentme=$dhcpinfo{'RENEWALTIME'};
-                       $rentme=($rentme/60);
-                       if ($rentme > 59){
-                               $rentme=($rentme/60); $rnwltime=$rentme." Hour";
-                       } else {
-                               $rnwltime=$rentme." Minute";
-                       }
-                       if ($rentme > 1){
-                               $rnwltime=$rnwltime."s";
-                       }
-               }
-               my $maxtme=0;
-               my $maxtime="";
-               if ($dhcpinfo{'REBINDTIME'} ne "") {
-                       $maxtme=$dhcpinfo{'REBINDTIME'};
-                       $maxtme=($maxtme/60);
-                       if ($maxtme > 59){
-                               $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
-                       } else {
-                               $maxtime=$maxtme." Minute";
-                       }
-                       if ($maxtme > 1) {
-                               $maxtime=$maxtime."s";
-                       }
-               }
-
-               print "<table width='100%'>";
-               if ($dhcpinfo{'HOSTNAME'}) {
-                       print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
-               } else {
-                       print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
-               }
-               print <<END
-       <tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
-       <tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
-       <tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
-       <tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
-       <tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
-       <tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
-       <tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
-    </table>
-END
-    ;
-       }
-       else
-       {
-               print "$Lang::tr{'no dhcp lease'}";
-       }
-       &Header::closebox();
-}
-
-if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
-       &Header::CheckSortOrder;
-       &Header::PrintActualLeases;
-}
-
-&Header::openbox('100%', 'left', $Lang::tr{'routing table entries'});
-$output = `/sbin/ip route show`;
-$output = &Header::cleanhtml($output,"y");
-print "<pre>$output</pre>\n";
-&Header::closebox();
-
-&Header::openbox('100%', 'left', $Lang::tr{'arp table entries'});
-$output = `/sbin/ip neigh show`;
-$output = &Header::cleanhtml($output,"y");
-print "<pre>$output</pre>\n";
-&Header::closebox();
-
-&Header::openbox('100%', 'left', $Lang::tr{'loaded modules'});
-my $module = qx(/bin/lsmod | awk -F" " '{print \$1}');
-my $size = qx(/bin/lsmod | awk -F" " '{print \$2}');
-my $used = qx(/bin/lsmod | awk -F" " '{print \$3}');
-my @usedby = qx(/bin/lsmod | awk -F" " '{print \$4}');
-my @usedbyf;
-my $usedbyline;
-
-foreach $usedbyline(@usedby)
-{
-my $laenge = length($usedbyline);
-
-if ( $laenge > 30)
- {
- my $usedbylinef=substr($usedbyline,0,30);
- $usedbyline="$usedbylinef ...\n";
- push(@usedbyf,$usedbyline);
- }
-else
- {push(@usedbyf,$usedbyline);}
-}
-print <<END
-<table cellspacing=25><tr>
-<td><pre>$module</pre></td>
-<td><pre>$size</pre></td>
-<td><pre>$used</pre></td>
-<td><pre>@usedbyf</pre></td>
-</tr></table>
-END
-;
-
-print "";
-&Header::closebox();
-
-&Header::closebigbox();
-
-&Header::closepage();
-
-sub isrunning
-{
-        my $cmd = $_[0];
-        my $status = "<td bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
-        my $pid = '';
-        my $testcmd = '';
-        my $exename;
-
-        $cmd =~ /(^[a-z]+)/;
-        $exename = $1;
-
-        if (open(FILE, "/var/run/${cmd}.pid"))
-        {
-                $pid = <FILE>; chomp $pid;
-                close FILE;
-                if (open(FILE, "/proc/${pid}/status"))
-                {
-                        while (<FILE>)
-                        {
-                                if (/^Name:\W+(.*)/) {
-                                        $testcmd = $1; }
-                        }
-                        close FILE;
-                        if ($testcmd =~ /$exename/)
-                        {
-                                $status = "<td bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
-                        }
-                }
-        }
-
-        return $status;
-}
-
-sub percentbar
-{
-  my $percent = $_[0];
-  my $fg = '#a0a0a0';
-  my $bg = '#e2e2e2';
-
-  if ($percent =~ m/^(\d+)%$/ )
-  {
-    print <<END
-<table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
-<tr>
-END
-;
-    if ($percent eq "100%") {
-      print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
-    } elsif ($percent eq "0%") {
-      print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
-    } else {
-      print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
-    }
-    print <<END
-<img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
-END
-;
-  }
-}
diff --git a/html/cgi-bin/system.cgi b/html/cgi-bin/system.cgi
new file mode 100644 (file)
index 0000000..d556abc
--- /dev/null
@@ -0,0 +1,221 @@
+#!/usr/bin/perl
+#
+# SmoothWall CGIs
+#
+# This code is distributed under the terms of the GPL
+#
+# (c) The SmoothWall Team
+#
+#
+
+use strict;
+
+# enable only the following on debugging purpose
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+#workaround to suppress a warning when a variable is used only once
+my @dummy = ( ${Header::colourred} );
+undef (@dummy);
+
+my %netsettings=();
+&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
+
+my %cgiparams=();
+# Maps a nice printable name to the changing part of the pid file, which
+# is also the name of the program
+my %servicenames =
+(
+        $Lang::tr{'dhcp server'} => 'dhcpd',
+        $Lang::tr{'web server'} => 'httpd',
+        $Lang::tr{'cron server'} => 'fcron',
+        $Lang::tr{'dns proxy server'} => 'dnsmasq',
+        $Lang::tr{'logging server'} => 'syslogd',
+        $Lang::tr{'kernel logging server'} => 'klogd',
+        $Lang::tr{'ntp server'} => 'ntpd',
+        $Lang::tr{'secure shell server'} => 'sshd',
+        $Lang::tr{'vpn'} => 'pluto',
+        $Lang::tr{'web proxy'} => 'squid',
+        'OpenVPN' => 'openvpn'
+);
+
+my $iface = '';
+if (open(FILE, "${General::swroot}/red/iface"))
+{
+        $iface = <FILE>;
+        close FILE;
+        chomp $iface;
+}
+$servicenames{"$Lang::tr{'intrusion detection system'} (RED)"}   = "snort_${iface}";
+$servicenames{"$Lang::tr{'intrusion detection system'} (GREEN)"} = "snort_$netsettings{'GREEN_DEV'}";
+if ($netsettings{'ORANGE_DEV'} ne '') {
+        $servicenames{"$Lang::tr{'intrusion detection system'} (ORANGE)"} = "snort_$netsettings{'ORANGE_DEV'}";
+}
+if ($netsettings{'BLUE_DEV'} ne '') {
+        $servicenames{"$Lang::tr{'intrusion detection system'} (BLUE)"} = "snort_$netsettings{'BLUE_DEV'}";
+}
+
+&Header::showhttpheaders();
+
+&Header::getcgihash(\%cgiparams);
+
+&Header::openpage($Lang::tr{'status information'}, 1, '');
+
+&Header::openbigbox('100%', 'left');
+
+&Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");
+if (-e "$Header::graphdir/cpu-day.png") {
+       my $ftime = localtime((stat("$Header::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 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 "$Header::graphdir/load-day.png") {
+       my $ftime = localtime((stat("$Header::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'};
+}
+print "<br />\n";
+&Header::closebox();
+
+&Header::openbox('100%', 'left', $Lang::tr{'services'});
+
+print <<END
+<div align='center'>
+<table width='60%' cellspacing='0' border='0'>
+END
+;
+
+my $lines = 0;
+my $key = '';
+foreach $key (sort keys %servicenames)
+{
+        if ($lines % 2) {
+                print "<tr bgcolor='${Header::table1colour}'>\n"; }
+        else {
+                print "<tr bgcolor='${Header::table2colour}'>\n"; }
+        print "<td align='left'>$key</td>\n";
+        my $shortname = $servicenames{$key};
+        my $status = &isrunning($shortname);
+        print "$status\n";
+        print "</tr>\n";
+        $lines++;
+}
+
+
+print "</table></div>\n";
+
+&Header::closebox();
+
+&Header::openbox('100%', 'left', $Lang::tr{'loaded modules'});
+my $module = qx(/bin/lsmod | awk -F" " '{print \$1}');
+my $size = qx(/bin/lsmod | awk -F" " '{print \$2}');
+my $used = qx(/bin/lsmod | awk -F" " '{print \$3}');
+my @usedby = qx(/bin/lsmod | awk -F" " '{print \$4}');
+my @usedbyf;
+my $usedbyline;
+
+foreach $usedbyline(@usedby)
+{
+my $laenge = length($usedbyline);
+
+if ( $laenge > 30)
+ {
+ my $usedbylinef=substr($usedbyline,0,30);
+ $usedbyline="$usedbylinef ...\n";
+ push(@usedbyf,$usedbyline);
+ }
+else
+ {push(@usedbyf,$usedbyline);}
+}
+print <<END
+<table cellspacing=25><tr>
+<td><pre>$module</pre></td>
+<td><pre>$size</pre></td>
+<td><pre>$used</pre></td>
+<td><pre>@usedbyf</pre></td>
+</tr></table>
+END
+;
+
+print "";
+&Header::closebox();
+
+&Header::closebigbox();
+
+&Header::closepage();
+
+sub isrunning
+{
+        my $cmd = $_[0];
+        my $status = "<td bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td>";
+        my $pid = '';
+        my $testcmd = '';
+        my $exename;
+
+        $cmd =~ /(^[a-z]+)/;
+        $exename = $1;
+
+        if (open(FILE, "/var/run/${cmd}.pid"))
+        {
+                $pid = <FILE>; chomp $pid;
+                close FILE;
+                if (open(FILE, "/proc/${pid}/status"))
+                {
+                        while (<FILE>)
+                        {
+                                if (/^Name:\W+(.*)/) {
+                                        $testcmd = $1; }
+                        }
+                        close FILE;
+                        if ($testcmd =~ /$exename/)
+                        {
+                                $status = "<td bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
+                        }
+                }
+        }
+
+        return $status;
+}
+
+sub percentbar
+{
+  my $percent = $_[0];
+  my $fg = '#a0a0a0';
+  my $bg = '#e2e2e2';
+
+  if ($percent =~ m/^(\d+)%$/ )
+  {
+    print <<END
+<table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
+<tr>
+END
+;
+    if ($percent eq "100%") {
+      print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
+    } elsif ($percent eq "0%") {
+      print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
+    } else {
+      print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
+    }
+    print <<END
+<img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
+END
+;
+  }
+}
index 0eaf708c553bbbf01cb4fdcab5789661f2f10330..51c101d13a15f1e1e43a0a7cef6210ccc6528343 100644 (file)
 'mbmon value' => 'Wert',
 'mbmon volt' => 'Voltage',
 'meaning' => 'Bedeutung',
+'media' => 'Laufwerke',
+'media information' => 'Laufwerksinformationen',
 'medium' => 'Mittel',
-'memory' => 'Speicher:',
+'memory' => 'Speicher',
+'memory information' => 'Speicherinformationen',
 'memory usage per' => 'Speichernutzung pro',
 'method' => 'Methode:',
 'min size' => 'Min. Objektgröße (kB):',
 'network added' => 'Benutzerdefiniertes Netzwerk hinzugefügt',
 'network configuration' => 'Netzwerk Konfiguration',
 'network options' => 'Netzwerk Optionen',
+'network other' => 'Netzwerk (intern)',
+'network red' => 'Netzwerk (extern)',
 'network removed' => 'Benutzerdefiniertes Netzwerk entfernt',
 'network status information' => 'Netzwerk-Statusinformationen',
 'network time' => 'Benutze NTP-Server:',
 'network time from' => 'Uhrzeit von einem Netzwerk Zeitserver ermitteln',
 'network traffic graphs' => 'Diagramme zur Netzwerkauslastung',
+'network traffic graphs external' => 'Net-Traffic-Diagramme (extern)',
+'network traffic graphs internal' => 'Net-Traffic-Diagramme (intern)',
 'network updated' => 'Benutzerdefiniertes Netzwerk aktualisiert',
 'networks settings' => 'Firewall - Netzwerkeinstellungen',
 'new optionsfw later' => 'Ihre Modifikation(en) wird (werden) beim nächsten Neustart aktiv werden',
 'sitekey' => 'Sitekey',
 'sitekeyfile' => 'Sitekeyfile',
 'size' => 'Größe',
+'smart information' => 'SMART-Informationen',
 'smbreload' => 'Samba Dienste durchstarten',
 'smbstart' => 'Samba Dienste starten',
 'smbstop' => 'Samba Dienste beenden',
 'sunday' => 'Sonntag',
 'swap' => 'Swap',
 'swap usage per' => 'Nutzung von Auslagerungsspeicher (Swap) pro',
+'system' => 'System',
 'system cpu' => 'System CPU',
 'system cpu usage' => 'System CPU Nutzung',
 'system graphs' => 'System-Diagramme',
index 454ed75a014cd198328ebf22e2b705ab9168af8f..b5ed74674baf7f0c4c03fc6ee4ccbdc6a07e7052 100644 (file)
 'mbmon value' => 'Value',
 'mbmon volt' => 'Voltage',
 'meaning' => 'meaning',
+'media' => 'Media',
+'media information' => 'media information',
 'medium' => 'Medium',
-'memory' => 'Memory:',
+'memory' => 'Memory',
+'memory information' => 'memory information',
 'memory usage per' => 'Memory Usage per',
 'method' => 'Method:',
 'min size' => 'Min object size (KB):',
 'network added' => 'Custom Network added',
 'network configuration' => 'Network Configuration',
 'network options' => 'Network Options',
+'network other' => 'network (internal)',
+'network red' => 'network (external)',
 'network removed' => 'Custom Network removed',
 'network status information' => 'Network Status Information',
 'network time' => 'Use a Network Time Server:',
 'network time from' => 'Obtain time from a Network Time Server',
 'network traffic graphs' => 'Network traffic graphs',
+'network traffic graphs external' => 'Net-Traffic graphs (external)',
+'network traffic graphs internal' => 'Net-Traffic graphs (internal)',
 'network updated' => 'Custom Network updated',
 'networks settings' => 'Firewall - Network settings',
 'new optionsfw later' => 'Your modification(s) will be active on next restart',
 'sitekey' => 'Sitekey',
 'sitekeyfile' => 'Sitekeyfile',
 'size' => 'Size',
+'smart information' => 'SMART information',
 'smbreload' => 'Samba Dienste durchstarten',
 'smbstart' => 'Samba Dienste starten',
 'smbstop' => 'Samba Dienste beenden',
 'sunday' => 'Sunday',
 'swap' => 'Swap',
 'swap usage per' => 'Swap Usage per',
+'system' => 'System',
 'system cpu' => 'System CPU',
 'system cpu usage' => 'System CPU Usage',
 'system graphs' => 'System Graphs',