diff options
author | jim-p <jimp@pfsense.org> | 2011-03-08 14:15:35 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-03-08 14:18:30 -0500 |
commit | ae3c0a126f1d935bd266fd5ea01aa873d9e8b0c6 (patch) | |
tree | 1b19eb14e6a1983d3e951c0ffe96b7517dfdcc74 /etc/inc/rrd.inc | |
parent | 3e5c0ab797c65ac4833dfb75049a3e5dd396db74 (diff) | |
download | pfsense-ae3c0a126f1d935bd266fd5ea01aa873d9e8b0c6.zip pfsense-ae3c0a126f1d935bd266fd5ea01aa873d9e8b0c6.tar.gz |
Only run pfctl once per interface for stats, rather than four times.
Diffstat (limited to 'etc/inc/rrd.inc')
-rw-r--r-- | etc/inc/rrd.inc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index ce9797a..472c207 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -298,9 +298,11 @@ function enable_rrd_graphing() { $rrdupdatesh .= "\n"; $rrdupdatesh .= "# polling traffic for interface $ifname $realif \n"; + $rrdupdatesh .= "TMPFILE=`mktemp -q /tmp/STATS_{$realif}.XXXXXX` \n"; + $rrdupdatesh .= "$pfctl -vvsI -i {$realif} > \$TMPFILE \n"; $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$traffic N:\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass/ {printf \$6 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Block|Out4\/Block/ {printf \$6 \":\"}'|sed -e 's/.\$//'`\n"; + $rrdupdatesh .= "`cat \$TMPFILE | awk '/In4\/Pass|Out4\/Pass/ {printf \$6 \":\"}'`\\\n"; + $rrdupdatesh .= "`cat \$TMPFILE | awk '/In4\/Block|Out4\/Block/ {printf \$6 \":\"}'|sed -e 's/.\$//'`\n"; /* PACKETS, set up the rrd file */ if (!file_exists("$rrddbpath$ifname$packets")) { @@ -325,8 +327,9 @@ function enable_rrd_graphing() { $rrdupdatesh .= "\n"; $rrdupdatesh .= "# polling packets for interface $ifname $realif \n"; $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$packets N:\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Pass|Out4\/Pass/ {printf \$4 \":\"}'`\\\n"; - $rrdupdatesh .= "`$pfctl -vvsI -i {$realif} | awk '/In4\/Block|Out4\/Block/ {printf \$4 \":\"}'|sed -e 's/.\$//'`\n"; + $rrdupdatesh .= "`cat \$TMPFILE | awk '/In4\/Pass|Out4\/Pass/ {printf \$4 \":\"}'`\\\n"; + $rrdupdatesh .= "`cat \$TMPFILE | awk '/In4\/Block|Out4\/Block/ {printf \$4 \":\"}'|sed -e 's/.\$//'`\n"; + $rrdupdatesh .= "rm \$TMPFILE \n"; /* WIRELESS, set up the rrd file */ if($config['interfaces'][$ifname]['wireless']['mode'] == "bss") { |