From 4bb1138178fc526192024cb6ef4fc12a26b140b7 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Mon, 29 Dec 2014 23:04:40 +0100 Subject: haproxy-devel, fix saving errorfiles from errorfiles tab, fix write 'tcp-request content' before 'use_backend', fix hint text for a backend without servers, stats now give better description if disabled/unavailable, moved templates to their own tab --- config/haproxy-devel/haproxy_stats.php | 71 +++++----------------------------- 1 file changed, 9 insertions(+), 62 deletions(-) (limited to 'config/haproxy-devel/haproxy_stats.php') diff --git a/config/haproxy-devel/haproxy_stats.php b/config/haproxy-devel/haproxy_stats.php index 10dd136a..302793b6 100644 --- a/config/haproxy-devel/haproxy_stats.php +++ b/config/haproxy-devel/haproxy_stats.php @@ -32,6 +32,10 @@ require_once("haproxy_socketinfo.inc"); $pconfig = $config['installedpackages']['haproxy']; if (isset($_GET['haproxystats']) || isset($_GET['scope']) || (isset($_POST) && isset($_POST['action']))){ + if (!(isset($pconfig['enable']) && $pconfig['localstatsport'] && is_numeric($pconfig['localstatsport']))){ + print 'In the "Settings" configure a internal stats port and enable haproxy for this to be functional. Also make sure the service is running.'; + return; + } $fail = false; try{ $request = ""; @@ -79,48 +83,6 @@ if (!is_array($config['installedpackages']['haproxy']['ha_backends']['item'])) { } $a_frontend = &$config['installedpackages']['haproxy']['ha_backends']['item']; -function haproxy_add_stats_example() { - global $config, $d_haproxyconfdirty_path; - $a_backends = &$config['installedpackages']['haproxy']['ha_pools']['item']; - $a_frontends = &$config['installedpackages']['haproxy']['ha_backends']['item']; - $webcert = haproxy_find_create_certificate("HAProxy stats default"); - - $backend = array(); - $backend["name"] = "HAProxy_stats_ssl_backend"; - $backend["stats_enabled"] = "yes"; - $backend["stats_uri"] = "/"; - $backend["stats_refresh"] = "10"; - $a_backends[] = $backend; - $changecount++; - - $frontend = array(); - $frontend["name"] = "HAProxy_stats_ssl_frontend"; - $frontend["status"] = "active"; - $frontend["type"] = "http"; - $frontend["port"] = "444"; - $frontend["extaddr"] = "lan_ipv4"; - $frontend["ssloffload"] = "yes"; - $frontend["ssloffloadcert"] = $webcert['refid']; - $frontend["backend_serverpool"] = $backend["name"]; - $a_frontends[] = $frontend; - $changecount++; - $changedesc = "add new HAProxy stats example"; - - if ($changecount > 0) { - echo "touching: $d_haproxyconfdirty_path"; - touch($d_haproxyconfdirty_path); - write_config($changedesc); - } -} - -if (isset($_GET['add_stats_example'])) { - haproxy_add_stats_example(); - write_config(); - touch($d_haproxyconfdirty_path); - header("Location: haproxy_listeners.php"); - exit; -} - if ($_POST) { if ($_POST['apply']) { $result = haproxy_check_and_run($savemsg, true); @@ -177,30 +139,15 @@ echo "";
As the page is forwarded through the pfSense gui, this might cause some functionality to not work.
Though the normal haproxy stats page can be tweaked more, and doesn't use a user/pass from pfSense itself.
- Some examples are configurable automatic page refresh,
- only showing certain servers, not providing admin options, and can be accessed from wherever the associated frontend is accessible.(as long as rules permit access)
- To use this or for simply an example how to use SSL-offloading configure stats on either a real backend while utilizing the 'stats uri'. - Or create a backend specifically for serving stats, for that you can start with the 'stats example' template below.
+ Some examples are configurable automatic page refresh, only showing certain servers, not providing admin options,
+ and can be accessed from wherever the associated frontend is accessible.(as long as rules permit access)
+ To use this or for simply an example how to use SSL-offloading configure stats on either a real backend while utilizing the 'stats uri'.
+ Or create a backend specifically for serving stats, for that you can start with the 'stats example' from the template tab.
  - - Stats example template - - - Example - - As an basic example you can use the link below to create a 'stats' frontend/backend page which offers with more options like setting user/password and 'admin mode' when you go to the backend settings.
- TEMPLATE: Create stats example configuration using a frontend/backend combination with ssl
-
- After applying the changes made by the template use this link to visit the stats page: :444">https://pfSense-LAN-ip:444/ - - - -   - HAProxy stick-tables @@ -241,7 +188,7 @@ echo "";
- In the "Settings" configure a internal stats port and enable haproxy for this to be functional.
+ In the "Settings" configure a internal stats port and enable haproxy for this to be functional. Also make sure the service is running.

-- cgit v1.2.3