Web service SLO monitoring in Monium
- Setup steps
- Get your cloud ready
- Set up system metric collection in Linux
- Install and configure blackbox_exporter
- Set up metric delivery to Monium
- Configure a service availability SLO
- Configure error budget alerts
- Configure an SLO for service response time
- Use system metrics for post-alert diagnostics .
- Delete the resources you created
SLO monitoring helps you evaluate service reliability against a target level instead of responding to isolated incidents. In this tutorial, you will set up SLO monitoring for a web service in Monium
An SLO (service level objective) is the target reliability level of your service, e.g., 99.9% of successfully processed requests over a 30-day period. You define SLOs based on your service reliability requirements. Monium uses SLOs to calculate the error budget, which represents the maximum allowed error rate over a certain period. This enables your team to track error budget consumption and proactively address reliability drops.
This guide relies on Prometheus
To collect and deliver metrics, you will need the following components:
- node_exporter
: Collects Linux system metrics. These metrics help you diagnose server health after an SLO alert. - blackbox_exporter
: Performs synthetic HTTP, TCP, and ICMP checks. The obtained metrics are used to calculate SLIs for availability and response time. - OpenTelemetry Collector
(OTel Collector): Collects metrics from node_exporter and blackbox_exporter and sends them to Monium.
In this tutorial, node_exporter is configured to run on your application server (app-server), while blackbox_exporter and OTel Collector run on a dedicated monitoring server (monitoring-server). OTel Collector polls both exporters using Prometheus and sends metrics to Monium. This approach does not require any changes in the application and allows you to host services in a private network.
Note
This guide does not cover the initial deployment of the web service. It assumes your service is already up, running, and network-accessible. Install node_exporter on the application server, and blackbox_exporter and OTel Collector, on the monitoring server. For a simpler architecture, you can install all components on the same server as your web service, eliminating the need for a separate monitoring server.
Setup steps
- Get your cloud ready.
- Set up system metric collection in Linux.
- Install and configure blackbox_exporter.
- Set up metric delivery to Monium.
- Configure a service availability SLO.
- Configure error budget alerts.
- Configure an SLO for service response time.
- Use system metrics for post-alert diagnostics.
If you no longer need the resources you created, delete them.
Get your cloud ready
Sign up for Yandex Cloud and create a billing account:
- Navigate to the management console
and log in to Yandex Cloud or create a new account. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVEorTRIAL_ACTIVEstatus. If you do not have a billing account, create one and link a cloud to it.
If you have an active billing account, you can create or select a folder for your infrastructure on the cloud page
Learn more about clouds and folders here.
Required paid resources
The infrastructure support cost includes:
- Fee for using Monium (see Monium pricing).
- Fee for continuously running VMs if the web service or monitoring server resides in Yandex Cloud (see Yandex Compute Cloud pricing).
Set up your infrastructure
-
Get your web service ready for SLO monitoring. The service can reside in any infrastructure; simply substitute your actual IP address or domain name in the examples. In this guide, the web service runs on an Ubuntu 20.04 Linux VM named
app-serverand is accessible via the internal IP address10.128.0.10. -
Create a monitoring server in Compute Cloud or another infrastructure. This guide uses an Ubuntu 20.04 Linux Compute Cloud VM named
monitoring-server. You will install blackbox_exporter and OTel Collector on this VM to check the web service and deliver metrics to Monium. -
To enable data delivery to Monium, create a service account and API key. You can do this in the Monium UI
: on the left, select Settings → Project settings → Configuring telemetry recording → OpenTelemetry.- Click the Create a service account link. Select the
monium.metrics.writerormonium.telemetry.writerrole. - Click the Create an API key link. Select the
yc.monium.metrics.writeoryc.monium.telemetry.writescope.
Alternatively, use these guides: Creating a service account and Creating an API key.
- Click the Create a service account link. Select the
-
If you are deploying your web service and monitoring server within Yandex Cloud, create a security group for the monitoring server and allow:
- Outgoing TCP traffic on port
443to send metrics to Monium via OTel Collector. - Outgoing traffic to your web service endpoints for blackbox_exporter checks.
- Outgoing TCP traffic on port
Set up system metric collection in Linux
To diagnose incidents, you need data on server state from the exact moment an alert triggers. Install Prometheus node_exporterapp-server VM. It collects CPU, memory, and disk metrics. Then configure OTel Collector to send these metrics to Monium.
Install Prometheus node_exporter
-
Create a system user for node_exporter:
sudo useradd --no-create-home --shell /bin/false node_exporter -
Download and unpack the node_exporter archive:
wget https://github.com/prometheus/node_exporter/releases/download/v1.11.1/node_exporter-1.11.1.linux-amd64.tar.gz tar zxvf node_exporter-1.11.1.linux-amd64.tar.gz -
Install the binary:
sudo install -m 0755 ./node_exporter-1.11.1.linux-amd64/node_exporter /usr/local/bin/node_exporter sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
Create a systemd service for node_exporter
-
Create a file named
/etc/systemd/system/node_exporter.service:[Unit] Description=Prometheus Node Exporter Wants=network-online.target After=network-online.target [Service] User=node_exporter Group=node_exporter Type=simple ExecStart=/usr/local/bin/node_exporter --web.listen-address=<server_private_IP_address>:9100 Restart=on-failure [Install] WantedBy=multi-user.targetWhere
<server_private_IP_address>is the address ofapp-serverin the private network. If OTel Collector is running on the same server, specify127.0.0.1. -
Run node_exporter:
sudo systemctl daemon-reload sudo systemctl enable --now node_exporter -
Make sure the service status has changed to
active (running):sudo systemctl status node_exporterResult:
● node_exporter.service - Prometheus Node Exporter Loaded: loaded (/etc/systemd/system/node_exporter.service; enabled; preset: enabled) Active: active (running) <...> -
Make sure that metrics are available:
curl http://<server_private_IP_address>:9100/metrics
Instead of node_exporter, you can use Unified Agent on the application server. It collects system metrics and sends them directly to Monium, bypassing OTel Collector. In this setup, your metric configuration will be stored across multiple locations. For more information, see Delivering Linux system metrics.
Install and configure blackbox_exporter
Blackbox_exporterprobe_success and probe_duration_seconds metrics, which are used in the availability and response time SLOs.
Install and configure blackbox_exporter
-
Create a system user:
sudo useradd --no-create-home --shell /usr/sbin/nologin blackbox_exporter -
Download and unpack the archive:
wget -O /tmp/blackbox_exporter.tar.gz https://github.com/prometheus/blackbox_exporter/releases/download/v0.28.0/blackbox_exporter-0.28.0.linux-amd64.tar.gz tar -zxvf /tmp/blackbox_exporter.tar.gz sudo install -m 0755 ./blackbox_exporter-0.28.0.linux-amd64/blackbox_exporter /usr/local/bin/blackbox_exporter sudo chown blackbox_exporter:blackbox_exporter /usr/local/bin/blackbox_exporter -
Create a folder for the configuration:
sudo mkdir -p /etc/blackbox_exporter
Configure blackbox_exporter
-
Create a file named
/etc/blackbox_exporter/blackbox.yml:modules: http_2xx: prober: http timeout: 5s http: method: GET valid_http_versions: ["HTTP/1.1", "HTTP/2.0"] preferred_ip_protocol: "ip4" follow_redirects: true fail_if_ssl: false fail_if_not_ssl: false tls_config: insecure_skip_verify: false http_2xx_tls: prober: http timeout: 5s http: method: GET follow_redirects: true fail_if_not_ssl: true preferred_ip_protocol: "ip4" tcp_connect: prober: tcp timeout: 3s icmp: prober: icmp timeout: 2sWhere:
http_2xx: Basic check of HTTP endpoint availability. Check type: HTTP.http_2xx_tls: Check with mandatory TLS enforced viafail_if_not_ssl: true. Check type: HTTP.tcp_connect: TCP port availability check. Check type: TCP.icmp: Network reachability check for the host. Check type: ICMP.
-
Set permissions for the configuration file:
sudo chown -R blackbox_exporter:blackbox_exporter /etc/blackbox_exporter
Create a systemd service for blackbox_exporter
-
Create a file named
/etc/systemd/system/blackbox_exporter.service:[Unit] Description=Prometheus Blackbox Exporter Wants=network-online.target After=network-online.target [Service] User=blackbox_exporter Group=blackbox_exporter Type=simple ExecStart=/usr/local/bin/blackbox_exporter \ --config.file=/etc/blackbox_exporter/blackbox.yml \ --web.listen-address=127.0.0.1:9115 Restart=on-failure [Install] WantedBy=multi-user.target -
Run blackbox_exporter and add it to the auto start:
sudo systemctl daemon-reload sudo systemctl enable --now blackbox_exporter -
Check that the service status is
active (running):sudo systemctl status blackbox_exporterResult:
● blackbox_exporter.service - Prometheus Blackbox Exporter Loaded: loaded (/etc/systemd/system/blackbox_exporter.service; enabled; preset: enabled) Active: active (running) <...>
Test blackbox_exporter
Run the following tests:
curl "http://127.0.0.1:9115/probe?target=http://10.128.0.10&module=http_2xx" | grep probe_success
curl "http://127.0.0.1:9115/probe?target=10.128.0.10:80&module=tcp_connect" | grep probe_success
curl "http://127.0.0.1:9115/probe?target=10.128.0.10&module=icmp" | grep probe_success
Where 10.128.0.10 is your web service IP address.
Result:
probe_success 1
Set up metric delivery to Monium
OTel Collector sends metrics collected by blackbox_exporter and node_exporter to Monium.
Install OTel Collector
-
sudo apt-get update sudo apt-get -y install wget wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.156.0/otelcol_0.156.0_linux_amd64.deb sudo dpkg -i otelcol_0.156.0_linux_amd64.deb -
Edit the
/etc/otelcol/otelcol.conffile:MONIUM_PROJECT=folder__<folder_ID> MONIUM_API_KEY=<API_key> OTELCOL_OPTIONS=--config=/etc/otelcol/config.yamlWhere:
MONIUM_PROJECT: Monium project name, e.g.,folder__b1gg5f45su0k6rjr39s1.MONIUM_API_KEY: API key of the service account with themonium.telemetry.writerrole.
Configure OTel Collector
Create a file named /etc/otelcol/config.yaml:
receivers:
prometheus:
config:
scrape_configs:
- job_name: blackbox_http_10_128_0_10
scrape_interval: 30s
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- http://10.128.0.10
labels:
probe_type: http
target_name: lemp_http
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115
- job_name: blackbox_tcp_10_128_0_10_80
scrape_interval: 30s
metrics_path: /probe
params:
module: [tcp_connect]
static_configs:
- targets:
- 10.128.0.10:80
labels:
probe_type: tcp
target_name: lemp_tcp_80
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115
- job_name: blackbox_icmp_10_128_0_10
scrape_interval: 30s
metrics_path: /probe
params:
module: [icmp]
static_configs:
- targets:
- 10.128.0.10
labels:
probe_type: icmp
target_name: lemp_icmp
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115
- job_name: node_exporter_lemp
scrape_interval: 30s
static_configs:
- targets:
- 10.128.0.10:9100
labels:
exporter: node_exporter
target_name: lemp_node
host: lemp
processors:
batch:
exporters:
otlp/monium:
endpoint: ingest.monium.yandex.cloud:443
compression: zstd
headers:
Authorization: "Api-Key ${env:MONIUM_API_KEY}"
x-monium-project: "${env:MONIUM_PROJECT}"
x-monium-cluster: production
x-monium-service: lemp
service:
telemetry:
logs:
level: info
pipelines:
metrics:
receivers: [prometheus]
processors: [batch]
exporters: [otlp/monium]
Where:
10.128.0.10: Placeholder IP address of your application server. Replace it with the actual one.relabel_configs: Label overwriting rules for Prometheus to poll blackbox_exporter instead of the target.x-monium-clusterandx-monium-service:clusterandservicelabels that Monium assigns to all metrics from this OTel Collector. You will use these labels to find metrics and define your SLOs. The example uses theproductionandlempvalues (Linux, Nginx, MySQL, and PHP stack). Replace these to match your environment.
Note
The probe_type label can have the http, tcp, and icmp values. This label allows you to filter metrics in Monium and define separate SLOs for each check type.
Run OTel Collector
-
Edit the
/etc/systemd/system/multi-user.target.wants/otelcol.servicefile:[Unit] Description=OpenTelemetry Collector After=network.target [Service] EnvironmentFile=/etc/otelcol/otelcol.conf ExecStart=/usr/bin/otelcol $OTELCOL_OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=mixed Restart=on-failure Type=simple User=otel Group=otel [Install] WantedBy=multi-user.target -
Run OTel Collector:
sudo systemctl daemon-reload sudo systemctl enable --now otelcol sudo systemctl status otelcol -
Make sure Monium receives the metrics:
- Open Monium
. - In the left-hand menu, expand Overview and select Metrics.
- In the search field, specify
service = "lemp", which is theservicelabel value from thex-monium-serviceheader in the OTel Collector configuration. If you have set a different value, specify it instead.
The list will show the
probe_successandprobe_duration_secondsmetrics as well as node_exporter metrics. - Open Monium
Note
Keep in mind that data in Monium appears with a lag rather than immediately, since the Otel Collector starts sending data after 60 seconds.
Configure a service availability SLO
Blackbox_exporter returns a binary check result: probe_success equals 1 for a successful check and 0 for a failure. Use this metric to create an availability SLO:
-
On the Monium
home page, expand Alerts and SLOs in the left menu. -
Select
SLO. -
Click Create.
-
Specify the SLO parameters:
- Name: For example,
SLO HTTP Availability 30d. - Evaluation window:
30d. - Evaluation delay:
2m. This value must be greater than your metric collection interval: forscrape_interval: 30s,2mis sufficient. - SLO:
99.9%. - Calculation Method:
Good Events / Total Events.
- Name: For example,
-
Under Good Events, specify the following query:
series_sum( {project = "folder__<folder_ID>", cluster = "production", service = "lemp", probe_type = "http", name = "probe_success"} ) -
Under Total Events, specify the following query:
series_count( {project = "folder__<folder_ID>", cluster = "production", service = "lemp", probe_type = "http", name = "probe_success"} ) -
Click Create.
The error budget is calculated automatically once the SLO is created.
Configure error budget alerts
Create alerts to track your error budget consumption:
- Remaining error budget: Indicates that your service reliability is gradually degrading.
- Error budget consumption rate: Indicates spikes in the number of errors.
Create an alert for remaining error budget
-
On the Monium
home page, expand Alerts and SLOs in the left menu. -
Select
Alerts. -
Click Create alert → SLO.
-
Specify an alert name and level, e.g.,
Critical: remaining error budget indicates gradual degradation. -
Select the SLO you created in the previous step.
-
In the Evaluation method field, select
Error Budget Remaining. -
Set the trigger conditions:
- Warning:
50%. - Alarm:
20%.
- Warning:
-
Click Create.
Create an alert for error budget consumption rate
-
On the Monium
home page, expand Alerts and SLOs in the left menu. -
Select
Alerts. -
Click Create alert → SLO.
-
Specify an alert name and level, e.g.,
Disaster: a high error budget consumption rate indicates an emergency incident. -
Select the SLO you created in the previous step.
-
In the Evaluation method field, select
Error Budget Exhaustion Rate. -
Set the trigger conditions:
- Warning:
1%. - Alarm:
2%. - Evaluation window:
1h.
- Warning:
-
Click Create.
Configure an SLO for service response time
Blackbox_exporter measures the duration of synthetic checks using the probe_duration_seconds metric. Use this metric to create an SLO: 99% of HTTP checks must complete in under 300 ms.
Note
If you need to define an SLO in p95 < 300 ms format, use metrics from your application, ingress controller, or load balancer. Blackbox_exporter checks your service externally and shows degradation across DNS, TLS, network, and load balancers.
The probe_duration_seconds metric shows total check duration but does not isolate where delays occur. Blackbox_exporter breaks down each check into the phases:
| Metric | What is measured |
|---|---|
probe_dns_lookup_time_seconds |
DNS resolution duration |
probe_tcp_connect_duration_seconds |
Time to establish TCP connection |
probe_tls_handshake_duration_seconds |
TLS handshake duration |
probe_http_duration_seconds |
HTTP request phase duration |
probe_duration_seconds |
Total check duration |
To visualize these phases, add these metrics to a dashboard as a stacked area chart. For the SLO and alerts, use the aggregate probe_duration_seconds metric. If latency degrades, the charts will pinpoint exactly where the bottleneck occurred: DNS, TLS, or network routing.
Create a response time SLO
-
On the Monium
home page, expand Alerts and SLOs in the left menu. -
Select
SLO. -
Click Create.
-
Specify the SLO parameters:
- Name: For example,
SLO LATENCY HTTP 30d. - Evaluation window:
30d. - SLO:
99%. - Calculation Method:
Good Events / Total Events.
- Name: For example,
-
Under Good Events, specify the following query:
series_sum( heaviside( ({project="folder__<folder_ID>", cluster="production", service="lemp", probe_type="http", name="probe_duration_seconds"} * -1) + 0.3 ) )Where:
0.3: Latency threshold in seconds, 300 ms.heaviside(): Function that filters checks against the threshold. Returns1if latency is less than 300 ms or0if it is greater.
Checks with a latency of exactly 300 ms evaluate to
0.5, which does not affect the SLI calculation. -
Under Total Events, specify the following query:
series_sum( {project="folder__<folder_ID>", cluster="production", service="lemp", probe_type="http", name="probe_duration_seconds"} * 0 + 1 ) -
Click Create.
Use system metrics for post-alert diagnostics .
When an SLO alert triggers, you must isolate the failure on the server side. Use node_exporter system metrics to quickly identify the root cause:
| Category | Metrics | What to check |
|---|---|---|
| CPU | node_cpu_seconds_total grouped by modes, e.g., iowait, idle, and steal |
steal is especially important for virtualized environments |
| Memory | node_memory_MemAvailable_bytes |
Available memory |
| Disk | node_disk_read_time_seconds_total, node_disk_write_time_seconds_total, node_disk_io_time_weighted_seconds_total |
Read/write latency, I/O queue |
| File systems | node_filesystem_free_bytes, node_filesystem_files_free |
Free space and inodes |
| Network | node_network_receive_bytes_total, node_network_transmit_bytes_total, node_network_receive_drop_total |
Traffic and drops by interfaces |
If an SLO alert has been triggered by probe_duration_seconds, check network phases first: probe_dns_lookup_time_seconds and probe_tls_handshake_duration_seconds. Then review server metrics: node_disk_io_time_weighted_seconds_total and node_cpu_seconds_total{mode="iowait"}.
Delete the resources you created
To stop paying for the resources you created:
- Delete the alerts you created in Monium.
- Delete the Compute Cloud VMs.
- Delete the Identity and Access Management service account.
- Delete the Virtual Private Cloud security group.
If you reserved public static IP addresses, delete them.