Zabbix Agent doesn’t start – Failed with result ‘exit-code’.

We encountered problem after fresh installation of Zabbix Agent in Ubuntu.

Zabbix Installation Error

zabbix_agentd[4770]: zabbix_agentd [4770]: /etc/zabbix/zabbix_agentd.conf.d: [2] No suc
systemd[1]: zabbix-agent.service: Control process exited, code=exited status=1
systemd[1]: zabbix-agent.service: Failed with result ‘exit-code’.
systemd[1]: Failed to start Zabbix Agent.
systemd[1]: zabbix-agent.service: Service hold-off time over, scheduling restart.
systemd[1]: zabbix-agent.service: Scheduled restart job, restart counter is at 14.
systemd[1]: Stopped Zabbix Agent.
systemd[1]: Starting Zabbix Agent…

Solution is

$ sudo apt purge -f zabbix-agent
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
zabbix-agent*
0 upgraded, 0 newly installed, 1 to remove and 242 not upgraded.
1 not fully installed or removed.
After this operation, 802 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database … 66728 files and directories currently installed.)
Removing zabbix-agent (1:5.0.5-2+focal) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
(Reading database … 66718 files and directories currently installed.)
Purging configuration files for zabbix-agent (1:5.0.5-2+focal) …
Processing triggers for ureadahead (0.100.0-20) …
Processing triggers for systemd (237-3ubuntu10.12) …

$ sudo apt install zabbix-agent
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
zabbix-agent
0 upgraded, 1 newly installed, 0 to remove and 242 not upgraded.
Need to get 0 B/201 kB of archives.
After this operation, 802 kB of additional disk space will be used.
Selecting previously unselected package zabbix-agent.
(Reading database … 66714 files and directories currently installed.)
Preparing to unpack …/zabbix-agent_1%3a5.0.5-2+focal_amd64.deb …
Unpacking zabbix-agent (1:5.0.5-2+focal) …
Processing triggers for ureadahead (0.100.0-20) …
Setting up zabbix-agent (1:5.0.5-2+focal) …
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service → /lib/systemd/system/zabbix-agent.service.
Processing triggers for systemd (237-3ubuntu10.12) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for ureadahead (0.100.0-20) …

$ sudo nano /etc/zabbix/zabbix_agentd.conf
In the config file, specify these parameters,
Server = Zabbix_Server
Hostname=Zabbix_Agent

$ sudo systemctl restart zabbix-agent

$ sudo systemctl enable zabbix-agent
Synchronizing state of zabbix-agent.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent

$ sudo service zabbix-agent status
● zabbix-agent.service – Zabbix Agent
Loaded: loaded (/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-11-18 15:14:18 UTC; 16s ago
Main PID: 7580 (zabbix_agentd)
Tasks: 6 (limit: 9487)
CGroup: /system.slice/zabbix-agent.service
├─7580 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─7581 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
├─7582 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─7583 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─7584 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
└─7585 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]