X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=html%2Fcgi-bin%2Fmemory.cgi;fp=html%2Fcgi-bin%2Fmemory.cgi;h=35ce7a0f1137882caa80af8c82904c8705f6622e;hb=4e481c3a517c27fae6b8e7056fb8a5fdd05c9188;hp=ed73fb3f80e9671840825e5b667c1f20fd2720be;hpb=989182d244671879b69d43d99161ae24a9a97f42;p=people%2Fteissler%2Fipfire-2.x.git diff --git a/html/cgi-bin/memory.cgi b/html/cgi-bin/memory.cgi index ed73fb3f8..35ce7a0f1 100644 --- a/html/cgi-bin/memory.cgi +++ b/html/cgi-bin/memory.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# Copyright (C) 2008 Michael Tremer & Christian Schmidt # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -30,57 +30,51 @@ require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "${General::swroot}/graphs.pl"; -my %cgiparams=(); +my %color = (); +my %mainsettings = (); +&General::readhash("${General::swroot}/main/settings", \%mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); -&Graphs::updatememgraph ("day"); +my @querry = split(/\?/,$ENV{'QUERY_STRING'}); +$querry[0] = '' unless defined $querry[0]; +$querry[1] = 'hour' unless defined $querry[1]; -&Header::showhttpheaders(); -&Header::getcgihash(\%cgiparams); -&Header::openpage($Lang::tr{'memory information'}, 1, ''); -&Header::openbigbox('100%', 'left'); +if ( $querry[0] =~ "memory"){ + print "Content-type: image/png\n\n"; + binmode(STDOUT); + &Graphs::updatememorygraph($querry[1]); +}elsif ( $querry[0] =~ "swap"){ + print "Content-type: image/png\n\n"; + binmode(STDOUT); + &Graphs::updateswapgraph($querry[1]); +}else{ + &Header::showhttpheaders(); + &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 "
$Lang::tr{'size'} | @@ -90,52 +84,51 @@ while($Lang::tr{'ram'} | $size KB | 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 <$Lang::tr{'swap'} | $size KB | END ; - } elsif ($ram and $_ =~ m/^-\/\+ buffers\/cache:\s+(\d+)\s+(\d+)$/ ) { - ($used,$free) = ($1,$2); - ($percent = ($used/$ram)*100) =~ s/^(\d+)(\.\d+)?$/$1%/; - print "||
$Lang::tr{'excluding buffers and cache'} | " - } - print <$Lang::tr{'excluding buffers and cache'} | "; + } + print <$free KB |
END
;
- &percentbar($percent);
- print <$percent |
| ||
$Lang::tr{'shared'} | $shared KB | |||||
$Lang::tr{'buffers'} | $buffers KB | |||||
" - } elsif ($percent eq "0%") { - print " | " - } else { - print " | "
- }
- print <";
+ }else{
+ print " | ";
+ }
+ print < | |