Install Zabbix Agent on VCSA 6.5
- Tutorial
Infa under the cut: How to collect and install Zabbix Agent on VCSA + A little information about the VCSA device.
Lyrics:
Anyone who has already deployed VCSA 6.5 and tried to see what's under the hood knows that VMware has now decided to use PhotonOS instead of its "traditional" Suse assemblies.
If you read the PhotonOS docks, you can find out that their distributor is RPM based, however they use their implementation of the tdnf package manager.
Conditions:
No one wants to litter on VCSA. VCSA does not use a package manager to control VCSA components, when installing all the necessary components, for assembling a zabbix agent there is a chance to break VCSA and sharply increase the level of "entropy" inside. Therefore, it must be obtained in such a way that he wound up on PhotonOS.
Procedure:
1. You need to install PhotonOS-1.0 Full version so that there is a pre-installed kit for compilation (gcc, make & etc). To get an ISO image for installation, we go to: vmware.github.io/photon . We find the download link: Photon OS, Version 1.0 - Full ISO ~ 2.4Gb. Download the image.
2. Create a clean VM for PhotonOS in any convenient virtualization environment. Important detail:
!!! The root disk on which the installation will be performed should be defined as sda !!!
Because the installer at PhotonOS looks for / dev / sda and if it doesn’t find it, it just pops into the console
Actually, we perform a standard installation (Example: Off docks ) The
installer asks for the type of system to be installed, we just select “PhotonOS Full”.
We are waiting for the installation to finish and reboot the system.
3. Compilation of Zabbix Agent.
Open the VM console with PhotonOS and log in. Optionally, enable the remote login for root in / etc / ssh / sshd_config
→ You need to download the archive with Zabbix sources
→ Direct link to SourceForge
Because in the case of VCSA, it will not work to remotely upload data via SSH
(there is your own shell, which requires a separate command to open regular bash)
Instead of connecting to the VM, we will connect to ourselves.
Unpack the archive:
tar -xvf zabbix-3.2.3.tar.gz /tmp/zabbix/We take the data to the VM (the commands must be executed on the PhotonOS machine):
scp -r your_user@your_machine:/tmp/zabbix/ /root/zabbix/Having taken the source, it remains to be done:
# cd /root/zabbix/
# ./configure --enable-agent
# make
After the compilation is completed, we get a binary that will work on VCSA:
./src/zabbix_agent/zabbix_agentd - the binar itself ./conf/zabbix_agentd.conf - the bin
config, which usually lies in /etc/zabbix/zabbix_agentd.conf
VCS as init, therefore, for Zabbix Agent to work, you will need a service, an example of a service:
# /etc/systemd/system/zabbix-agent.service
[Unit]
Description=Zabbix Agent
Documentation=man:zabbix_agentd
After=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/zabbix_agentd -f -c /etc/zabbix/zabbix_agentd.conf
Restart=always
RestartSec=5s
[Install]
WantedBy=multi-user.target
We move the necessary from VM:
# scp ./src/zabbix_agent/zabbix_agentd your_user@your_machine:/tmp/zabbix_agentd
# scp ./conf/zabbix_agentd.conf your_user@your_machine:/tmp/zabbix_agentd.conf
4. Install Zabbix Agent on VCSA. We connect via ssh to VCSA, an input prompt appears, enter the shell to gain access to the Linux console.
# scp your_user@your_machine:/tmp/zabbix_agentd /usr/sbin/zabbix_agentd
# mkdir -p /etc/zabbix
# scp your_user@your_machine:/tmp/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf
# tee /etc/systemd/system/zabbix-agent.service - вставляем содержимое systemd сервиса, и прерываем ввод Ctrl+C
# systemctl enable zabbix-agent
# vim /etc/zabbix/zabbix_agentd.conf - редактируем по необходимости
# systemctl restart zabbix-agent
OS
vmware-vpostgres
vsphere-client
vsphere-ui
vmware-vpxd-svcs
vmware-sps
vmware-stsd
vmware-perfcharts
vmware-content-library
vmware-sts-idmd
vmware-updatemgr
vmware-psc-client
vmware-cm
vmware- endpoint-vapi
applmgmt
vmcad
vmware-eam
vmware-cis-license
vmware-vsm
vmware-mbcs
vmware sca-
vmware-vsan-health
vmware-rbd-watchdog
vmware-imagebuilder
vmware-rhttpproxy
vcha
vmafdd
vmdird
vmdnsd
vmware-netdumper
vmonapi
vmware-statsmonitor
vmware-vmon
Script for monitoring vmware services
#!/bin/bash
# For VMware VCSA 6.5
export VMWARE_PYTHON_PATH=/usr/lib/vmware/site-packages
export VMWARE_LOG_DIR=/var/log
export VMWARE_DATA_DIR=/storage
export VMWARE_CFG_DIR=/etc/vmware
command -v service-control &> /dev/null || exit 1
case "$1" in
discovery)
{
echo '{"data":['
service-control --list-services | sed 's/ (/:(/g' | \
while read -r string; do
echo '{'
echo '"{#SERVICE}":"'"$(echo $string | cut -d':' -f1)"'"',
echo '"{#SERVICE_DESCR}":"'"$(echo $string | cut -d':' -f2 | tr -d ')(')"'"'
echo -n '},'
done
echo ']}'
} | sed 's\},]\}]\g'
;;
status) service-control "--$1" "$2" 2>&1 | grep -c Running ;;
esac
PSS Like forgot nothing