[ZBX-24135] Improve Systemd template docs with better config instructions Created: 2024 Feb 21  Updated: 2024 Feb 23  Resolved: 2024 Feb 23

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Documentation (D)
Affects Version/s: None
Fix Version/s: None

Type: Documentation task Priority: Trivial
Reporter: Dan MacDonald Assignee: Zabbix Support Team
Resolution: Won't fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screenshot 2024-02-22 at 09.20.17.png     PNG File Screenshot 2024-02-22 at 09.20.57.png     PNG File Screenshot 2024-02-22 at 09.23.05.png    

 Description   

By default, the Zabbix Systemd template monitors the state of all services running on the host but thats not the way I use and I expect it not the way most users will want to use it.

I only ever want to monitor a specific few services on any given server so I think the Zabbix systemd integration docs ( https://www.zabbix.com/integrations/systemd ) should cover how to configure the template to only monitor specific services.

Here are some notes that I wrote for my own usage which I think should be integrated with the Zabbix systemd docs, under the Configurarion or Setup section of https://www.zabbix.com/integrations/systemd maybe?

First, zabbix-agent2 must be installed and configured on the machine you wish to monitor. The Systemd template doesn't work with the old zabbix-agent.

Next, add the Systemd by Zabbix agent template to the host you wish to monitor under Configuration -> Hosts.

Now we need to configure the template under Configuration -> Templates -> Macros. On this screen we adjust the value of the {$SYSTEMD.NAME.SERVICE.MATCHES} macro to:

apache2.service|fail2ban.service|mysql.service|php8.1-fpm.service|postgresql.service|ssh.service

Adjust php8.1-fpm to the current running version of php or add another php service in if more than one version of php is being run then click Update to save these changes.

Optionally...

Next, go to Configuration -> Templates -> Discovery rules and change the interval for both Service units discovery and Socket units discovery to 1m instead of 30m.

 



 Comments   
Comment by Edgar Akhmetshin [ 2024 Feb 22 ]

Hello Dan,

First, zabbix-agent2 must be installed and configured on the machine you wish to monitor. The Systemd template doesn't work with the old zabbix-agent.

Sorry, but it's not clear why it should be mentioned separately, since:
https://www.zabbix.com/integrations/systemd

Next, add the Systemd by Zabbix agent template to the host you wish to monitor under Configuration -> Hosts.

https://www.zabbix.com/documentation/current/en/manual/config/templates_out_of_the_box/zabbix_agent2

Now we need to configure the template under Configuration -> Templates -> Macros. On this screen we adjust the value of the {$SYSTEMD.NAME.SERVICE.MATCHES} macro to:
apache2.service|fail2ban.service|mysql.service|php8.1-fpm.service|postgresql.service|ssh.service
Adjust php8.1-fpm to the current running version of php or add another php service in if more than one version of php is being run then click Update to save these changes.

Looks like a corner case, since according to our statistics users usually start with default options and only after some time adjust notifications/thresholds/filters as needed since more experience received, removing default functionality will create more issue rather than help, especially if documentation is not investigated before using some software.

Regards,
Edgar

Generated at Tue Apr 08 01:15:19 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.