Installing and running Yandex Unified Agent
List of supported operating systems
Unified Agent is supported by the following operating systems:
- Ubuntu 14.04 or higher (it can be installed using any method)
- Debian 9 or higher (Docker image, deb package, or binary file)
- CentOS 7 or higher (Docker image)
- Fedora 32 or higher (Docker image)
- Fedora CoreOS (Docker image)
Before you begin installation
Prior to installing Yandex Unified Agent, follow these steps:
-
Create a VM in Yandex Cloud or a host outside Yandex Cloud on one of the supported operating systems, for example, Ubuntu 14.04 or older.
-
(Optional) Install Docker
if you want to use Docker to run Unified Agent. Docker is pre-installed in Fedora CoreOS.- Set up a public IPv4 address (recommended).
- Configure Docker to work with IPv6
and enable network address translation if you cannot use a public IPv4 address.
-
Create a service account in the folder you want to write metrics to and assign it the
monitoring.editor
role. -
Set up agent authorization in the Yandex Monitoring API:
- If the agent is installed on a VM in Yandex Cloud, link the service account you created to the VM. In that case, the agent will automatically receive the service account IAM token from the metadata service.
- If the agent is installed on a host outside Yandex Cloud, create an authorized key for service accounts. For more information about delivering metrics from hosts outside Yandex Cloud, see Delivering metrics from hosts outside Yandex Cloud.
Installation
Install Unified Agent using one of the following methods:
Unified Agent is distributed as a Docker image. The image is published in the cr.yandex/yc
repository with the unified_agent
name and the latest
tag. The image includes a binary file with the agent and a configuration file used to set up the agent for Linux system metric delivery in Yandex Monitoring.
Warning
To monitor secondary disks attached to the host, specify the paths to their mount points using the -v
parameter of the docker run
command. For more information, see linux_metrics input.
The agent's configuration file is located at /etc/yandex/unified_agent/config.yml
and parameterized by environment variables. For more information about starting a Docker container, see below.
To start a container with the agent, run the following command:
sudo docker run \
-p 16241:16241 -it --detach --uts=host \
--name=ua \
-v /proc:/ua_proc \
-e PROC_DIRECTORY=/ua_proc \
-e FOLDER_ID=a1bs81qpemb4******** \
cr.yandex/yc/unified-agent
Where FOLDER_ID
is the ID of the folder to write metrics to.
To launch a container with its own configuration file, add the -v
parameter to the container start command and specify the full path to the configuration file. Before running a container, delete the following lines from the configuration file:
import:
- /etc/yandex/unified_agent/conf.d/*.yml
Sample run container command using a custom configuration file:
docker run \
-p 16241:16241 -it --detach --uts=host \
--name=ua \
-v /proc:/ua_proc \
-v `pwd`/config.yml:/etc/yandex/unified_agent/conf.d/config.yml \
--entrypoint="" \
-e PROC_DIRECTORY=/ua_proc \
-e FOLDER_ID=a1bs81qpemb4******** \
cr.yandex/yc/unified-agent
By default, the status section of the agent's configuration file specifies host: null
. Please keep this in mind if you are using your own configuration file.
For more information about agent configuration, see Configuration.
Unified Agent is distributed as a deb package for Ubuntu 14.04 or higher. The package contains a binary file with the agent and an empty configuration file located at /etc/yandex/unified_agent/config.yml
.
To install Unified Agent:
-
Download the latest deb package:
ubuntu_name="ubuntu-22.04-jammy" 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'
For
ubuntu_name
, specify the OS version:ubuntu-14.04-trusty
ubuntu-16.04-xenial
ubuntu-18.04-bionic
ubuntu-20.04-focal
ubuntu-22.04-jammy
, starting with version23.03.02
You can also download a specific Unified Agent version. To do this, view all available versions and specify the required one instead of the
latest-version
value:curl --silent https://storage.yandexcloud.net/yc-unified-agent/all-versions
-
Check the version of the deb package using the
ls
command. -
Install the deb package:
sudo dpkg -i yandex-unified-agent_24.09.03_amd64.deb
To make sure Unified Agent is successfully installed and running, run the systemctl status unified-agent
command. Command output example:
user@my-vm:~$ systemctl status unified-agent
● unified-agent.service - Yandex Unified Agent service
Loaded: loaded (/lib/systemd/system/unified-agent.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2021-02-09 15:57:08 UTC; 2 weeks 2 days ago
Main PID: 141403 (unified_agent)
Tasks: 8 (limit: 507)
Memory: 9.4M
CGroup: /system.slice/unified-agent.service
└─141403 /usr/bin/unified_agent --config /etc/yandex/unified_agent/config.yml --log-priority NOTICE
After installing the package, edit the /etc/yandex/unified_agent/config.yml
configuration file, e.g., by setting up the agent for delivering Linux system metrics. For more information about agent configuration, see Configuration.
Unified Agent is distributed as a binary file built for the x86-64/amd64 architecture for Ubuntu 14.04 or higher.
To download the latest version of the agent's binary file, run:
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/unified_agent && chmod +x ./unified_agent'
To find out all the available versions of the agent, run this command:
curl --silent https://storage.yandexcloud.net/yc-unified-agent/all-versions
Download the agent's executable file and then create a configuration file, for example, with the settings for delivering Linux system metrics. For more information about agent configuration, see Configuration.
To run the agent, run the following command:
./unified_agent --config unified_agent.yml
Where --config
is the configuration file path.
You can install Unified Agent when creating a VM through the management console, CLI, API, or Terraform.
To install the agent from the management console
To install the agent via the CLI or API, provide the following string in the user metadata (user-data
):
#cloud-config\nruncmd:\n - wget -O - https://monitoring.api.cloud.yandex.net/monitoring/v2/unifiedAgent/config/install.sh | bash
To install the agent using Terraform, add this metadata to the configuration file:
resource "yandex_compute_instance" "this" {
...
resources {
...
}
...
metadata = {
ssh-keys = "<username>:<SSH_key_contents>",
"install-unified-agent": "1"
}
}
To install the agent and send metrics, make sure the VM has access to the internet.
The agent is installed with a default configuration file located at /etc/yandex/unified_agent/config.yml
.
The configuration file is set up to send basic virtual machine metrics and agent health metrics. You will be charged for metric delivery.
You can also configure the delivery of custom metrics or logs to Cloud Logging.
Once the VM is deployed, Unified Agent will run automatically and begin providing basic VM metrics to Yandex Monitoring.
You are responsible for updating and maintaining the agent.
Parameters for running a Docker container with Unified Agent
If you install Unified Agent using Docker, you can configure the agent using environment variables. In that case, you will not need to edit the configuration file located at /etc/yandex/unified_agent/config.yml
. The environment variables are listed in the table below.
Environment variable | Default value | Description |
---|---|---|
UA_STATUS_PORT |
16241 |
Port where the agent status will be available. |
UA_LOG_PRIORITY |
NOTICE |
Agent's logging level. |
FOLDER_ID |
No | ID of the folder to write metrics to (a required parameter). |
PROC_DIRECTORY |
/proc |
Directory with mounted procfs |
SYS_DIRECTORY |
/sys |
Directory with mounted sysfs |
UA_LINUX_RESOURCE_CPU UA_LINUX_RESOURCE_MEMORY UA_LINUX_RESOURCE_NETWORK UA_LINUX_RESOURCE_STORAGE UA_LINUX_RESOURCE_IO UA_LINUX_RESOURCE_KERNEL |
basic |
Level of detail of system metrics: CPU, network, disks, I/O system, and Linux kernel. |