Load balancer monitoring
For cloud load balancers, you can customize monitoring — collect and export OpenStack Octavia metrics in Prometheus format and connect Grafana to track metrics on dashboards.
To see a list of available metrics, see the Octavia Metrics table in Prometheus.
Set up monitoring
We do not recommend configuring monitoring during the peak load period of your infrastructure. When traffic on the load balancer increases, the frequency of metrics requests increases — this affects the performance of the load balancer instances.
- Optional: Select a method to restrict access to the balancer.
- Create a load balancer rule.
- Create a cloud server for Prometheus and Grafana.
- Install Prometheus on a cloud server and set up metrics collection.
- Install Grafana on the cloud server and log in to Grafana.
- Create a dashboard in Grafana.
1. Optional: choose how to restrict access to the balancer
Balancer metrics will be accessible from the Internet by IP address and port without authentication if:
- The balancer is on a private network and has a public IP address connected to it;
- or the balancer is on a public subnet.
You can restrict access to the balancer from the Internet. The available method of restricting access depends on how the balancer is connected to the Internet.
For a load balancer with a public IP address and for a load balancer on a public subnet, you can specify the allowed IP addresses from which the load balancer will accept traffic when creating a load balancer rule. The load balancer network must have port security enabled.
For a balancer with a public IP address, you can also restrict access through a cloud firewall.
2. Create a load balancer rule
Control panel
OpenStack CLI
-
If you chose a cloud firewall to restrict access to the balancer, create a firewall and go to step 3.
-
If you chose to specify allowed IP addresses in a balancer rule to restrict access to the balancer, make sure that port security is enabled on the balancer network.
2.2 Check the network traffic filtering status —
port_security_enabled
field in the command output:openstack network show
2.3 If the
port_security_enabled
field istrue
— filtering is enabled. Go to step 3.2.4 If the
port_security_enabled
field isfalse
, filtering is disabled. Enable filtering and go to step 3. -
In the dashboard, on the top menu, click Products and select Cloud Servers.
-
Go to Balancers → Balancers tab.
-
Open the balancer page.
-
Click Create Rule.
-
In the Traffic reception protocol field, select the Prometheus option.
-
Optional: change the balancer port that Prometheus will access to receive metrics. The default port is 8088.
-
If you have selected allowed IP addresses to restrict access to the balancer — specify the IP address of the cloud server where Prometheus will be installed as the allowed CIDR.
-
Optional: change the connection settings for incoming requests to the balancer, to do this open the Advanced Rule Settings block and specify the connection timeout and maximum connections.
-
Click Create.
-
If you chose a cloud firewall to restrict access to the balancer, create a firewall and go to step 3.
-
If you chose to specify allowed IP addresses in a balancer rule to restrict access to the balancer, make sure that port security is enabled on the balancer network.
2.2 Check the network traffic filtering status —
port_security_enabled
field in the command output:openstack network show
2.3 If the
port_security_enabled
field istrue
— filtering is enabled. Go to step 3.2.4 If the
port_security_enabled
field isfalse
, filtering is disabled. Enable filtering and go to step 3. -
Create a rule for the balancer with the PROMETHEUS protocol and port 8088:
openstack loadbalancer listener create \
--name <listener_name> \
--protocol PROMETHEUS \
--protocol-port 8088 \
[--allowed-cidr <allowed_cidr>] \
<loadbalancer>Specify:
<listener_name>
— rule name;- optional:
--allowed-cidr <allowed_cidr>
— if you have selected allowed IP addresses to restrict access to the balancer . Parameter<allowed_cidr>
— IP address of the cloud server where Prometheus will be installed; <loadbalancer>
— The ID or name of the load balancer can be viewed with the commandopenstack loadbalancer list
.
-
To view the load balancer metrics in text format, open the page in your browser:
http://<loadbalancer_ip_address>:8088
Specify
<loadbalancer_ip_address>
— private or public IP address of the load balancer. You can view it in the control panel: in the top menu, click Products → Cloud Servers → Balancers → Balancers tab → Load Balancer page.
2. Create a cloud server for Prometheus and Grafana
Prometheus and Grafana need to be installed and configured on a cloud server that is on the same private subnet as the load balancer.
Use the instructions to Create a cloud server.
Select:
- source — any ready-made Ubuntu image, for example
Ubuntu 22.04 LTS 64-bit
; - configuration — any configuration (fixed or arbitrary) with vCPU from 2, RAM from 4 GB and boot disk size from 10 GB;
- network — a private subnet with a public IP address to which the load balancer is connected.
3. Install Prometheus on a cloud server and configure metrics collection
-
Connect to the cloud server that you created you created earlier.
-
Download and install Prometheus:
sudo apt update
wget https://github.com/prometheus/prometheus/releases/download/v2.45.1/prometheus-2.45.1.linux-amd64.tar.gz
tar xvf prometheus-2.45.1.linux-amd64.tar.gz
cd prometheus-2.45.1.linux-amd64 -
Open the
prometheus.yml
configuration file:nano prometheus.yml
-
Change the value of
targets
in thescrape_configs
block:Block example:
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["<loadbalancer_private_ip_address>:8088"]Specify
<loadbalancer_private_ip_address>
— private IP address of the load balancer. You can view it in the control panel: in the top menu, click Products → Cloud Servers → Balancers → Balancers tab → Load Balancer page. -
Run Prometheus locally:
sudo apt install screen
screen -dm ./prometheus --config.file=./prometheus.yml --web.listen-address=localhost:9090
4. Install Grafana on the cloud server and log in to Grafana
-
Connect to the cloud server that you created you created earlier.
-
Install the fontconfig library, which is required to work with Grafana:
sudo apt install -y libfontconfig1
-
Download and install Grafana:
cd ~
wget https://dl.grafana.com/oss/release/grafana_9.1.0_amd64.deb
sudo dpkg -i grafana_9.1.0_amd64.deb -
Open the page in your browser:
http://<server_ip_address>:3000/login
Specify
<server_ip_address>
— the public IP address of the cloud server. You can copy in the control panel in the top menu click Products → Cloud Servers → Server page → Ports tab → in the port card click next to the public IP address. -
Authorize Grafana. For the first authorization, use:
admin;
- password is
admin
.
-
Grafana will prompt you to change your password. Enter the new password.
-
Click Submit.
5. Create a dashboard in Grafana
There is a ready-made dashboard for collecting Octavia metrics. Read more on the OpenStack Octavia Amphora Load Balancer page on the official Grafana website.
- Add a Data Source to Grafana. To do this, go to Configuration → Data sources.
- Click Add data source.
- Select the Prometheus data source type.
- In the URL field, type
http://localhost:9090
. - Click Save & test.
- Add a ready-made dashboard for Octavia metrics. To do this, go to Control panels → + Import.
- In the Import via grafana.com field, enter
15828
. - Press Load.
- In the Prometheus field, select the Prometheus data source you created in step 5.
- Click Import.
- Make sure that the dashboard has been created. To do this, go to Control panels → Browse.
- Open the OpenStack Octavia Amphora Load Balancer dashboard page.
Octavia metrics in Prometheus format
Metrics are collected for all load balancer components:
octavia_loadbalancer
,octavia_memory_pool
— load balancer metrics;octavia_listener
— rule metrics. Collected for each rule separately, differentiated by ID;octavia_pool
— metrics of the target group. Collected for each target group separately, differentiated by ID;octavia_member
— server metrics. Collected for each server separately, differentiated by ID.
Learn more about the balancer components and the OpenStack Octavia model in the How the balancer works subsection.
Balancer Metrics
Metrics rules
Target group metrics
Server metrics