commit 872a281894a27ad99374a16c54b0bb6c28ba84e3 Author: James Coleman Date: Mon Mar 28 21:42:38 2016 -0500 First commit diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..5108a4c --- /dev/null +++ b/License.txt @@ -0,0 +1,12 @@ +Copyright (c) 2016, Mr. Gecko's Media (James Coleman) +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. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..afb9cac --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +I needed a tool like this for my pfSense router, so I decided to go ahead and write my own. I loved getting these graphs from [vnStat](http://humdi.net/vnstat/), and wanted it on my new router. Easy to share and nice to look at. Make sure you edit the config.php file to your liking. \ No newline at end of file diff --git a/config.php b/config.php new file mode 100644 index 0000000..1df013c --- /dev/null +++ b/config.php @@ -0,0 +1,46 @@ + "External"); + +//Graphs to be shown on load of the index. +$defaultGraphs = array( + "vnstati.php?i=igb0&g=vs", + "vnstati.php?i=igb0&g=d" +); + +//Location for the binary of vnStatI. +$vnStatIBin = "/usr/local/bin/vnstati"; + +//Get configuration from parameters. +$iface = isset($_REQUEST['i']) ? $_REQUEST['i'] : ""; +if (!in_array($iface, $ifaceList)) { + $iface = $ifaceList[0]; +} +$graph = isset($_REQUEST['g']) ? $_REQUEST['g'] : "vs"; +switch($graph) { + case "h": + case "d": + case "m": + case "t": + case "s": + case "hs": + case "vs": + break; + default: + $graph = "vs"; +} +$noHeader = isset($_REQUEST['nh']) ? (is_string($_REQUEST['nh']) ? empty($_REQUEST['nh']) || preg_match("/^(y|t|on).*/i", $_REQUEST['nh']) : boolval($_REQUEST['nh'])) : false; +$noEdge = isset($_REQUEST['ne']) ? (is_string($_REQUEST['ne']) ? empty($_REQUEST['ne']) || preg_match("/^(y|t|on).*/i", $_REQUEST['ne']) : boolval($_REQUEST['ne'])) : false; +$noLegend = isset($_REQUEST['nl']) ? (is_string($_REQUEST['nl']) ? empty($_REQUEST['nl']) || preg_match("/^(y|t|on).*/i", $_REQUEST['nl']) : boolval($_REQUEST['nl'])) : false; +$rateUnit = isset($_REQUEST['ru']) ? (is_string($_REQUEST['ru']) ? empty($_REQUEST['ru']) || preg_match("/^(y|t|on).*/i", $_REQUEST['ru']) : boolval($_REQUEST['ru'])) : false; +?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..6934aa2 --- /dev/null +++ b/index.php @@ -0,0 +1,114 @@ + + + + + + + + + vnStat GraphP + + + + =1) { + foreach ($defaultGraphs as $thisGraph) { + ?>


+
+
vnStatGraphP Options

+ +
+ + +
+ + + />
+ + + />
+ + + />
+ + + /> - Swap configured rate unit
+
+ +

+ + + + + \ No newline at end of file diff --git a/vnstati.php b/vnstati.php new file mode 100644 index 0000000..bb4bacf --- /dev/null +++ b/vnstati.php @@ -0,0 +1,33 @@ + \ No newline at end of file