MogiePete / zabbix-systemd-service-monitoring

Simple Zabbix Template to discover, monitor, and alert on systemd services.
GNU General Public License v2.0
91 stars 41 forks source link

systemd Service Monitoring template for Zabbix

Features

Requirements

OS:

Zabbix:

Installation

Notes

The filter files can take extended regular expressions, one per line.

If neither service_discovery_whitelist nor service_discovery_blacklist exist on the system, the default behavior is to monitor all services. In other words it is the equivalent of a blank blacklist and a non-existent whitelist.

If both files exist, both will be used, with the whitelist filter being applied first. Their behavior is explained as follows.

Blacklist Option:

This assumes you have disabled all unnecessary services prior to enabling the template. Any service that is enabled and not running will result in an alert.

If you cannot, use the service_discovery_blacklist to add services that you don't want to monitor.

Additionally, this excludes getty and autovt which are not reported by systemctl with the tty and will result in an error.

Whitelist Option:

I have added the whitelist option as a way allow users to select the services they wish to monitor.

To do so modify the service_discovery_whitelist which is already populated with sshd|zabbix-agent.

Testing

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]"

License

Copyright (c) 2018-2021 Mogie Pete and contributors

This Zabbix template is Free and Open Source software released under the same license of Zabbix, the GNU General Public License.

You can redistribute it and/or modify it under the terms of the GNU GPL as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file LICENSE.md or:

https://www.zabbix.com/license

https://www.fsf.org/licenses/