diff options
author | Renato Botelho <renato@netgate.com> | 2015-08-03 08:49:14 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-08-03 08:49:14 -0300 |
commit | ce76b1f0010a6b378d1f47d03367c20850c19da4 (patch) | |
tree | f2612e26d336f248f967b68c7c74665e5162172a | |
parent | e547be123953a771fd981a57d20cb5ef52be92d7 (diff) | |
parent | 3303cde5b2edea51b5f1c7f7c663409f85dc9660 (diff) | |
download | pfsense-packages-ce76b1f0010a6b378d1f47d03367c20850c19da4.tar.gz pfsense-packages-ce76b1f0010a6b378d1f47d03367c20850c19da4.tar.bz2 pfsense-packages-ce76b1f0010a6b378d1f47d03367c20850c19da4.zip |
Merge pull request #927 from doktornotor/patch-16
-rw-r--r-- | config/rrd-summary/rrd-summary.xml | 84 | ||||
-rw-r--r-- | config/rrd-summary/status_rrd_summary.php | 24 | ||||
-rw-r--r-- | pkg_config.10.xml | 2 |
3 files changed, 52 insertions, 58 deletions
diff --git a/config/rrd-summary/rrd-summary.xml b/config/rrd-summary/rrd-summary.xml index 4b62272d..67c20937 100644 --- a/config/rrd-summary/rrd-summary.xml +++ b/config/rrd-summary/rrd-summary.xml @@ -2,69 +2,57 @@ <!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> <?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> - <copyright> - <![CDATA[ + <copyright> + <![CDATA[ /* $Id$ */ -/* ========================================================================== */ +/* ====================================================================================== */ /* - rrd-summary.xml - part of pfSense (http://www.pfSense.com) - Copyright (C) 2010 to whom it may belong - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>. - All rights reserved. - */ -/* ========================================================================== */ + rrd-summary.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2010 Jim Pingle + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ /* - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + 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. - 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. - 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. - */ -/* ========================================================================== */ - ]]> - </copyright> + 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. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <description>RRD Summary Page</description> - <requirements>None</requirements> - <faq>Currently there are no FAQ items provided.</faq> <name>RRD Summary</name> - <version>1.1</version> + <version>1.2</version> <title>Status: RRD Summary</title> <menu> <name>RRD Summary</name> - <tooltiptext></tooltiptext> + <tooltiptext>Display total amount of traffic passed In/Out during this and the previous month.</tooltiptext> <section>Status</section> <url>/status_rrd_summary.php</url> </menu> <additional_files_needed> <prefix>/usr/local/www/</prefix> - <chmod>077</chmod> <item>https://packages.pfsense.org/packages/config/rrd-summary/status_rrd_summary.php</item> </additional_files_needed> - <custom_php_deinstall_command> - <![CDATA[ - $version = file_get_contents("/etc/version"); - if ($version[0] < 2) { - unlink_if_exists("/usr/local/www/status_rrd_summary.php"); - } - ]]> - </custom_php_deinstall_command> -</packagegui>
\ No newline at end of file +</packagegui> diff --git a/config/rrd-summary/status_rrd_summary.php b/config/rrd-summary/status_rrd_summary.php index 0e43d95c..27a6f069 100644 --- a/config/rrd-summary/status_rrd_summary.php +++ b/config/rrd-summary/status_rrd_summary.php @@ -1,7 +1,10 @@ <?php /* rrd_summary.php + part of pfSense (https://www.pfsense.org/) Copyright (C) 2010 Jim Pingle + Copyright (C) 2015 ESF, LLC + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -37,9 +40,9 @@ $lastmonth = fetch_rrd_summary($rrd, $lastmonth, $start, 720*60); function fetch_rrd_summary($rrd, $start, $end, $resolution=3600) { $traffic = array(); - $rrd = escapeshellarg("/var/db/rrd/{$rrd}"); + $rrd = escapeshellarg("/var/db/rrd/{$rrd}"); $start = escapeshellarg($start); - $end = escapeshellarg($end); + $end = escapeshellarg($end); exec("/usr/local/bin/rrdtool fetch {$rrd} AVERAGE -r {$resolution} -s {$start} -e {$end} | grep -v nan | awk '{ sum1 += $2/(1024*1024); sum2 += $3/(1024*1024) } END { printf \"%u|%u\", sum1*{$resolution}, sum2*{$resolution}; }'", $traffic); return explode('|', trim($traffic[0])); } @@ -55,19 +58,20 @@ function print_rrd_summary_table($data) { ?> } $pgtitle = "Status: RRD Summary"; -include("head.inc"); -include("fbegin.inc"); +include_once("head.inc"); +echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">"; +include_once("fbegin.inc"); $rrds = glob("/var/db/rrd/*-traffic.rrd"); ?> -<form name="form1" action="status_rrd_summary.php" method="POST"> - RRD Database: +<form name="form1" action="status_rrd_summary.php" method="post"> + RRD Database: <select name="rrd" class="formselect" onchange="document.form1.submit()"> <?php foreach ($rrds as $r) { $r = basename($r); - $selected = ($r == $rrd) ? " selected" : ""; + $selected = ($r == $rrd) ? ' selected="selected"' : ''; print "<option value=\"{$r}\"{$selected}>{$r}</option>"; } ?> </select> @@ -75,7 +79,7 @@ $rrds = glob("/var/db/rrd/*-traffic.rrd"); <select name="startday" class="formselect" onchange="document.form1.submit()"> <?php for ($day=1; $day < 29; $day++) { - $selected = ($day == $startday) ? " selected" : ""; + $selected = ($day == $startday) ? ' selected="selected"' : ""; print "<option value=\"{$day}\"{$selected}>{$day}</option>"; } ?> </select> @@ -87,4 +91,6 @@ This Month (to date, does not include this hour, starting at day <?php echo $sta Last Month: <?php print_rrd_summary_table($lastmonth); ?> -<?php include("fend.inc"); ?> +<?php include_once("fend.inc"); ?> +</body> +</html> diff --git a/pkg_config.10.xml b/pkg_config.10.xml index e1edf182..2f485ae8 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -1245,7 +1245,7 @@ <internal_name>RRD_Summary</internal_name> <descr>RRD Summary Page, which will give a total amount of traffic passed In/Out during this and the previous month.</descr> <category>System</category> - <version>1.1</version> + <version>1.2</version> <status>Beta</status> <maintainer>jimp@pfsense.org</maintainer> <port_category>sysutils</port_category> |