summaryrefslogtreecommitdiffstats
path: root/etc/inc/rrd.inc
diff options
context:
space:
mode:
authorVinicius Coque <vinicius.coque@bluepex.com>2011-03-25 08:49:04 -0300
committerVinicius Coque <vinicius.coque@bluepex.com>2011-03-25 08:49:04 -0300
commit54bdff758f68e2e1b1ebd42b8b0b629b68ed1a3d (patch)
tree27b7d45e582e3d84cdf8d0fa0f3bc93b65f3c986 /etc/inc/rrd.inc
parentb845290619244e8cfe3bc2aa6271c6629eeb86b5 (diff)
parent401fb0ad8fa7ad06743435808dac8e913b3c16bb (diff)
downloadpfsense-54bdff758f68e2e1b1ebd42b8b0b629b68ed1a3d.zip
pfsense-54bdff758f68e2e1b1ebd42b8b0b629b68ed1a3d.tar.gz
Merge remote-tracking branch 'mainline/master' into inc
Conflicts: etc/inc/auth.inc etc/inc/config.lib.inc etc/inc/filter.inc etc/inc/pfsense-utils.inc etc/inc/pkg-utils.inc etc/inc/priv.defs.inc etc/inc/services.inc etc/inc/shaper.inc etc/inc/voucher.inc etc/inc/vpn.inc usr/local/www/fbegin.inc
Diffstat (limited to 'etc/inc/rrd.inc')
-rw-r--r--etc/inc/rrd.inc19
1 files changed, 13 insertions, 6 deletions
diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc
index e928fc8..35c461c 100644
--- a/etc/inc/rrd.inc
+++ b/etc/inc/rrd.inc
@@ -298,9 +298,12 @@ function enable_rrd_graphing() {
$rrdupdatesh .= "\n";
$rrdupdatesh .= "# polling traffic for interface $ifname $realif \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 .= "TMPFILE=`mktemp -q /tmp/STATS_{$realif}.XXXXXX` \n";
+ $rrdupdatesh .= "$pfctl -vvsI -i {$realif} > \$TMPFILE \n";
+ $rrdupdatesh .= "unset BYTES \n";
+ $rrdupdatesh .= "BYTES=`cat \$TMPFILE | awk '/In4\/Pass|Out4\/Pass/ {printf \$6 \":\"}'`\\\n";
+ $rrdupdatesh .= "`cat \$TMPFILE | awk '/In4\/Block|Out4\/Block/ {printf \$6 \":\"}'|sed -e 's/.\$//'`\n";
+ $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$traffic N:\$BYTES\n";
/* PACKETS, set up the rrd file */
if (!file_exists("$rrddbpath$ifname$packets")) {
@@ -324,9 +327,11 @@ 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 .= "unset PACKETS \n";
+ $rrdupdatesh .= "PACKETS=`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 .= "$rrdtool update $rrddbpath$ifname$packets N:\$PACKETS\n";
+ $rrdupdatesh .= "rm \$TMPFILE \n";
/* WIRELESS, set up the rrd file */
if($config['interfaces'][$ifname]['wireless']['mode'] == "bss") {
@@ -769,6 +774,8 @@ function enable_rrd_graphing() {
}
function kill_traffic_collector() {
+ mwexec("killall top", true);
+ mwexec("killall rrdtool", true);
mwexec("/bin/pkill -f updaterrd.sh", true);
}
OpenPOWER on IntegriCloud