Add cpufreq graph

This commit is contained in:
Arne Fitzenreiter
2008-08-02 11:22:30 +02:00
parent d2c65e371a
commit 0950b1ec8e
3 changed files with 67 additions and 1 deletions

View File

@@ -48,6 +48,7 @@ $cgigraphs[1] = '' unless defined $cgigraphs[1];
$cgigraphs[2] = '' unless defined $cgigraphs[2];
if ($cgigraphs[1] =~ /(load)/) {&Graphs::updateloadgraph ("hour");&Graphs::updateloadgraph ("week");&Graphs::updateloadgraph ("month");&Graphs::updateloadgraph ("year");}
elsif ($cgigraphs[1] =~ /(cpufreq)/) {&Graphs::updatecpufreqgraph ("hour");&Graphs::updatecpufreqgraph ("week");&Graphs::updatecpufreqgraph ("month");&Graphs::updatecpufreqgraph ("year");}
elsif ($cgigraphs[1] =~ /(cpu)/) {&Graphs::updatecpugraph ("hour");&Graphs::updatecpugraph ("week");&Graphs::updatecpugraph ("month");&Graphs::updatecpugraph ("year");}
elsif ($cgigraphs[1] =~ /(processes)/) {&Graphs::updateprocessesgraph ("hour");&Graphs::updateprocessesgraph ("week");&Graphs::updateprocessesgraph ("month");&Graphs::updateprocessesgraph ("year");}
elsif ($cgigraphs[1] =~ /(memory|swap)/) {&Graphs::updatememgraph ("hour");&Graphs::updatememgraph ("week");&Graphs::updatememgraph ("month");&Graphs::updatememgraph ("year");}
@@ -135,7 +136,7 @@ elsif ($cgigraphs[1] =~ /(green|blue|orange|red|ppp|ipsec|cpu|memory|swap|disk|l
}
print "<div align='center'><table width='80%'><tr><td align='center'>";
if ( $cgigraphs[1] eq "cpu" || $cgigraphs[1] eq "load" ) { print "<a href='/cgi-bin/system.cgi'>"; }
if ( $cgigraphs[1] eq "cpu" || $cgigraphs[1] eq "cpufreq" || $cgigraphs[1] eq "load" ) { print "<a href='/cgi-bin/system.cgi'>"; }
elsif ( $cgigraphs[1] eq "memory" || $cgigraphs[1] eq "swap" ) { print "<a href='/cgi-bin/memory.cgi'>"; }
elsif ( $cgigraphs[1] eq "processes" ) { print "<a href='/cgi-bin/services.cgi'>"; }
elsif ( $cgigraphs[1] =~ /disk/ ) { print "<a href='/cgi-bin/media.cgi'>"; }

View File

@@ -39,6 +39,7 @@ my %cgiparams=();
# Generate Graphs from rrd Data
&Graphs::updatecpugraph ("day");
&Graphs::updatecpufreqgraph ("day");
&Graphs::updateloadgraph ("day");
&Header::showhttpheaders();
@@ -59,6 +60,17 @@ if (-e "$Header::graphdir/cpu-day.png") {
print "<br />\n";
&Header::closebox();
if (-e "$Header::graphdir/cpufreq-day.png") {
&Header::openbox('100%', 'center', "CPU Frequency $Lang::tr{'graph'}");
my $ftime = localtime((stat("$Header::graphdir/cpufreq-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=cpufreq'>";
print "<img alt='' src='/graphs/cpufreq-day.png' border='0' />";
print "</a>";
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]);