$arg)
$request .= ";$key=$arg";
}
$options = array(
'http'=>array(
'method'=>"POST",
'header'=>"Accept-language: en\r\n".
"Content-type: application/x-www-form-urlencoded\r\n",
'content'=>http_build_query($_POST)
));
$context = stream_context_create($options);
$response = file_get_contents("http://127.0.0.1:{$pconfig['localstatsport']}/haproxy_stats.php?haproxystats=1".$request, false, $context);
if (is_array($http_response_header)){
foreach($http_response_header as $header){
if (strpos($header,"Refresh: ") == 0)
header($header);
}
}
$fail = $response === false;
} catch (Exception $e) {
$fail = true;
}
if ($fail)
$response = "
Make sure HAProxy settings are applied and HAProxy is enabled and running";
echo $response;
exit(0);
}
require_once("guiconfig.inc");
if (isset($_GET['showsticktablecontent'])){
if (is_numeric($pconfig['localstats_sticktable_refreshtime']))
header("Refresh: {$pconfig['localstats_sticktable_refreshtime']}");
}
$shortcut_section = "haproxy";
require_once("haproxy.inc");
require_once("certs.inc");
require_once("haproxy_utils.inc");
require_once("pkg_haproxy_tabs.inc");
if (!is_array($config['installedpackages']['haproxy']['ha_backends']['item'])) {
$config['installedpackages']['haproxy']['ha_backends']['item'] = array();
}
$a_frontend = &$config['installedpackages']['haproxy']['ha_backends']['item'];
if ($_POST) {
if ($_POST['apply']) {
$result = haproxy_check_and_run($savemsg, true);
if ($result)
unlink_if_exists($d_haproxyconfdirty_path);
}
}
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
if ($pf_version < 2.0)
$one_two = true;
$pgtitle = "Services: HAProxy: Stats";
include("head.inc");
?>
|
if (isset($_GET['showsticktablecontent'])){
$sticktablename = $_GET['showsticktablecontent'];
echo "";
echo "Contents of the sticktable: $sticktablename ";
$res = haproxy_socket_command("show table $sticktablename");
foreach($res as $line){
echo " ".print_r($line,true);
}
echo " | ";
} else {
?>
This page contains a 'stats' page available from haproxy accessible through the pfSense gui.
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' from the template tab.
|
|
HAProxy stick-tables |
These tables are used to store information for session persistence and can be used with ssl-session-id information, application-cookies, or other information that is used to persist a user to a server.
Stick-table |
Type |
Size |
Used |
$tables = haproxy_get_tables();
foreach($tables as $key => $table) { ?>
=$key;?> |
=$table['type'];?> |
=$table['size'];?> |
=$table['used'];?> |
} ?>
|
|
HAProxy stats |
Fullscreen stats page |
if (isset($pconfig['enable']) && $pconfig['localstatsport'] && is_numeric($pconfig['localstatsport'])){?>
} else { ?>
In the "Settings" configure a internal stats port and enable haproxy for this to be functional. Also make sure the service is running.
} ?>
}?>
|
|