Collecting 1C:Enterprise Linux cluster metrics
Follow this guide to configure collection of 1C:Enterprise Linux cluster metrics in Prometheus format and their visualization in Yandex Monitoring. In addition to visualization, Monitoring allows you to set up alerts, create hybrid dashboards with metrics from various Yandex Cloud services and offers extensive scaling capabilities.
Cluster metrics will be collected using the freely distributed Prometheus 1C Exporter
To use this tutorial, you need to have a 1C:Enterprise cluster deployed on a Yandex Compute Cloud VM. For a deployment example, see Creating a cluster of 1C:Enterprise Linux servers with a Managed Service for PostgreSQL cluster.
To get started with metrics in Yandex Monitoring:
- Install and configure Prometheus 1C Exporter.
- Install and configure Unified Agent.
- Create a service account and link it to your VM.
- Make sure Monitoring receives the metrics.
- Create a dashboard to monitor metrics.
If you no longer need the resources you created, delete them.
Required paid resources
Fee for sending metrics to Monitoring (see Monitoring pricing).
Install and configure Prometheus 1C Exporter
-
Download Prometheus 1C Exporter to the 1C:Enterprise VM:
wget https://github.com/LazarenkoA/prometheus_1C_exporter/releases/download/v1.5.0/prometheus_1C_exporter-linux-amd64 -
Rename the exporter and move it to the system folder:
mv prometheus_1C_exporter-linux-amd64 exporter_1C sudo mv exporter_1C /usr/local/bin/exporter_1C -
Make the file executable:
sudo chmod +x /usr/local/bin/exporter_1C -
Create a configuration file for the exporter:
sudo mkdir /etc/exporter_1C/ sudo vi /etc/exporter_1C/settings.yaml -
Add the configuration below to the
settings.yamlfile and, if necessary, customize the list of metrics to collect.Exporter’s configuration in settings.yaml
# Metric values you can collect using the exporter: # ClientLic: Client licenses. # AvailablePerformance: Available performance (via RAC). # ScheduleJob: Checking the `Block scheduled jobs` option. # Session: Sessions. # Connect: Connections. # SessionsData: Various indicators from the 1C console (via RAC). # ProcData: Process data (collects Linux OS metrics). # CPU: Processor utilization. # disk: Disk metrics (currently only Linux and WeightedIO are supported). # Property: Additional parameters specific to each metric. # Processes: Additional ProcData parameter which defines the list of processes to monitor. # You can enable or disable any set of metrics for monitoring. Exporters: - Name: client_lic - Name: available_performance # - Name: processes # - Name: cpu # - Name: disk # - Name: shedule_job # - Name: session - Name: connect # - Name: sessions_data # HTTP service that returns a JSON array with database access parameters. # Required for the ScheduleJob metric. # JSON example: #[ # { # "Name": "hrmcorp-n17", # 1C database name # "UserName": "", # "UserPass": "" # } #] #DBCredentials: # This is a required parameter for the shedule_job metric. # Address used by 1C to return a list of databases in JSON format: # URL: http://ca-fr-web-1/fresh/int/sm/hs/PTG_SysExchange/GetDatabase # User: "" # Password: "" # TLSSkipVerify: true # true: Ignore certificate verification errors when accessing the service. RAC: Path: "/usr/local/bin/rac" Port: "1545" # This is an optional parameter. Host: "localhost" # This is an optional parameter. Login: "" # This is an optional parameter. Pass: "" # This is an optional parameter. LogDir: # If the folder is not specified, logs will be written to the folder with the exporter’s executable file. LogLevel: 5 # Logging level: 2 (error), 3 (warning), 4 (information), 5 (debugging).This configuration enables sending the following metrics:
available_performance: Host’s available performance (Histogram).client_lic: 1C client licenses (Histogram).connect: 1C connections (Histogram).
You can add other metrics
if required. -
Create a symbolic link for the 1C RAC management utility:
sudo ln -s /opt/<1C_installation_path>/rac /usr/local/bin/rac -
Create a unit file for systemd to manage the exporter:
sudo vi /etc/systemd/system/exporter_1C.serviceContents of the exporter_1C.service file
[Unit] Description=Prometheus 1C exporter After=local-fs.target network-online.target network.target Wants=local-fs.target network-online.target network.target [Service] Type=simple ExecStart=/usr/local/bin/exporter_1C -port=9095 --settings=/etc/exporter_1C/settings.yaml ExecReload=/bin/kill -s HUP $MAINPID [Install] WantedBy=multi-user.targetThis configuration starts the exporter after the OS and network boot up. The exporter starts listening to port
9095according to the parameters insettings.yaml. -
Start the exporter:
sudo systemctl daemon-reload sudo systemctl start exporter_1C.service sudo systemctl enable exporter_1C.service -
Check the exporter status and make sure the service is
active (running).sudo systemctl status exporter_1C.service
After you start the exporter, metrics will be available at curl http://localhost:9095/metrics. To work with metrics in Yandex Monitoring, you need to install Unified Agent and configure it to receive metrics from this address and send them to Monitoring.
Create a service account and link it to your VM
You need a service account to send metrics from the VM to Monitoring.
- Create a service account named
sa-1c-monitoringin the folder you want to write metrics to. - Assign the
monitoring.editorrole to the service account. - Link the service account to the VM where 1C:Enterprise is installed.
Install and configure Unified Agent
-
Download the latest deb package:
ubuntu_name="<OS_version>" ua_version=$(curl --silent https://storage.yandexcloud.net/yc-unified-agent/latest-version) bash -c 'curl --silent --remote-name https://storage.yandexcloud.net/yc-unified-agent/releases/${ua_version}/deb/${ubuntu_name}/yandex-unified-agent_${ua_version}_amd64.deb' -
Check the deb package version using the
lscommand. -
Install Unified Agent from the deb package by specifying its version:
sudo dpkg -i yandex-unified-agent_<agent_version>_amd64.debYou can find other installation methods in Installing and updating Yandex Unified Agent.
-
Check that Unified Agent is running:
sudo systemctl status unified-agent.service -
Open the Unified Agent configuration file:
sudo vi /etc/yandex/unified_agent/config.yml -
Replace the file contents with the configuration below. Add the ID of the folder you want to send metrics to.
Unified Agent configuration in config.yml
monitoring: port: 16300 status: port: 16301 channels: - name: yc_metrics_channel channel: output: plugin: yc_metrics config: folder_id: "<folder_ID>" iam: cloud_meta: {} - name: monitoring_1c channel: output: plugin: yc_metrics config: folder_id: "<folder_ID>" iam: cloud_meta: {} routes: - input: id: linux_metrics_input plugin: linux_metrics config: poll_period: 15s channel: channel_ref: name: yc_metrics_channel - input: plugin: metrics_pull config: url: http://localhost:9095/metrics format: prometheus: {} namespace: app1c channel: pipe: - filter: plugin: transform_metric_label config: label: cluster rename_to: cluster_1c - filter: plugin: transform_metric_labels config: labels: - servicename: "-" - filter: plugin: transform_metric_labels config: labels: - user: "-" - filter: plugin: transform_metric_labels config: labels: - base: "-" - filter: plugin: transform_metric_labels config: labels: - licSRV: "-" channel_ref: name: monitoring_1c import: - /etc/yandex/unified_agent/conf.d/*.ymlThis configuration sets the
app1c_prefix for metrics from the/metricsendpoint. You can use any prefix.Yandex Monitoring has restrictions on labels and their values:
- Label name must not be empty.
- Label name and metric value may only contain Latin letters.
- You cannot use the
clusterlabel.
To comply with these restrictions, the Unified Agent configuration file instructs to:
- Rename the
clusterlabel tocluster_1c. - Filter (remove) labels containing non-Latin characters:
servicename,user,base, andlicSRV.
To learn more about configuring Unified Agent, see Configuration.
-
Make sure the configuration file is correct. The command should output the contents of the file:
unified_agent check-config -c /etc/yandex/unified_agent/config.yml -
Restart Unified Agent to apply the updated configuration:
sudo systemctl restart unified-agent.service -
Check the Unified Agent status:
sudo systemctl status unified-agent.service
Make sure Monitoring receives the metrics
-
On the Monitoring home page
, select Metrics in the left-hand panel. -
In the query string, specify the following:
- Folder for storing collected metrics.
servicelabel value:custom.namelabel value prefixed withapp1c_, e.g.,app1c_available_performance.hostlabel value: Name of the 1C:Enterprise cluster VM.
-
Click Execute query.
Create a dashboard to monitor metrics
Below is an example of a dashboard for monitoring metrics provided in the exporter configuration.
-
On the Monitoring home page
, click Create dashboard. -
At the top right, click
and select Graph. -
Switch the query string to text mode. To do this, click
to the right of the string. Text mode makes it easier to add pre-written queries. -
Specify the query for available host performance:
"app1c.available_performance"{folderId = "<folder_ID>", service = "custom", quantile = "0.99", type = "available", host = "<1C_VM_name>"} -
Click
Save at the top right. -
Add the following charts to the dashboard in the same way:
-
Use of client licenses:
"app1c.client_lic"{folderId = "<your-folder-id>", service = "custom", quantile = "0.99", host = "<1C_VM_name>"} -
Connections:
"app1c.connect"{folderId = "<your-folder-id>", service = "custom", quantile = "0.99"}
-
For additional dashboard settings, see Adding a widget to a dashboard.
Delete the resources you created
Stop reading and writing metrics by doing one of the following:
- Stop Unified Agent.
- In the Unified Agent configuration file, remove the settings for collecting and sending metrics.
- Delete Unified Agent.