- Discovery of systemd Services
- Provides option of blacklisting or whitelisting services
- Provides alerting when a service stops or restarts
- RHEL/CentOS/Oracle EL 7+
- Ubuntu 16.04+
- Zabbix 4.0+
- Server
- Import template from systemd-services-zabbix-template.xml
- Link template to host
- Agent
- Place the following file inside /usr/local/bin/:
- zbx_service_restart_check.sh
- zbx_service_discovery.sh
- Set executable permissions on both scripts
- Copy userparameter_systemd_services.conf to /etc/zabbix/zabbix_agentd.d/userparameter_systemd_services.conf
- Restart zabbix_agent
- Place the following file inside /usr/local/bin/:
- SELinux
- Run restorecon on the two scripts in /usr/local/bin e.g. restorecon -v /usr/local/bin/zbx*.sh
- Create a custom policy module:
- Please follow the directions above to install the template on the server and copy the files to the agent and then allow the agent to attempt discovery. (This can be sped up by changing the discovery update interval to 5m from 24H)
- Once this has completed run the following commands to create a custom SELinux Policy Module:
- grep zabbix_agent_t /var/log/audit/audit.log | grep denied | audit2allow -M zabbix_agent
- semodule -i zabbix_agent.pp
- If you add additional services you will need to repeat this process. Sorry.
To test that everything works use zabbix_agentd -t
to query the statistics:
# Discover systemd services
zabbix_agentd -t "systemd.service.discovery"
zabbix_agentd -t "systemd.service.status[sshd]"
zabbix_agentd -t "systemd.service.restart[sshd]"