. All rights reserved. */ /* ========================================================================== */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* ========================================================================== */ ]]> Describe your package here Describe your package requirements here Currently there are no FAQ items provided. pfstat 1.7 Services: PFStat Settings PFStat Settings pfstat is a small utility that collects packet filter statistics and produces graphs.
Services
pfstat.xml
PFStat Graphs pfstat is a small utility that collects packet filter statistics and produces graphs.
Status
/pfstat.php
/etc/crontab */5 * * * * root nice -n 20 /usr/local/bin/pfstat -q >> /var/log/pfstat /etc/crontab */10 * * * * root nice -n 20 /usr/local/bin/pfstat -c /usr/local/etc/pfstat.conf -d /var/log/pfstat /etc/crontab 1 1 * * 1 root nice -n 20 tail -n 50000 /var/log/pfstat >/tmp/pfstat && mv /tmp/pfstat /var/log/pfstat ['installedpackages']['pfstat']['config'] Graph Name graphname Description description /usr/local/www/ 0755 https://packages.pfsense.org/packages/config/pfstat.php Graph Name graphname Enter the name of the graph here input Graph Description description Enter the description of the graph here input Image Name imagename Enter the filename for this image. Must end in .jpg. ex. filename.jpg input Graph Size Width graphsizewidth Graph width in pixels. Recommend 960 for large images, 320 for small images. input Graph Size Height graphsizeheight Graph height in pixels. Recommend 300 for large images, 200 for small images. input Update interval from input 1 1 true Update interval duration fromclassification select true true true none none rowhelper Location location Location of graph select Graph Source counters select Color color Color of graph select Appearance appearance Appearance type select function sync_package_pfstat() { conf_mount_rw(); config_lock(); global $config; $fout = fopen("/usr/local/etc/pfstat.conf","w"); if($config['installedpackages']['pfstat']['config'] != "") { foreach($config['installedpackages']['pfstat']['config'] as $rowhelper) { $leftgraphtext = ""; $rightgraphtext = ""; $isfirstleft = 0; $isfirstright = 0; $fromclassification = $rowhelper['fromclassification']; $imagename = $rowhelper['imagename']; $pos = strrpos($imagename, ".jpg"); if ($pos === false) { $imagename .= ".jpg"; } $from = $rowhelper['from']; $graphsizewidth = $rowhelper['graphsizewidth']; $graphsizeheight = $rowhelper['graphsizeheight']; foreach($rowhelper['row'] as $row) { if($row['location'] == "left") { if($isfirstleft == 1) $leftgraphtext .= ",\n"; $leftgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance']; $isfirstleft = 1; } else { if($isfirstright == 1) $rightgraphtext .= ",\n"; $rightgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance']; $isfirstright = 1; } } fwrite($fout, "image \"/usr/local/www/pfstat/" . $imagename ."\" { \n"); if($from == "") $from = "30"; fwrite($fout, "from " . $from . " " . $fromclassification . " to now \n"); fwrite($fout, "width " . $graphsizewidth . " height " . $graphsizeheight . " \n"); if($leftgraphtext != "") { fwrite($fout, " left \n"); fwrite($fout, " " . $leftgraphtext . "\n"); } if($rightgraphtext != "") { fwrite($fout, " right \n"); fwrite($fout, " " . $rightgraphtext . "\n"); } fwrite($fout, "}\n\n"); } } fclose($fout); conf_mount_ro(); config_unlock(); } sync_package_pfstat(); sync_package_pfstat(); make_dirs("/usr/local/www/pfstat"); system("/usr/bin/killall cron 2>/dev/null"); system("/usr/sbin/cron 2>/dev/null"); unlink_if_exists("/usr/local/etc/pfstat"); rmdir_recursive("/usr/local/www/pfstat");