Cloud load balancer monitoring
For cloud load balancers, you can set up monitoring — collect and export OpenStack Octavia metrics in Prometheus format and connect Grafana to track metrics on dashboards.
To see the list of available metrics, see the table Octavia metrics in Prometheus format.
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.
- Create a load balancer rule.
- Create a cloud server for Prometheus and Grafana.
- Install Prometheus on a cloud server and configure metrics collection.
- Install Grafana on the cloud server and log in to Grafana.
- Create a dashboard in Grafana.
Create a load balancer rule
After creating a rule with the PROMETHEUS protocol. the cloud load balancer metrics will be accessible from the Internet by IP address and port without authentication if:
- The load balancer is on a private subnet and has a public IP address connected to it;
- or the load balancer is on a public subnet.
Control panel
OpenStack CLI
-
If the load balancer is on a private subnet and a public IP address is connected to it, create a cloud firewall.
If the balancer is on a public subnet, you cannot close access to metrics.
-
In control panels go to Cloud platform → Balancers.
-
Open the tab Balancers → balancer page.
-
Click Create a rule.
-
In the field Traffic reception protocol select an optionPrometheus.
-
Optional: change the balancer port that Prometheus will access to receive metrics. The default port is 8088.
-
Optional: change connection settings for incoming requests to the balancer, to do this, open the block Advanced rule settings and specify the connection timeout and maximum connections.
-
Click Create.
-
If the load balancer is on a private subnet and a public IP address is connected to it, create a cloud firewall.
If the balancer is on a public subnet, you cannot close access to metrics.
-
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 \
<loadbalancer>Specify:
<listener_name>
— NAME OF RULE;<loadbalancer>
— ID or name of the load balancer, can be viewed viaopenstack 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>
— the private or public IP address of the load balancer. You can look in control panels under Cloud platform → Balancers → tab Balancers → load balancer page.
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 Create a cloud server.
Select:
- source — any ready-made Ubuntu image, e.g.
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.
Install Prometheus on a cloud server and configure metrics collection
-
Connect to the cloud server that you established Previously.
-
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 configuration file
prometheus.yml
:nano prometheus.yml
-
Change the value
targets
in the blockscrape_configs
: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 look in control panels under Cloud platform → Balancers → tab Balancers → load balancer page. -
Run Prometheus locally:
sudo apt install screen
screen -dm ./prometheus --config.file=./prometheus.yml --web.listen-address=localhost:9090
Install Grafana on the cloud server and log in to Grafana
-
Connect to the cloud server that you established Previously.
-
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 look in control panels under Cloud platform → Servers → server page → tab Ports → column Public IP. -
Authorize Grafana. For the first authorization, use:
- login —
admin
; - the password is.
admin
.
- login —
-
Grafana will prompt you to change your password. Enter the new password.
-
Click Submit.
Create a dashboard in Grafana
There is a ready-made dashboard for collecting Octavia metrics. Read more on the page OpenStack Octavia Amphora Load Balancer on Grafana's official website.
- Add a Data Source to Grafana. To do this, go to Configuration → Data sources.
- Click Add data source.
- Select the type of data source Prometheus.
- In the field URL enter
http://localhost:9090
. - Click Save & test.
- Add a ready-made dashboard for Octavia metrics. To do this, go to the section Dashboards → + Import.
- In the field Import via grafana.com enter
15828
. - Click Load.
- In the field Prometheus select the Prometheus data source you created in step 5.
- Click Import.
- Make sure that the dashboard is created. To do this, go to Dashboards → Browse.
- Open the dashboard page OpenStack Octavia Amphora Load Balancer.
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
— target group metrics. Collected for each target group separately, differentiated by ID;octavia_member
— server metrics. Collected for each server separately, differentiated by ID.
Read more about the balancer components and the OpenStack Octavia model in subsection How the balancer works.
Balancer Metrics
Metrics rules
Target group metrics
Server metrics