]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - html/cgi-bin/graphs.cgi
SMP-Config angepasst.. CGIs usw. wurden im Windoof-Format gespeichert... muss noch...
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / graphs.cgi
index 5c6f91512e28b3f151675eb6fdcb0af98ce513f4..59ba89195f390cbbfb11789d558980c50c91a82c 100644 (file)
-#!/usr/bin/perl\r
-#\r
-# SmoothWall CGIs\r
-#\r
-# This code is distributed under the terms of the GPL\r
-#\r
-# (c) The SmoothWall Team\r
-#\r
-# $Id: graphs.cgi,v 1.9.2.6 2005/02/22 22:21:55 gespinasse Exp $\r
-#\r
-\r
-use strict;\r
-\r
-# enable only the following on debugging purpose\r
-#use warnings;\r
-#use CGI::Carp 'fatalsToBrowser';\r
-\r
-require 'CONFIG_ROOT/general-functions.pl';\r
-require "${General::swroot}/lang.pl";\r
-require "${General::swroot}/header.pl";\r
-\r
-my %cgiparams=();\r
-my %pppsettings=();\r
-my %netsettings=();\r
-my @cgigraphs=();\r
-my @graphs=();\r
-my $iface='';\r
-\r
-&Header::showhttpheaders();\r
-\r
-my $graphdir = "/home/httpd/html/graphs";\r
-&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);\r
-\r
-$ENV{'QUERY_STRING'} =~ s/&//g;\r
-@cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});\r
-$cgigraphs[1] = '' unless defined $cgigraphs[1];\r
-\r
-if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED)/) {\r
-       &Header::openpage($Lang::tr{'network traffic graphs'}, 1, '');\r
-} else {\r
-       &Header::openpage($Lang::tr{'system graphs'}, 1, '');\r
-}\r
-&Header::openbigbox('100%', 'left');\r
-\r
-if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|cpu|memory|swap|disk)/) {\r
-       my $graph = $cgigraphs[1];\r
-       my $graphname = ucfirst(lc($cgigraphs[1]));\r
-       &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");\r
-\r
-       if (-e "$graphdir/${graph}-day.png") {\r
-               my $ftime = localtime((stat("$graphdir/${graph}-day.png"))[9]);\r
-               print "<center>";\r
-               print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";\r
-               print "<img src='/graphs/${graph}-day.png' border='0' /><hr />";\r
-               print "<img src='/graphs/${graph}-week.png' border='0' /><hr />";\r
-               print "<img src='/graphs/${graph}-month.png' border='0' /><hr />";\r
-               print "<img src='/graphs/${graph}-year.png' border='0' />";\r
-       } else {\r
-               print $Lang::tr{'no information available'};\r
-       }\r
-       &Header::closebox();\r
-       print "<div align='center'><table width='80%'><tr><td align='center'>";\r
-       if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED)/) {\r
-               print "<a href='/cgi-bin/graphs.cgi?graph=network'>";\r
-       } else {\r
-               print "<a href='/cgi-bin/graphs.cgi'>";\r
-       }\r
-       print "$Lang::tr{'back'}</a></td></tr></table></div>\n";\r
-       ;\r
-} elsif ($cgigraphs[1] =~ /network/) {\r
-       push (@graphs, ('GREEN'));\r
-       if ($netsettings{'BLUE_DEV'}) {\r
-               push (@graphs, ('BLUE')); }\r
-       if ($netsettings{'ORANGE_DEV'}) {\r
-               push (@graphs, ('ORANGE')); }\r
-       push (@graphs, ("RED"));\r
-\r
-       foreach my $graphname (@graphs) {\r
-               &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");\r
-\r
-               if (-e "$graphdir/${graphname}-day.png") {\r
-                       my $ftime = localtime((stat("$graphdir/${graphname}-day.png"))[9]);\r
-                       print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";\r
-                       print "<a href='/cgi-bin/graphs.cgi?graph=$graphname'>";\r
-                       print "<img src='/graphs/${graphname}-day.png' border='0' />";\r
-                       print "</a>";\r
-               } else {\r
-                       print $Lang::tr{'no information available'};\r
-               }\r
-               print "<br />\n";\r
-               &Header::closebox();\r
-       }\r
-} else {\r
-       &Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");\r
-       if (-e "$graphdir/cpu-day.png") {\r
-               my $ftime = localtime((stat("$graphdir/cpu-day.png"))[9]);\r
-               print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";\r
-               print "<a href='/cgi-bin/graphs.cgi?graph=cpu'>";\r
-               print "<img src='/graphs/cpu-day.png' border='0' />";\r
-               print "</a>";\r
-       } else {\r
-               print $Lang::tr{'no information available'};\r
-       }\r
-       print "<br />\n";\r
-       &Header::closebox();\r
-\r
-       &Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}");\r
-       if (-e "$graphdir/memory-day.png") {\r
-               my $ftime = localtime((stat("$graphdir/memory-day.png"))[9]);\r
-               print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";\r
-               print "<a href='/cgi-bin/graphs.cgi?graph=memory'>";\r
-               print "<img src='/graphs/memory-day.png' border='0' />";\r
-               print "</a>";\r
-       } else {\r
-               print $Lang::tr{'no information available'};\r
-       }\r
-       print "<br />\n";\r
-       &Header::closebox();\r
-\r
-       &Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}");\r
-       if (-e "$graphdir/swap-day.png") {\r
-               my $ftime = localtime((stat("$graphdir/swap-day.png"))[9]);\r
-               print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";\r
-               print "<a href='/cgi-bin/graphs.cgi?graph=swap'>";\r
-               print "<img src='/graphs/swap-day.png' border='0' />";\r
-               print "</a>";\r
-       } else {\r
-               print $Lang::tr{'no information available'};\r
-       }\r
-       print "<br />\n";\r
-       &Header::closebox();\r
-\r
-       &Header::openbox('100%', 'center', "Disk $Lang::tr{'graph'}");\r
-       if (-e "$graphdir/disk-day.png") {\r
-               my $ftime = localtime((stat("$graphdir/disk-day.png"))[9]);\r
-               print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";\r
-               print "<a href='/cgi-bin/graphs.cgi?graph=disk'>";\r
-               print "<img src='/graphs/disk-day.png' border='0' />";\r
-               print "</a>";\r
-       } else {\r
-               print $Lang::tr{'no information available'};\r
-       }\r
-       print "<br />\n";\r
-       &Header::closebox();\r
-}\r
-\r
-&Header::closebigbox();\r
-&Header::closepage();\r
+#!/usr/bin/perl
+#
+# SmoothWall CGIs
+#
+# This code is distributed under the terms of the GPL
+#
+# (c) The SmoothWall Team
+#
+# $Id: graphs.cgi,v 1.9.2.6 2005/02/22 22:21:55 gespinasse Exp $
+#
+
+use strict;
+
+# enable only the following on debugging purpose
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
+
+require 'CONFIG_ROOT/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+my %cgiparams=();
+my %pppsettings=();
+my %netsettings=();
+my @cgigraphs=();
+my @graphs=();
+my $iface='';
+
+&Header::showhttpheaders();
+
+my $graphdir = "/home/httpd/html/graphs";
+&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
+
+$ENV{'QUERY_STRING'} =~ s/&//g;
+@cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});
+$cgigraphs[1] = '' unless defined $cgigraphs[1];
+
+if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED)/) {
+       &Header::openpage($Lang::tr{'network traffic graphs'}, 1, '');
+} else {
+       &Header::openpage($Lang::tr{'system graphs'}, 1, '');
+}
+&Header::openbigbox('100%', 'left');
+
+if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|cpu|memory|swap|disk)/) {
+       my $graph = $cgigraphs[1];
+       my $graphname = ucfirst(lc($cgigraphs[1]));
+       &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
+
+       if (-e "$graphdir/${graph}-day.png") {
+               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' />";
+       } else {
+               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)/) {
+               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'}) {
+               push (@graphs, ('BLUE')); }
+       if ($netsettings{'ORANGE_DEV'}) {
+               push (@graphs, ('ORANGE')); }
+       push (@graphs, ("RED"));
+
+       foreach my $graphname (@graphs) {
+               &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
+
+               if (-e "$graphdir/${graphname}-day.png") {
+                       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 "</a>";
+               } else {
+                       print $Lang::tr{'no information available'};
+               }
+               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 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', "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 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 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 src='/graphs/disk-day.png' border='0' />";
+               print "</a>";
+       } else {
+               print $Lang::tr{'no information available'};
+       }
+       print "<br />\n";
+       &Header::closebox();
+}
+
+&Header::closebigbox();
+&Header::closepage();