[ZBXNEXT-1593] systemd unit files you may like to ship Created: 2013 Jan 25  Updated: 2019 Dec 08

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Installation (I)
Affects Version/s: 2.2.0
Fix Version/s: None

Type: Change Request Priority: Trivial
Reporter: Volker Fröhlich Assignee: Unassigned
Resolution: Unresolved Votes: 3
Labels: daemon, start, systemd
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File zabbix-agent.service     File zabbix-agentd.service     File zabbix-proxy-pgsql.service     File zabbix-proxy-sqlite3.service     File zabbix-server.service    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-2872 zabbix debian based system, systemd s... Closed

 Description   

Example systemd unit files for agent, proxies and servers are enclosed with this ticket.

"PrivateTmp" requires systemd versions 38 or newer, see http://fedoraproject.org/wiki/Features/ServicesPrivateTmp. It is most useful for servers and proxies, set up to handle fping files in /tmp.

Users are different for agent and server/proxy, due to ZBX-4916.

Dependency on database backends varies for servers and proxies. "After" must therefore be adapted.



 Comments   
Comment by Jonas Heinrich [ 2013 Nov 13 ]

Attached ArchLinux systemd files for agent and server (both files 2013 Nov 13). Please include them upstream! We need them for packaging (https://aur.archlinux.org/packages/?O=0&K=zabbix)

Comment by Volker Fröhlich [ 2014 Jan 01 ]

zabbix-agent.service has errors and Jonas' file basically matches what Fedora now ships with. That said, it would be good to finally standardize the name of the service: zabbix-agent or zabbix-agentd? Debian, Ubuntu and Fedora/EPEL use -agent; Suse, Arch and Gentoo use -agentd.

Jonas' server file is too specific tough, in that it requests mysqld.service. In Fedora/EPEL we are using the Alternatives system to switch between different backend implementation unit files. That basically means, the unit file appears to always have a generic name, but acutually points to a specific implementation.

I'm not sure about the relevance of "-R config_cache_reload". I was under the impression that would happen anyway on start. It might be useful as a setting for "ExecReload" though.

Comment by richlv [ 2014 Jan 02 ]

i would prefer 'agentd' over 'agent' to avoid increased confusion regarding agent/agentd (which is already large enough).

as for config cache reload, i can't think of a reason to do that after startup - was it an attempt to work around some problem ?

Comment by Rainer Stumbaum [ 2015 Nov 19 ]

Adjusted the zabbix_agentd config for Debian Jessie

cat /etc/systemd/system/zabbix-agent.service
[Unit]
Description=Zabbix Agent
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/sbin/zabbix_agentd
PIDFile=/run/zabbix/zabbix_agentd.pid
Restart=always

[Install]
WantedBy=multi-user.target
----
cat /etc/tmpfiles.d/zabbix-agent.conf
d /var/run/zabbix 0755 zabbix zabbix
Comment by Onlyjob [ 2015 Nov 19 ]

This is a bad .service file.

Comment by Rainer Stumbaum [ 2015 Nov 19 ]

I know - but compared to other .service files on Debian (check dnsmasq.service...) it is a beauty

I welcome your suggestions for improvement!

Comment by Onlyjob [ 2015 Nov 19 ]

That's the secret how to feel good: you just need to compare your work to something that is worse. Yay. I have to try it some day.

Comment by Aleksandrov Artyom [ 2016 Aug 23 ]

Why zabbix-agent service does not enable by default in deb packages? Is it a RedHat style in Debian like distrs? =)

I think that dh_systemd_enable should be added for not broke old behavior.

Comment by Tim Meusel [ 2016 Dec 07 ]

Hi,

possible to get any progress here? I'm maintaining a puppet module to configure zabbix, we had:

PrivateTmp=yes
ProtectSystem=full
ProtectHome=yes

in the service file for the agent. Possible to get this upstream?

Comment by Disassembler [ 2016 Dec 14 ]

zabbix-server.service does not consider the possibility of postgres as database backend. In such case, the After directive should be

After=syslog.target network.target postgresql.service

This affects also 3.0.6 installed today (Ubuntu Xenial, Zabbix repo).

// Edit: OK, so no. The whole problem is that the systemd unit is not enabled by default

systemctl enable zabbix-server

fixed the problem.

Comment by Oleg Ivanivskyi [ 2018 Sep 04 ]

We still have init.d scripts, but no unit files. Which is strange if we are talking about systemd based operating systems (e.g. RHEL 7).
It would be awesome to have unit files in the sources.

Comment by Oleksii Zagorskyi [ 2019 Dec 08 ]

Some things mentioned here are also listed in ZBX-15602

Generated at Fri Apr 25 06:59:44 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.