Starting and stopping Yandex Unified Agent
Starting
Install Yandex Unified Agent and start it using one of the following methods:
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 start 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 you start a container, delete the following lines from the configuration file:
import:
- /etc/yandex/unified_agent/conf.d/*.yml
Example of container start command with 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.
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.
For more information about agent configuration, see Configuration.
Edit the /etc/yandex/unified_agent/config.yml
configuration file, e.g., by setting up the agent to deliver Linux system metrics. For more information about agent configuration, see Configuration.
To make sure Unified Agent is successfully installed and started, run this command:
systemctl status unified-agent
Result:
● 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
Create a configuration file, e.g., with settings for delivering Linux system metrics. For more information about agent configuration, see Configuration.
To start the agent, run the following command:
./unified_agent --config unified_agent.yml
Once the VM is deployed, Unified Agent will be started automatically and begin delivering basic VM metrics to Yandex Monitoring.
You are responsible for updating and maintaining the agent.
The agent is installed with a default configuration file located at /etc/yc/unified_agent/config.yml
. You can also configure the delivery of custom metrics or logs to Cloud Logging.
The configuration file is set up to send basic virtual machine metrics and agent health metrics. You will be charged for metric delivery.
To start the agent manually, run the following command:
./unified_agent --config unified_agent.yml
Stopping
Stop Unified Agent using one of the following methods:
To create a container, run this command:
sudo docker stop ua
Ubuntu 14.04
To stop the agent, run this command:
sudo service unified-agent stop
To restart the agent, run the following command:
sudo service unified-agent restart
Ubuntu 14.04 or higher
To stop the agent, run this command:
sudo systemctl stop unified-agent
To restart the agent, run the following command:
sudo systemctl
-
Get the
unified_agent
process ID:ps aux | grep unified_agent
-
To stop the process, run this command:
sudo kill <process_ID>
-
Get the
unified_agent
process ID:ps aux | grep unified_agent
-
To stop the process, run this command:
sudo kill <process_ID>
The process of stopping Unified Agent may take some time to complete the delivery of accumulated data. It usually takes two seconds or less.
Parameters for starting 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. |