setting up yandex unified agent

collecting additional metrics

requirements

check that the endpoint is reachable

nmap -p 443 monitoring.api.cloud.yandex.net
curl -I https://monitoring.api.cloud.yandex.net/monitoring/v2/

install

lsb_release -a

ubuntu_name=ubuntu-22.04-jammy

# https://storage.yandexcloud.net/yc-unified-agent/all-versions
ua_version=`curl -s https://storage.yandexcloud.net/yc-unified-agent/latest-version`
echo $ua_version

wget "https://storage.yandexcloud.net/yc-unified-agent/releases/$ua_version/deb/$ubuntu_name/yandex-unified-agent_${ua_version}_amd64.deb"

dpkg -i yandex-unified-agent_24.07.02_amd64.deb
apt-get -f install

grep unified /etc/passwd
grep unified /etc/group

systemctl status unified-agent.service

setup

cd /etc/yandex/unified_agent/
cp -pi config.yml config.yml.dist
rm -rf conf.d/
vi config.yml
monitoring:
  port: 16300

status:
  port: 16301

routes:
  - input:
      plugin: linux_metrics
      config:
        poll_period: 5s
        proc_directory: "/proc"
        sys_directory: "/sys"
        resources:
          cpu: basic      # need cpu_total for load averages
          memory: basic   # ram usage
          network: null
          storage: basic  # disk usage
          io: null
          kernel: basic   # load averages
        namespace: sys

    channel:
      pipe:
          - filter:
              plugin: filter_metrics
              config:
                match: "{name=*memory*MemAvailable|*memory*MemTotal|*memory*SwapTotal|*memory*SwapFree|*proc*LoadAverage*min|*cpu*CpuCores|*filesystem*}"

          - filter:
              plugin: transform_metric_labels
              config:
                labels:
                  - instance: HOSTNAME-HERE
                  - host: HOSTNAME-HERE
                  - resource_type: vm
                  - resource_id: HOSTNAME-HERE

      output:
        plugin: debug
        config:
          file_name: /tmp/yandex-unified-agent-debug.log
          delimiter: "\n"

once you are done, proceed with the real thing

      output:
        plugin: yc_metrics
        config:
          url: https://monitoring.api.cloud.yandex.net/monitoring/v2/data/write
          folder_id: FOLDER-ID-HERE
          iam:
            cloud_meta: {}
          retry_count: 5
          retry_delay: 1s
          timeout: 10s
          request_timeout: 1s

–or– generate an IAM token for a service account that has either full editor or specifically the monitoring.editor role

          iam:
              jwt:
                  file: "/etc/yandex/unified_agent/secrets/yx_jwt_test.json"
                  endpoint: iam.api.cloud.yandex.net
                  refresh_period: 1h
                  request_timeout: 10s

ready to go

unified_agent --config /etc/yandex/unified_agent/config.yml check-config
unified_agent --config /etc/yandex/unified_agent/config.yml

once you are done

systemctl restart unified-agent.service
systemctl status unified-agent.service

acceptance

you can now reach the “Monium” Yandex Monitoring UI and ask for your metrics – note appaarently cluster is mandatory

{service = "custom", cluster = "default"}

or more precisely e.g.

{service = "custom", cluster = "default", name = "sys.proc.LoadAverage15min"}
...

clean-up

apt purge yandex-unified-agent
rm -rf /etc/yandex/unified-agent/
rmdir /etc/yandex/
userdel -r unified_agent

resources

https://yandex.cloud/en-ru/docs/monitoring/concepts/data-collection/unified-agent/installation#deb_1

https://yandex.cloud/en-ru/docs/monitoring/concepts/data-collection/unified-agent/configuration

https://yandex.cloud/en/docs/monitoring/metrics-ref/unifiedagent-ref

HOME | GUIDES | PLAYBOOKS | LECTURES | LAB | CONTACT | HTML | CSS
Licensed as MIT