CPU Graph wieder auf Ticks umgestellt und erweitert

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@578 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
maniacikarus
2007-05-24 19:41:13 +00:00
parent 71afa7d0ba
commit 6041214709
2 changed files with 181 additions and 161 deletions

View File

@@ -115,10 +115,11 @@ sub gettraffic {
sub updatecpudata {
if ( ! -e "$rrdlog/cpu.rrd") {
RRDs::create ("$rrdlog/cpu.rrd", "--step=300",
"DS:user:GAUGE:600:0:100",
"DS:system:GAUGE:600:0:100",
"DS:idle:GAUGE:600:0:100",
"DS:iowait:GAUGE:600:0:100",
"DS:user:COUNTER:600:0:500000000",
"DS:system:COUNTER:600:0:500000000",
"DS:idle:COUNTER:600:0:500000000",
"DS:iowait:COUNTER:600:0:500000000",
"DS:irq:COUNTER:600:0:500000000",
"RRA:AVERAGE:0.5:1:576",
"RRA:AVERAGE:0.5:6:672",
"RRA:AVERAGE:0.5:24:732",
@@ -127,15 +128,23 @@ sub updatecpudata {
print "Error in RRD::create for cpu: $ERROR\n" if $ERROR;
}
my ($cpu, $user, $nice, $system, $idle, $trash, $iowait);
my ($cpu, $user, $nice, $system, $idle, $iowait, $irq, $softirq);
my $Zeilen = `/usr/bin/iostat -c | tail -2 | head -1`;
($trash, $user, $nice, $system, $iowait, $trash, $idle) = split(/\s+/,$Zeilen);
open STAT, "/proc/stat";
while(<STAT>) {
chomp;
/^cpu\s/ or next;
($cpu, $user, $nice, $system, $idle, $iowait, $irq, $softirq) = split /\s+/;
last;
}
close STAT;
$user += $nice;
$irq += $softirq;
RRDs::update ("$rrdlog/cpu.rrd",
"-t", "user:system:idle:iowait",
"N:$user:$system:$idle:$iowait");
"-t", "user:system:idle:iowait:irq",
"N:$user:$system:$idle:$iowait:$irq");
$ERROR = RRDs::error;
print "Error in RRD::update for cpu: $ERROR\n" if $ERROR;