.
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 hereDescribe your package requirements hereCurrently there are no FAQ items provided.pfstat1.7Services: PFStat Settings/usr/local/www/0755http://www.pfsense.com/packages/config/pfstat.php['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 NamegraphnameDescriptiondescriptionGraph NamegraphnameEnter the name of the graph hereinputGraph DescriptiondescriptionEnter the description of the graph hereinputImage NameimagenameEnter the filename for this image. Must end in .jpg. ex. filename.jpginputGraph Size WidthgraphsizewidthGraph width in pixels. Recommend 960 for large images, 320 for small images.inputGraph Size HeightgraphsizeheightGraph height in pixels. Recommend 300 for large images, 200 for small images.inputUpdate intervalfrominput11truetruetruetrueUpdate interval durationfromclassificationselectrowhelperLocationlocationLocation of graphselectGraph SourcecountersselectColorcolorColor of graphselectAppearanceappearanceAppearance typeselect
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");