From a0f51167f3a4476954a95d96ccf2b5b280164bda Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 5 Jan 2005 02:19:48 +0000 Subject: Add pfstat.php command used to show graphs. Fix graph layouts when multiple graphs defined. --- packages/pfstat.php | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ packages/pfstat.xml | 26 ++++++++++--------- 2 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 packages/pfstat.php diff --git a/packages/pfstat.php b/packages/pfstat.php new file mode 100644 index 00000000..42a96f96 --- /dev/null +++ b/packages/pfstat.php @@ -0,0 +1,72 @@ +#!/usr/local/bin/php + + + + +<?=gentitle_pkg($title);?> + + + + + + +

+
+ + +"; + echo "
" . $graph['graphname'] . "\n"; + echo "
"; + echo ""; + echo "
"; + echo "
"; + echo "
" . $graph['description'] . "
\n"; + echo "\n"; + echo " 
"; + } +?> + + + + + diff --git a/packages/pfstat.xml b/packages/pfstat.xml index 1349bb55..fa8faa42 100644 --- a/packages/pfstat.xml +++ b/packages/pfstat.xml @@ -11,9 +11,12 @@ PFStat Graphs pfstat is a small utility that collects packet filter statistics and produces graphs. - /pfstat/ + /pfstat.php
Services
+ + http://www.pfsense.com/packages/config/pfstat.tgz + ['installedpackages']['package']['$packagename']['configuration'] @@ -181,12 +184,12 @@ function sync_package() { global $config; $fout = fopen("/usr/local/etc/pfstat.conf","w"); - $leftgraphtext = ""; - $rightgraphtext = ""; - $isfirstleft = 0; - $isfirstright = 0; if($config['installedpackages']['pfstat']['config'] != "") { foreach($config['installedpackages']['pfstat']['config'] as $rowhelper) { + $leftgraphtext = ""; + $rightgraphtext = ""; + $isfirstleft = 0; + $isfirstright = 0; foreach($rowhelper['row'] as $row) { if($row['location'] == "left") { if($isfirstleft == 1) $leftgraphtext .= ",\n"; @@ -198,13 +201,11 @@ $isfirstright = 1; } } - } - foreach($config['installedpackages']['pfstat']['config'] as $pkgconfig) { - fwrite($fout, "image \"/usr/local/www/pfstat/" . $pkgconfig['imagename'] ."\" { \n"); - $from = $pkgconfig['from']; + fwrite($fout, "image \"/usr/local/www/pfstat/" . $rowhelper['imagename'] ."\" { \n"); + $from = $rowhelper['from']; if($from == "") $from = "30"; - fwrite($fout, "from " . $from . " " . $pkgconfig['fromclassification'] . " to now \n"); - fwrite($fout, "width " . $pkgconfig['graphsizewidth'] . " height " . $pkgconfig['graphsizeheight'] . " \n"); + fwrite($fout, "from " . $from . " " . $rowhelper['fromclassification'] . " to now \n"); + fwrite($fout, "width " . $row['graphsizewidth'] . " height " . $rowhelper['graphsizeheight'] . " \n"); if($leftgraphtext != "") { fwrite($fout, " left \n"); fwrite($fout, " " . $leftgraphtext . "\n"); @@ -215,8 +216,8 @@ } fwrite($fout, "}\n\n"); } - fclose($fout); } + fclose($fout); } sync_package(); @@ -232,6 +233,7 @@ system("rm /usr/local/etc/pfstat*"); + system("rm -rf /usr/local/www/pfstat*");