Lua Module
The dashboard package you used to install the dashboard UI also includes a Lua module that returns HAProxy Enterprise statistics. It allows the Real-time Dashboard to display live data.
Enable metrics for a single instance
-
Edit the configuration file:
On Debian/Ubuntu, /etc/default/hapee-2.3-lb
On Redhat/CentOS, /etc/sysconfig/hapee-2.3-lb
Change the OPTIONS line so that it contains the following
-f
argument, which loads the dashboard-module.cfg file when the HAProxy Enterprise service starts:OPTIONS="-f /etc/hapee-2.3/dashboard-module.cfg"
The dashboard-module.cfg file starts a new listener at port 9022 that exposes metrics data. This data comes from an applet defined in the Dashboard Lua module located in /opt/hapee-2.3/dashboard/dashboard-module.
-
Restart the HAProxy Enterprise service for the change to take effect:
$ sudo systemctl restart hapee-2.3-lb
Open the dashboard in your browser. Click the
button to display the Settings window.
Set Data Source to Real-time Dashboard Module.
Set Data Source Mode to Single Node and close the window.
At the top of the Real-time Dashboard is the header bar, which display the address from where it fetches statistics. Change the URL to be the address of your HAProxy Enterprise instance. You do not need to specify a port. The port defaults to 9022, so you do not need to set it here. If the address is already correct, you do not need to change it.
Click the
button to complete setup.
Enable metrics for multiple instances
Optionally, you can connect to data feeds from multiple HAProxy Enterprise instances running on different servers:
On each HAProxy Enterprise server, install the Real-time Dashboard.
Edit the configuration file to enable metrics. See Enable metrics for a single instance.
-
Choose one server to act as the "aggregation primary" instance. On that server, update the file /opt/hapee-2.3/dashboard/dashboard-module/dashboard-config.lua. Initially, it contains the following, empty configuration:
conf = { cluster = { nodes = nil, master = false } }
-
Add the IP address and port of each HAProxy Enterprise instance to the
nodes
property. Also, set themaster
property to true:conf = { cluster = { nodes = { "192.168.50.25:9022", "192.168.50.26:9022", "192.168.50.27:9022", }, master = true } }
-
Restart the HAProxy Enterprise service:
$ sudo systemctl restart hapee-2.3-lb
Open the Real-time Dashboard in your browser, then click the
button to display the Settings window.
Set Data Source to Real-time Dashboard Module.
Set Data Source Mode to Cluster Aggregation and close the window.
Click the
button to complete setup.
Enable metrics for multiple processes
-
Edit the HAProxy Enterprise configuration to start multiple processes using the
nbproc
directive in theglobal
section. Set the value to the number of processes to create, as in the following example:global nbproc 2
-
Add a
bind-process
directive to one or severalfrontend
orlisten
sections to associate them with a specific process. For example:frontend website bind :80 bind-process 1 default_backend webservers frontend api bind 8080 bind-process 2 default_backend apiservers
Edit the configuration file to enable metrics. See Enable metrics for a single instance.
-
Update the file Real-time Dashboard configuration file /etc/hapee-2.3/dashboard-module.cfg so that its
listen
section has abind
line for each process:listen dashboard bind *:9022 process 1 bind *:9122 process 2
-
Update the file /opt/hapee-2.3/dashboard/dashboard-module/dashboard-config.lua.
Initially, it contains the following, empty configuration:
conf = { cluster = { nodes = nil, master = false } }
-
Add the IP address and port of each HAProxy Enterprise process to the
nodes
property. Also, set themaster
property to true:conf = { cluster = { nodes = { "192.168.50.25:9022", "192.168.50.25:9122", }, master = true } }
-
Restart the HAProxy Enterprise service:
$ sudo systemctl restart hapee-2.3-lb
Open the Real-time Dashboard in your browser and click the
button to display the Settings window.
Set Data Source to Real-time Dashboard Module.
Set Data Source Mode to Cluster Aggregation and close the window.
Click the
button to complete setup.
Set HTTP basic authentication
When you enable HTTP basic authentication in the file dashboard-module.cfg, the Real-time Dashboard Lua module's API is restricted to certain users. By default, the configuration defines a user named "dashboard" with the password "test". Change the username and password, and update the Real-time Dashboard's settings to match.
-
Install the whois package with apt or yum to get the
mkpasswd
utility:$ sudo apt install whois
-
Use
mkpasswd
to create an SHA-2 password:$ mkpasswd -m SHA-256
Edit the configuration file /etc/hapee-2.3/dashboard-module.cfg to change the dashboard_users
userlist
section so that it contains oneuser
line to define a username and encrypted password.-
Add the password to the
user
line, and restart the HAProxy Enterprise service:$ sudo systemctl restart hapee-2.3-lb
Open the Real-time Dashboard in your browser and click the
button to display the Settings window. Set the Username and Password values to match.
Enable HTTPS between the Dashboard UI and HAProxy Enterprise
The UI fetches metrics from HAProxy Enterprise. To encrypt this communication, you must enable HTTPS.
Obtain a valid TLS certificate for the node where you are running HAProxy Enterprise. This is the aggregation primary node when you run multiple instances of HAProxy Enterprise.
Save it to /etc/hapee-2.3/certs.
-
Edit the file /etc/hapee-2.3/dashboard-module.cfg to remove the following line from the
listen dashboard
section:bind *:9022
-
Replace it with the following line, changing site.pem to be name of your TLS certificate:
bind *:9023 ssl crt
/etc/hapee-2.3/certs/site.pem -
Restart the HAProxy Enterprise service:
$ sudo systemctl restart hapee-2.3-lb
Open the Real-time Dashboard in your browser and change the address in the header bar to be the hostname that matches the TLS certificate's CN value. Click the padlock icon to turn it green.
Click the
button to complete setup.
Next up
Dashboard Gateway