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.
- 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 configure 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, while creating a balancer's rule. The balancer's network must be switched on traffic filtering (port security).
For a balancer with a public IP address, you can also restrict access via the cloud firewall.
2. Create a load balancer rule
Control panel
OpenStack CLI
-
If you want to restrict access to the balancer by chosen cloud firewall, create a firewall and go to step 3.
-
If you want to restrict access to the balancer by chosen specify allowed IP addresses in the balancer rule — make sure that the balancer network is enabled. traffic filtering (port security).
2.1. Open the OpenStack CLI.
2.2 Check the status of traffic filtering in the network — field
port_security_enabled
in the output of the command:openstack network show
2.3 If the field
port_security_enabled
significancetrue
— filtering is enabled. Go to step 3.2.4 If the field
port_security_enabled
significancefalse
— filtering off. Enable filtering and go to step 3. -
in control panels from the top menu, press Products and select Cloud servers.
-
Go to the section Balancers → tab Balancers.
-
Open the 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.
-
If you want to restrict access to the balancer by chosen allowed IP addresses — specify the IP address of the cloud server where Prometheus will be installed as the allowed CIDR.
-
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 you want to restrict access to the balancer by chosen cloud firewall, create a firewall and go to step 3.
-
If you want to restrict access to the balancer by chosen specify allowed IP addresses in the balancer rule — make sure that the balancer network is enabled. traffic filtering (port security).
2.1. Open the OpenStack CLI.
2.2 Check the status of traffic filtering in the network — field
port_security_enabled
in the output of the command:openstack network show
2.3 If the field
port_security_enabled
significancetrue
— filtering is enabled. Go to step 3.2.4 If the field
port_security_enabled
significancefalse
— filtering off. 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>
— NAME OF RULE;- optional:
--allowed-cidr <allowed_cidr>
— If to restrict access to the balancer you chosen allowed IP addresses. Parameter<allowed_cidr>
— IP address of the cloud server where Prometheus will be installed; <loadbalancer>
— 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>
— the private or public IP address of the load balancer. You can look in control panels: from the top menu, press Products → Cloud servers → Balancers → tab Balancers → 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 Create a cloud server.
Select:
- source — any ready-made Ubuntu image, e.g.
Ubuntu 22.04 LTS 64-bit
; - configuration — any configuration (fixed or custom) 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 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
en blocscrape_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: from the top menu, press Products → Cloud servers → 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
4. 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: from the top menu, press Products → Cloud 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.
5. 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