diff options
author | Seth Mos <seth.mos@dds.nl> | 2011-02-02 16:26:45 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@dds.nl> | 2011-02-02 16:26:45 +0100 |
commit | 396243e9b5dd4ea6a0eb0d59adaaf96782e1d5e2 (patch) | |
tree | fc41a5816f3a66f1eb2a2c5051708afd8665343b /etc | |
parent | 31a7477d2819afae9ea82117b69a78d872d60f85 (diff) | |
download | pfsense-396243e9b5dd4ea6a0eb0d59adaaf96782e1d5e2.zip pfsense-396243e9b5dd4ea6a0eb0d59adaaf96782e1d5e2.tar.gz |
Alter the traffic collector kill function, alter the output of top from a pipe to a file. We can now have /tmp/top_output.txt for status
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/rrd.inc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index a419c29..56d00fc 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -252,7 +252,7 @@ function enable_rrd_graphing() { /* db update script */ $rrdupdatesh = "#!/bin/sh\n"; $rrdupdatesh .= "\n"; - $rrdupdatesh .= "export TERM=dumb\n"; + $rrdupdatesh .= "export TERM=serial\n"; $rrdupdatesh .= "counter=1\n"; $rrdupdatesh .= "while [ \"\$counter\" -ne 0 ]\n"; $rrdupdatesh .= "do\n"; @@ -568,11 +568,12 @@ function enable_rrd_graphing() { } /* the CPU stats gathering function. */ - $rrdupdatesh .= "`$top -d 2 -s 1 0 | tail -n7 | $awk '{gsub(/%/, \"\")} BEGIN { \\\n"; - $rrdupdatesh .= "printf \"$rrdtool update $rrddbpath$ifname$proc \" } \\\n"; + $rrdupdatesh .= "$top -d 2 -s 1 0 | tail -n7 > /tmp/top_output.txt\n"; + $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$proc N:\\\n"; + $rrdupdatesh .= "`$awk < /tmp/top_output.txt '{gsub(/%/, \"\")} \\\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"; + $rrdupdatesh .= "} END { printf user\":\"nice\":\"sys\":\"interrupt\":\"processes }'`\n\n"; /* End CPU statistics */ @@ -776,8 +777,8 @@ function enable_rrd_graphing() { } function kill_traffic_collector() { + mwexec("killall top", true); mwexec("killall rrdtool", true); - sleep(1); mwexec("/bin/pkill -f updaterrd.sh", true); } |