#!/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 "



";
} else {
print $Lang::tr{'no information available'};
}
&Header::closebox();
print "| "; if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED)/) { print ""; } else { print ""; } print "$Lang::tr{'back'} |
";
print "";
} else {
print $Lang::tr{'no information available'};
}
print "
";
print "";
} else {
print $Lang::tr{'no information available'};
}
print "
";
print "";
} else {
print $Lang::tr{'no information available'};
}
print "
";
print "";
} else {
print $Lang::tr{'no information available'};
}
print "
";
print "";
} else {
print $Lang::tr{'no information available'};
}
print "