aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-01-05 02:19:48 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-01-05 02:19:48 +0000
commita0f51167f3a4476954a95d96ccf2b5b280164bda (patch)
treee062226a4380b9144713e24681b5e6b568de41e6 /packages
parentad310dcf307d3f8f473cebd21fc7b8f2875480ad (diff)
downloadpfsense-packages-a0f51167f3a4476954a95d96ccf2b5b280164bda.tar.gz
pfsense-packages-a0f51167f3a4476954a95d96ccf2b5b280164bda.tar.bz2
pfsense-packages-a0f51167f3a4476954a95d96ccf2b5b280164bda.zip
Add pfstat.php command used to show graphs.
Fix graph layouts when multiple graphs defined.
Diffstat (limited to 'packages')
-rw-r--r--packages/pfstat.php72
-rw-r--r--packages/pfstat.xml26
2 files changed, 86 insertions, 12 deletions
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
+<?php
+/*
+ pkg.php
+ Copyright (C) 2004 Scott Ullrich
+ 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.
+*/
+
+require("guiconfig.inc");
+require("xmlparse_pkg.inc");
+
+function gentitle_pkg($pgname) {
+ global $config;
+ return $config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pgname;
+}
+
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title><?=gentitle_pkg($title);?></title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<link href="gui.css" rel="stylesheet" type="text/css">
+</head>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php
+include("fbegin.inc");
+?>
+<p class="pgtitle"><?=$title?></p>
+<form action="firewall_nat_out_load_balancing.php" method="post">
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<?php
+ foreach($config['installedpackages']['pfstat']['config'] as $graph) {
+ echo "<table BORDERCOLOR=\"#990000\" width=\"100%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\">";
+ echo "<tr bgcolor='#990000'><td><center><font color='white'>" . $graph['graphname'] . "</td></tr>\n";
+ echo "<td><center><table width=\"100%\"><tr><td width='100%'>";
+ echo "<br><img src='/pfstat/" . $graph['imagename'] . "'>";
+ echo "</td></tr>";
+ echo "<tr bgcolor='#990000'><td><center><font color='white'>" . $graph['description'] . "</td></tr>";
+ echo "</table>\n";
+ echo "</td></tr>\n";
+ echo "</table>&nbsp;<br>";
+ }
+?>
+
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
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 @@
<menu>
<name>PFStat Graphs</name>
<tooltiptext>pfstat is a small utility that collects packet filter statistics and produces graphs.</tooltiptext>
- <url>/pfstat/</url>
+ <url>/pfstat.php</url>
<section>Services</section>
</menu>
+ <additional_files_needed>
+ <item>http://www.pfsense.com/packages/config/pfstat.tgz</item>
+ </additional_files_needed>
<!-- configpath gets expanded out automatically and config items will be
stored in that location -->
<configpath>['installedpackages']['package']['$packagename']['configuration']</configpath>
@@ -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();
</custom_php_command_before_form>
@@ -232,6 +233,7 @@
</custom_php_install_command>
<custom_php_deinstall_command>
system("rm /usr/local/etc/pfstat*");
+ system("rm -rf /usr/local/www/pfstat*");
</custom_php_deinstall_command>
<!--
<custom_php_install_command>