Configure Zabbix Agent on the Zabbix Proxy
The correct Zabbix repository was already installed from the last section, so we can just run
sudo apt install zabbix-agent
On Linux hosts, to enable auto restart after reboot,
sudo systemctl enable zabbix-agent.service
If your Zabbix Server and Proxy are communicating successfully, as can be verified in the Zabbix UI ⇾ Admin ⇾ proxies page, then we can now set up the agent on the proxy itself to retrieve items.
So, on the proxy server, enter
sudo nano /etc/zabbix/zabbix_agentd.conf
|Server||127.0.0.1||This agent will communicate directly to the proxy process running on this same machine|
|ServerActive||127.0.0.1||zabbix.sbcode.net will also work in my case, but in this example, I am now using the proxy, and not the external Zabbix Server directly. The Proxy process will be handling all the communications on behalf of the Zabbix Server for this local agent.|
|Hostname||raspberrypi||(see notes below)|
In the above table, I use raspberrypi in the Hostname setting for this agent process. I could also use 127.0.0.1.
raspberrypi is the same as the hostname I entered into the proxy config file, this doesn't matter, they both locally resolve to 127.0.0.1.
To get the hostname of a server, go onto the server, open a prompt and type
hostname, and take note of the response. On my Raspberry PI, where i've installed the Zabbix Proxy service, the response of the
hostname command is
raspberrypi. Yours will most likely be different.
Add the Agent Host to the Zabbix UI
Zabbix ⇾ Configuration ⇾ Hosts
|Host Name||raspberrypi||I am keeping it consistent and using the same value I get when running the
|Agent interface||raspberrypi/DNS/10050||127.0.0.1/IP/10050 will also work.|
|Monitored by proxy||raspberrypi||Very important. Since the raspberrypi proxy process is managing the raspberrypi agent process, then the above Agent interface needs to know how to find the raspberrypi agent from the perspective of the raspberrypi proxy. They are on the same server, so essentially, if it resolves to 127.0.0.1 then it will work. The proxy will download configuration settings from the external Zabbix Server at regular intervals, and execute them locally, so it needs local IP addresses or hostnames as it goes through the queue of items it needs to request on behalf of the Zabbix server.|
Template OS Linux by Zabbix agent
|If you don't bind any templates, or add items, you won't get any data from the agent.|
Double check by reading all the notes above.
Try tailing the agent and proxy logs on the proxy to see if there are any clues.
tail -f /var/log/zabbix/zabbix_agentd.log
tail -f /var/log/zabbix/zabbix_proxy.log
And be sure that after any changes on the Zabbix server, wait a minute for the Zabbix server internal cache to update, then on the proxy run,
sudo zabbix_proxy -R config_cache_reload