From 3420a44b570c8931d10cc61d38937596bc2e1bd3 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 27 Apr 2010 22:52:38 -0400 Subject: Add VarnishSTAT ajax stat page --- config/varnish64/varnish_backends.xml | 9 +++ config/varnish64/varnish_custom_vcl.xml | 4 + config/varnish64/varnish_lb_directors.xml | 4 + config/varnish64/varnish_settings.xml | 4 + config/varnish64/varnish_sync.xml | 4 + config/varnish64/varnish_view_config.php | 3 +- config/varnish64/varnishstat.php | 119 ++++++++++++++++++++++++++++++ 7 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 config/varnish64/varnishstat.php (limited to 'config/varnish64') diff --git a/config/varnish64/varnish_backends.xml b/config/varnish64/varnish_backends.xml index 4fe4d294..0f993006 100644 --- a/config/varnish64/varnish_backends.xml +++ b/config/varnish64/varnish_backends.xml @@ -64,6 +64,11 @@ 0755 http://www.pfsense.com/packages/config/varnish64/varnish_view_config.php + + /usr/local/www/ + 0755 + http://www.pfsense.com/packages/config/varnish64/varnishstat.php + Varnish Varnish @@ -96,6 +101,10 @@ View Configuration /varnish_view_config.php + + VarnishSTAT + /varnishstat.php + diff --git a/config/varnish64/varnish_custom_vcl.xml b/config/varnish64/varnish_custom_vcl.xml index fcfb3736..24635627 100644 --- a/config/varnish64/varnish_custom_vcl.xml +++ b/config/varnish64/varnish_custom_vcl.xml @@ -71,6 +71,10 @@ View Configuration /varnish_view_config.php + + VarnishSTAT + /varnishstat.php + diff --git a/config/varnish64/varnish_lb_directors.xml b/config/varnish64/varnish_lb_directors.xml index 400f66b8..1ace8933 100644 --- a/config/varnish64/varnish_lb_directors.xml +++ b/config/varnish64/varnish_lb_directors.xml @@ -91,6 +91,10 @@ View Configuration /varnish_view_config.php + + VarnishSTAT + /varnishstat.php + diff --git a/config/varnish64/varnish_settings.xml b/config/varnish64/varnish_settings.xml index 55d236e1..58860688 100644 --- a/config/varnish64/varnish_settings.xml +++ b/config/varnish64/varnish_settings.xml @@ -71,6 +71,10 @@ View Configuration /varnish_view_config.php + + VarnishSTAT + /varnishstat.php + diff --git a/config/varnish64/varnish_sync.xml b/config/varnish64/varnish_sync.xml index 4b8ff355..b2408df9 100644 --- a/config/varnish64/varnish_sync.xml +++ b/config/varnish64/varnish_sync.xml @@ -67,6 +67,10 @@ /pkg_edit.php?xml=varnish_sync.xml&id=0 + + VarnishSTAT + /varnishstat.php + View Configuration /varnish_view_config.php diff --git a/config/varnish64/varnish_view_config.php b/config/varnish64/varnish_view_config.php index 6c3bfcf0..6566525e 100644 --- a/config/varnish64/varnish_view_config.php +++ b/config/varnish64/varnish_view_config.php @@ -57,7 +57,8 @@ include("head.inc"); $tab_array[] = array(gettext("Custom VCL"), false, "/pkg_edit.php?xml=varnish_custom_vcl.xml&id=0"); $tab_array[] = array(gettext("LB Directors"), false, "/pkg.php?xml=varnish_lb_directors.xml"); $tab_array[] = array(gettext("XMLRPC Sync"), false, "/pkg_edit.php?xml=varnish_sync.xml&id=0"); - $tab_array[] = array(gettext("View Configuration"), true, "/varnish_view-config.php"); + $tab_array[] = array(gettext("View Configuration"), true, "/varnish_view-config.php"); + $tab_array[] = array(gettext("VarnishSTAT"), false, "/varnishstat.php"); display_top_tabs($tab_array); ?> diff --git a/config/varnish64/varnishstat.php b/config/varnish64/varnishstat.php new file mode 100644 index 00000000..a4b42a37 --- /dev/null +++ b/config/varnish64/varnishstat.php @@ -0,0 +1,119 @@ + + 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"); + +if($_REQUEST['getactivity']) { + $varnishstatlogs = `varnishstat -1`; + echo "VarnishSTAT Server logs as of " . date("D M j G:i:s T Y") . "\n\n"; + echo $varnishstatlogs; + exit; +} + +$pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); +if(strstr($pfSversion, "1.2")) + $one_two = true; + +$pgtitle = "VarnishSTAT: View Logs"; +include("head.inc"); + +/* NEED TO FIX there are 2 logs /etc/varnishstat/log/main/current and /etc/dnscache/log/main/current */ + +/* NEED TO FIX */ +if ($_POST['clear']) { +// exec("rm /etc/varnishstat/log/main/current"); +// exec("touch /etc/varnishstat/log/main/current"); +} + +?> + + + + + + +

+ + + + +
+ + +
+ + + + +
+
+
+
+
One moment please, loading VarnishSTAT logs...
+
+
+ + +

+ " /> + + +

+ + + -- cgit v1.2.3