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.
You can view the list of available metrics in the table Octavia metrics in Prometheus format.
Set up monitoring
We do not recommend setting up monitoring during periods of maximum infrastructure load. As traffic on the load balancer increases, the frequency of metric requests rises, which affects the performance of load balancer instances.
- Optional: select a method to restrict access to the load balancer.
- Create a load balancer rule.
- Create a cloud server for Prometheus and Grafana.
- Install Prometheus on the cloud server and set up metric collection.
- Install Grafana on the cloud server and log in to Grafana.
- Create a dashboard in Grafana.
1. Optional: select a method to restrict access to the load balancer
Load balancer metrics will be accessible from the internet via an IP address and port without authentication if:
- the load balancer is in a private network and has a public IP address connected;
- or the load balancer is in a public subnet.
You can restrict access to the load balancer from the internet. The available restriction method depends on how the load balancer is connected to the internet.
For a load balancer with a public IP address and for a load balancer in a public subnet, you can specify allowed IP addresses from which the load balancer will accept traffic when creating a load balancer rule. The load balancer network must have enabled traffic filtering (port security).
For a load balancer with a public IP address, you can also restrict access via a cloud firewall.
2. Create a load balancer rule
Control Panel
OpenStack CLI
-
If you selected a cloud firewall to restrict access to the load balancer, create a firewall and proceed to step 3.
-
If you selected specifying allowed IP addresses in the load balancer rule to restrict access to the load balancer, make sure that the load balancer network has enabled traffic filtering (port security).
2.1. Open the OpenStack CLI.
2.2. Check the traffic filtering status in the network — the
port_security_enabledfield in the command output:openstack network show2.3. If the value in the
port_security_enabledfield istrue, filtering is enabled. Proceed to step 3.2.4. If the value in the
port_security_enabledfield isfalse, filtering is disabled. Create a new private network or public subnet and create a load balancer in it again. -
In the Control panel, from the top menu, click Products and select Cloud Servers.
-
Go to the Load Balancers section → tab Load Balancers.
-
Open the load balancer page.
-
Click Create rule.
-
In the Traffic ingress protocol field, select Prometheus.
-
Optional: change the load balancer port that Prometheus will query to retrieve metrics. Port 8088 is assigned by default.
-
If you selected allowed IP addresses to restrict access to the load 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 load balancer; to do this, open the Advanced rule settings block and specify the connection timeout and maximum connections.
-
Click Create.
2. Create a cloud server for Prometheus and Grafana
Prometheus and Grafana must be installed and configured on a cloud server located in the same private subnet as the load balancer.
Use the Create a cloud server instructions.
Select:
- source — any pre-built image with Ubuntu, for example
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;
- internet — access type with a public floating IP address;
- private network — a private subnet to which a load balancer is connected.
3. Install Prometheus on a cloud server and configure metric collection
-
Connect to the cloud server that you created earlier.
-
Download and install Prometheus:
sudo apt updatewget https://github.com/prometheus/prometheus/releases/download/v2.45.1/prometheus-2.45.1.linux-amd64.tar.gztar xvf prometheus-2.45.1.linux-amd64.tar.gzcd prometheus-2.45.1.linux-amd64 -
Open the
prometheus.ymlconfiguration file:nano prometheus.yml -
Change the
targetsvalue in thescrape_configsblock:Example block:
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: from the top menu, click Products → Cloud Servers → Load Balancers → the Load Balancers tab → load balancer page. -
Start Prometheus locally:
sudo apt install screenscreen -dm ./prometheus --config.file=./prometheus.yml --web.listen-address=localhost:9090
4. Install Grafana on a cloud server and log in to Grafana
-
Connect to the cloud server that you created earlier.
-
Install the fontconfig library, which is required to use Grafana:
sudo apt install -y libfontconfig1 -
Download and install Grafana:
cd ~wget https://dl.grafana.com/oss/release/grafana_9.1.0_amd64.debsudo dpkg -i grafana_9.1.0_amd64.deb -
Open the following page in your browser:
http://<server_ip_address>:3000/loginSpecify
<server_ip_address>— public IP address of the cloud server. You can copy it in the Control panel: from the top menu, click Products → Cloud Servers → server page → Ports tab → in the port card, click next to the public IP address. -
Log in to Grafana. Use the following credentials for your first login:
- login —
admin; - password —
admin.
- login —
-
Grafana will prompt you to change your password. Enter a new password.
-
Click Submit.
5. Create a dashboard in Grafana
There is a pre-built dashboard for collecting Octavia metrics. For more information, see 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 data source type Prometheus.
- In the URL field, enter
http://localhost:9090. - Click Save & test.
- Add a pre-built dashboard for Octavia metrics. To do this, go to Dashboards → + Import.
- In the Import via grafana.com field, enter
15828. - Click 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 Dashboards → 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, distinguished by ID;octavia_pool— pool metrics. Collected for each pool separately, distinguished by ID;octavia_member— member metrics. Collected for each server separately, distinguished by ID.
For more information about load balancer components and the OpenStack Octavia model, see the How load balancers work section.
Load balancer metrics
Rule metrics
Target group metrics
Server metrics