fix CPU RRD graphs

This commit is contained in:
Chris Buechler 2009-01-31 19:09:39 -05:00
parent 8fc66a0084
commit bc9b5f3380

View File

@ -3300,20 +3300,11 @@ function enable_rrd_graphing() {
}
/* the CPU stats gathering function. */
$rrdupdatesh .= "`$top -d 2 -s 1 0 | $awk '{gsub(/%/, \"\")} BEGIN { ";
$rrdupdatesh .= "printf \"$rrdtool update $rrddbpath$ifname$proc \" } ";
$rrdupdatesh .= "{ if ( \$2 == \"processes:\" ) { ";
$rrdupdatesh .= "processes = \$1; ";
$rrdupdatesh .= "} ";
$rrdupdatesh .= "else if ( \$1 == \"CPU\" ) { ";
$rrdupdatesh .= "user = \$3; ";
$rrdupdatesh .= "nice = \$5; ";
$rrdupdatesh .= "sys = \$7; ";
$rrdupdatesh .= "interrupt = \$9; ";
$rrdupdatesh .= "} ";
$rrdupdatesh .= "} END { ";
$rrdupdatesh .= "printf \"N:\"user\":\"nice\":\"sys\":\"interrupt\":\"processes ";
$rrdupdatesh .= "}'`\n\n";
$rrdupdatesh .= "`$top -d 2 -s 1 0 | $awk '{gsub(/%/, \"\")} BEGIN { \\\n";
$rrdupdatesh .= "printf \"$rrdtool update $rrddbpath$ifname$proc \" } \\\n";
$rrdupdatesh .= "{ if ( \$2 == \"processes:\" ) { processes = \$1; } \\\n";
$rrdupdatesh .= "else if ( \$1 == \"CPU:\" ) { user = \$2; nice = \$4; sys = \$6; interrupt = \$8; } \\\n";
$rrdupdatesh .= "} END { printf \"N:\"user\":\"nice\":\"sys\":\"interrupt\":\"processes }'`\n\n";
/* End CPU statistics */