pfstat 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. /pfstat.php
Status
http://www.pfsense.com/packages/config/pfstat.tgz ['installedpackages']['pfstat']['config'] /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 Graph Name graphname Description description 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 true true true Update interval duration fromclassification select 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() { 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); } sync_package(); sync_package(); system("mkdir -p /usr/local/www/pfstat 2>/dev/null"); system("/usr/bin/killall cron 2>/dev/null"); system("/usr/sbin/cron 2>/dev/null"); system("rm /usr/local/etc/pfstat 2>/dev/null"); system("rm -rf /usr/local/www/pfstat* 2>/dev/null");