I think my rrd_CPU.pl is reading incorrectly. This was running fine until saturday. CPU is a X2 AMD. I run top and I see idle, but my graphs are showing 25% equally between system, user, nice and idle.
Code:
Tasks: 117 total, 1 running, 116 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 902040k total, 768496k used, 133544k free, 3788k buffers
Swap: 1959920k total, 5428k used, 1954492k free, 412800k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21149 scot 0 0 2332 1200 884 R 0 0.1 0:00.63 top
1 root 0 0 2040 692 588 S 0 0.1 0:01.12 init
2 root RT 0 0 0 0 S 0 0.0 0:00.02 migration/0
3 root 0 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/0
4 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/0
5 root RT 0 0 0 0 S 0 0.0 0:00.06 migration/1
6 root 0 19 0 0 0 S 0 0.0 0:00.00 ksoftirqd/1
7 root RT 0 0 0 0 S 0 0.0 0:00.00 watchdog/1
8 root 0 -5 0 0 0 S 0 0.0 0:00.10 events/0
9 root 0 -5 0 0 0 S 0 0.0 0:00.12 events/1
10 root 0 -5 0 0 0 S 0 0.0 0:00.00 khelper
11 root 0 -5 0 0 0 S 0 0.0 0:00.00 kthread
15 root 0 -5 0 0 0 S 0 0.0 0:00.00 kblockd/0
16 root 0 -5 0 0 0 S 0 0.0 0:00.00 kblockd/1
17 root 17 -5 0 0 0 S 0 0.0 0:00.00 kacpid
161 root 13 -5 0 0 0 S 0 0.0 0:00.00 kseriod
278 root 0 0 0 0 0 S 0 0.0 0:09.37 pdflush
The graph stays at this 25% across the board with blips of what look to be accurate readings.
[/img]
Code:
cat rrd_CPU.pl
#!/usr/bin/perl
#
# rrd_CPU.pl
# cpu data collection routine for KnoppMyth
#
########################################################################
# Configuration:
my $dbf = 'CPU';
my $configfile = '/etc/rrd.config';
########################################################################
use RRDs;
if (! -d "/myth") { $configfile = "./D_rrd.config"; } #DEBUG
do $configfile;
sub create {
# $_[0] = filename
if (! -e "$log/$_[0].rrd") {
print "Create db for $_[0] => $log/$_[0].rrd\n";
RRDs::create( "$log/$_[0].rrd", "-s 300",
"DS:cpuS:COUNTER:600:0:U",
"DS:cpuU:COUNTER:600:0:U",
"DS:cpuN:COUNTER:600:0:U",
"DS:cpuI:COUNTER:600:0:U",
"RRA:AVERAGE:0.5:1:576",
"RRA:AVERAGE:0.5:6:672",
"RRA:AVERAGE:0.5:24:732",
"RRA:AVERAGE:0.5:144:1460");
$ERROR = RRDs::error;
print "Error: RRDs::create failed for '$_[0]' : $ERROR\n" if $ERROR;
}
}
my ($cpuX, $cpuU, $cpuN, $cpuS, $cpuI, $cpuM);
sub gather {
open DATA, "/proc/stat";
while(<DATA>) {
chomp;
/^cpu\s/ or next;
($cpuX, $cpuU, $cpuN, $cpuS, $cpuI) = split /\s+/;
last;
}
close DATA;
open DATA, "/proc/cpuinfo";
while(<DATA>) {
chomp;
/^model name/ or next;
s/^[^:]*: *(.*)/\1/;
$cpuM = $_;
last;
}
close DATA;
print "CPU: S=$cpuS, U=$cpuU, N=$cpuN, I=$cpuI\n";
}
sub update {
# $_[0] = filename
RRDs::update( "$log/$_[0].rrd", "-t",
"cpuS:cpuU:cpuN:cpuI",
"N:$cpuS:$cpuU:$cpuN:$cpuI");
$ERROR = RRDs::error;
print "Error: RRDs::update for '$_[0]' : $ERROR\n" if $ERROR;
}
sub graph {
# $_[0] = time interval (ie: day...)
# $_[1] = filename suffix.
RRDs::graph( "$png/$dbf-$_[1].png", "-s -1$_[0]", "-aPNG",
"--alt-y-grid", "-w $Gwd", "-h $Ght", "-l 0", "-u 100", "-r",
"--color", "SHADEA$color",
"--color", "SHADEB$color",
"--color", "BACK$color",
"-t CPU {$cpuM} Usage :: $_[0]",
"DEF:cpuS=$log/$dbf.rrd:cpuS:AVERAGE",
"DEF:cpuU=$log/$dbf.rrd:cpuU:AVERAGE",
"DEF:cpuN=$log/$dbf.rrd:cpuN:AVERAGE",
"DEF:cpuI=$log/$dbf.rrd:cpuI:AVERAGE",
"CDEF:cpuT=cpuS,cpuU,cpuN,cpuI,+,+,+",
"CDEF:pctS=100,cpuS,cpuT,/,*",
"CDEF:pctU=100,cpuU,cpuT,/,*",
"CDEF:pctN=100,cpuN,cpuT,/,*",
"CDEF:pctI=100,cpuI,cpuT,/,*",
"AREA:pctS$color_cpuS:System Usage\\:",
"GPRINT:pctS:MIN:Min\\: %5.2lf%%",
"GPRINT:pctS:MAX:Max\\: %5.2lf%%",
"GPRINT:pctS:AVERAGE:Avg\\: %5.2lf%%",
"GPRINT:pctS:LAST:Cur\\: %5.2lf%%\\j",
"STACK:pctU$color_cpuU: User Usage\\:",
"GPRINT:pctU:MIN:Min\\: %5.2lf%%",
"GPRINT:pctU:MAX:Max\\: %5.2lf%%",
"GPRINT:pctU:AVERAGE:Avg\\: %5.2lf%%",
"GPRINT:pctU:LAST:Cur\\: %5.2lf%%\\j",
"STACK:pctN$color_cpuN: Nice Usage\\:",
"GPRINT:pctN:MIN:Min\\: %5.2lf%%",
"GPRINT:pctN:MAX:Max\\: %5.2lf%%",
"GPRINT:pctN:AVERAGE:Avg\\: %5.2lf%%",
"GPRINT:pctN:LAST:Cur\\: %5.2lf%%\\j",
"STACK:pctI$color_cpuI: Idle Usage\\:",
"GPRINT:pctI:MIN:Min\\: %5.2lf%%",
"GPRINT:pctI:MAX:Max\\: %5.2lf%%",
"GPRINT:pctI:AVERAGE:Avg\\: %5.2lf%%",
"GPRINT:pctI:LAST:Cur\\: %5.2lf%%\\j");
$ERROR = RRDs::error;
print "Error: RRDs::graph failed for '$_[0]' : $ERROR\n" if $ERROR;
}
########################################################################
create "$dbf";
gather;
update "$dbf";
graph 'day', 'Daily';
graph 'week', 'Weekly';
graph 'month', 'Monthly';
graph 'year', 'Yearly';
########################################################################
# vim: sw=4 ts=8
# End
I've already tried to re-install with the rrd script and it's still the same.
TIA