The open-source Zabbix monitoring solution has very lightweight agents that are easy to install on Ubuntu.
Although the Ubuntu main repository has a build available, it is older and so we are going to choose to download and install the latest point version in this article. Unfortunately, the repo.zabbix.com cannot be added directly as an Ubuntu repository source.
Zabbix 2.2 Agent
If you are using a Zabbix2 server then download the Zabbix 2.2 agent, install, then verify the version.
$ cd /tmp $ wget http://repo.zabbix.com/zabbix/2.2/ubuntu/pool/main/z/zabbix/zabbix-agent_2.2.17-1+trusty_amd64.deb $ sudo dpkg -i zabbix-agent_2.2.17-1+trusty_amd64.deb $ /usr/bin/zabbix_agent --version
Zabbix 3.2 Agent
If you are using a Zabbix3 server then download the Zabbix 3.2 agent, install, then verify the version.
$ cd /tmp $ wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix/zabbix-agent_3.2.4-1+trusty_amd64.deb $ sudo dpkg -i zabbix-agent_3.2.4-1+trusty_amd64.deb $ /usr/sbin/zabbix_agent --version
Note that the zabbix 3.x agent binary is found in ‘/usr/sbin’ as opposed to ‘/usr/bin’ like zabbix 2.x.
Modify Configuration
Regardless of which version of the Zabbix Agent we install, we need to modify the main configuration file to point to our Zabbix server. Edit “/etc/zabbix/zabbix_agentd.conf” and make sure the following 3 keys are populated at a minimum:
Server=myzabbixserver ServerActive=myzabbixserver Hostname=agenthostname
Restart Service
Now restart the service
$ sudo service zabbix-agent restart
And check the logs at /var/log/zabbix/zabbix_agentd.log for any errors.
Add to Zabbix Host definitions
As the final step, be sure to login to your Zabbix server, go to Configuration > Hosts, and click on “Create host”. The “Host name” should be populated with the same hostname value you used in zabbix_agentd.conf.
REFERENCES
https://tecadmin.net/install-zabbix-agent-on-ubuntu-and-debian/
https://www.zabbix.com/documentation/2.4/manual/installation/install_from_packages
https://wiki.debian.org/SecureApt
NOTES
wget -O – “http://repo.zabbix.com/RPM-GPG-KEY-ZABBIX” | sudo apt-key add –
sudo apt-get update
sudo apt-get adv –keyserver keyserver.ubuntu.com –recv-keys 082AB56BA14FE591
Get values directly from agent box
zabbix_get -s 127.0.0.1 -p 10060 -k vm.memory.size[free]