CT have created a default Hyper-V virtual machine to act as a Zabbix proxy on site. Here’s how to deploy it.
We recommend using Hyper-V to run the proxy so you can take checkpoints and revert back to saved working instances should anything go wrong. Hyper-V is a free feature built in to Windows and can be enabled by searching for ‘features’ from the Start menu and following the wizard to add the new feature. You will need to ensure that virtualisation is enabled in your PC’s BIOS, and the install will require a restart.
Once installed, open Hyper-V Manager. Hyper-V is not good at being backwards compatible. This VM was created on version 0.0.19041.1 so you will need to check Help -> About Hyper-V Manager for the version of Hyper-V you are running. It must be 10.0.19041.1 or higher to import the VM.
In Hyper-V Manager, check you have a virtual switch available in Virtual Switch Manager to ‘plug’ the VM into. If there are no virtual switches listed, create a new external switch, celetcing External, the correct physical network interface and making sure ‘Allow management operating system to share this network adaptor’ is ticked.
Download the standard CT Zabbix Proxy VM from the link below. Once downloaded, unzip the folder.
Select Action -> Import virtual machine to open the import wizard.
When prompted, select the ‘Virtual machines’ folder inside your unzipped VM image folder, then select to ‘Copy the virtual machine’. If your Virtual Switch is named differently from the default, you will be presented with a warning that the switch cannot be found. Simply select your virtual switch from the drop down list.
Once imported, double click on the VM to start it.
The proxy will start in its default configuration which you need to change. Log in with the credentials administrator and Creat1ve.
Firstly, if you are running a complex job it is good practice to change the operating system’s hostname to make it clear which VM you are logged into.
sudo hostnamectl set-hostname <your-new-hostname>
As this is the default VM, you need to change a the name so it can be identified properly by the server.
sudo nano /etc/zabbix/zabbix-proxy.conf
On line 42, edit the Hostname= parameter to something unique for your show. This name cannot contain spaces or special characters other than hyphens. Save and exit by pressing ctrl-X and then type y to okay the save. As we have changed the configuration, the proxy service needs to be restarted to apply the changes.
sudo service zabbix-proxy restart
Log in to monitoring.ctlondon.com and navigate to Administration -> Proxies. Select CT-ZABBIX-PROXY-FROM-IMAGE from the list of proxies. Click Clone. Rename this clone to exactly match the Hostname you set in the config file. It mush match EXACTLY. Once changed, click Add.
Your proxy should now appear in the list of proxies with a ‘Last seen’ time of a few seconds.
If you need to build a proxy from scratch
We are going to assume you are still using Hyper-V so you are able to take checkpoints and restore to them if you need to. Zabbix Proxy runs on Ubuntu so it can be installed on bare metal, just skip the Hyper-V steps below and go straight to installing Ubuntu.
Create a new Hyper-V VM with 2048MB of RAM (not dynamic), a 50GB virtual hard drive and running Ubuntu 24.04.
Before you start the new VM, edit the Security settings to disable Secure boot and set the Automatic start action to always start. Attach the Ubuntu ISO file to boot
As you go through the Ubuntu installer, ensure you enable SSH as it will make copying and pasting commands into the terminal easier later. Once Ubuntu is installed, log in a elevate to root. All the commands below assume you are root, but would work as a non-admin user by adding sudo to the start of every line.
This guide also assumes you are running Ubuntu on x86 architecture. For ARM64, replace all references to ‘ubunutu’ in the the wget URLs with ‘ubuntu-arm64’
These instructions are CT specific but have been copied from the excellent bestmonitoringtools.com
Update the operating system
apt update
apt upgrade -y
Get and install the Zabbix 6.0 repository. Starting at this old version ensures the installer contains the necessary database templates.
wget\
https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-6+ubuntu$(lsb_release -rs)_all.deb
dpkg -i zabbix-release_6.0-6+ubuntu$(lsb_release -rs)_all.deb
apt update
apt -y install curl zabbix-proxy-mysql zabbix-sql-scripts
apt install software-properties-common -y
apt update
apt upgrade -y
For Raspbian Buster (needs testing)
https://repo.zabbix.com/zabbix/6.0/raspbian/pool/main/z/zabbix-release/zabbix-release_6.0-4+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
dpkg -i zabbix-release_6.0-4+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
apt update
apt -y install zabbix-proxy-mysql zabbix-sql-scripts
apt install software-properties-common -y
apt update
apt upgrade -y
Get and install the specific database version that works with this version of proxy.
sudo rm /etc/apt/sources.list.d/mariadb.list
curl --fail --silent --show-error --location https://mariadb.org/mariadb_release_signing_key.asc | sudo gpg --dearmor -o /usr/share/keyrings/mariadb-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/mariadb-archive-keyring.gpg] https://dlm.mariadb.com/repo/mariadb-server/10.11/repo/ubuntu mantic main" >> /etc/apt/sources.list
apt update
apt install mariadb-server -y
Run the database security wizard. The answers to the prompts should be Creat1ve, y, y, Creat1ve, Creative, y, y, y, y
mysql_secure_installation
Create the proxy database and import the template schema.
mariadb -uroot -p'Creat1ve' -e "create database zabbix_proxy character set utf8mb4 collate utf8mb4_bin;"
mariadb -uroot -p'Creat1ve' -e "create user 'zabbixproxy'@'localhost' identified by 'Creat1ve';
mariadb -uroot -p'Creat1ve' -e "grant all privileges on zabbix_proxy.* to zabbixproxy@localhost identified by 'Creat1ve';"
cat /usr/share/zabbix-sql-scripts/mysql/proxy.sql | mysql --default-character-set=utf8mb4 -uzabbixproxy -p'Creat1ve' zabbix_proxy
Edit the Zabbix Proxy config file to reflect our environment.
nano /etc/zabbix/zabbix_proxy.conf
Find and edit these parameters: Server=51.219.88.253;192.168.99.30 the Hostname=CT-ZABBIX-PROXY-FROM-GUIDE and DBuser=zabbixproxy
Add the following to the bottom of the file.
TLSConnect=psk
TLSAccept=psk
TLSPSKFile=/etc/zabbix/CT-ZABBIX-PROXY-FROM-IMAGE.psk
TLSPSKIdentity=CT-ZABBIX-PROXY-FROM-IMAGE
StartPollers=100
StartPollersUnreachable=50
StartPingers=50
StartTrappers=10
StartDiscoverers=15
StartHTTPPollers=5
CacheSize=128M
HistoryCacheSize=64M
HistoryIndexCacheSize=32M
DBPassword=Creat1ve
Create a PSK file…
nano /etc/zabbix/CT-ZABBIX-PROXY-FROM-IMAGE.psk
…and copy this value into it:
2701f4f8efd23a201f7ce942e76ee7c348b20074c9a9103cf2104d0faa0eda0f
Fix the permissions so Zabbix Proxy can use the PSK.
sudo chown zabbix:zabbix /etc/zabbix/CT-ZABBIX-PROXY-FROM-IMAGE.psk
sudo chmod 644 /etc/zabbix/CT-ZABBIX-PROXY-FROM-IMAGE.psk
And start Zabbix
systemctl start zabbix-proxy
systemctl enable zabbix-proxy
systemctl stop zabbix-proxy
Finally, optimise the database. Open a new config file…
nano /etc/mysql/mariadb.conf.d/10_my_tweaks.cnf
…and copy this into it.
[mysqld]
max_connections = 280
innodb_buffer_pool_size = 1G
innodb-log-file-size = 128M
innodb-log-buffer-size = 128M
innodb-file-per-table = 1
innodb_buffer_pool_instances = 8
innodb_old_blocks_time = 1000
innodb_stats_on_metadata = off
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-flush-log-at-trx-commit = 2
tmp-table-size = 96M
max-heap-table-size = 96M
open_files_limit = 65535
max_connect_errors = 1000000
connect_timeout = 60
wait_timeout = 28800
Apply the correct permissions, tell the database to use this configuration and restart the service to apply.
chown mysql:mysql /etc/mysql/mariadb.conf.d/10_my_tweaks.cnf
chmod 644 /etc/mysql/mariadb.conf.d/10_my_tweaks.cnf
egrep "^Start.+=[0-9]" /etc/zabbix/zabbix_proxy.conf | awk -F "=" '{s+=$2} END {print s+50}'
service mariadb restart
As some of the checks use custom scripts to get data from the host, the proxy needs to be set up to download the latest scripts from the server.
touch /usr/sbin/getCTzabbixscripts.sh
chmod +x /usr/sbin/getCTzabbixscripts.sh
nano /usr/sbin/getCTzabbixscripts.sh
Copy the code below into the script, exit and save.
#!/bin/bash
#Remove all the current scripts and zip folder
rm -rf /usr/lib/zabbix/externalscripts/*.*
rm /usr/lib/zabbix/externalscripts/last_run*
#Get the latest zip folder from the server and save it in the scripts folder
wget\
https://monitoring.ctlondon.com/zabbix/publicscripts/publicscripts.tar.gz -P /usr/lib/zabbix/externalscripts
#Extract them into the external scripts folder
tar -xvzf /usr/lib/zabbix/externalscripts/publicscripts.tar.gz -C /usr/lib/zabbix/externalscripts/
To execute this automatically at 2 minutes past each hour, edit cron to run the script by adding the command below to the cron file.
crontab -e
02 * * * * /usr/sbin/getCTzabbixscripts.sh
Now we want to make your proxy specific for your event.
nano /etc/zabbix/zabbix_proxy.conf
On line 42, edit the Hostname= parameter to something unique for your show. This name cannot contain spaces or special characters other than hyphens. Save and exit by pressing ctrl-X and then type y to okay the save. As we have changed the configuration, the proxy service needs to be restarted to apply the changes.
sudo service zabbix-proxy restart
Log in to monitoring.ctlondon.com and navigate to Administration -> Proxies. CT-ZABBIX-PROXY-FROM-GUIDE should be showing as online but with a version warning. If it is still showing as offline, check /var/log/zabbix/zabbix-proxy.log for details as to what my be the issue.
systemctl stop zabbix-proxy
rm -Rf /etc/apt/sources.list/zabbix.list
wget\
https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-1+ubuntu$(lsb_release -rs)_all.deb
dpkg -i zabbix-release_7.0-1+ubuntu24.04_all.deb
apt update
apt upgrade -y
During the upgrade you will be asked if you want replace your edited Zabbix config file with a blank one. Answer n
systemctl start zabbix-proxy
Log in to monitoring.ctlondon.com and navigate to Administration -> Proxies. Select CT-ZABBIX-PROXY-FROM-GUIDE from the list of proxies. Click Clone. Rename this clone to exactly match the Hostname you set in the config file. It mush match EXACTLY. Once changed, click Add.
Your proxy should now appear in the list of proxies with a ‘Last seen’ time of a few seconds.
Leave a Reply