systemd in Zabbix

If you use Zabbix to monitor your servers you may want to monitor systemd services with it especially if you have some custom services.

These simple checks were enough for me:[<unit name>]  # 1 if unit is active, 0 if inactive[<unit name>]  # 1 if unit if in failed state, 0 if not[<unit name>] # 1 if unit is enabled, 0 if not

It's very simple. Just place userparameter_systemd.conf to your zabbix config dir (usually /etc/zabbix_agentd.conf.d) with the following content:

# checks to determine if specified unit is active, failed or enabled[*],systemctl is-active --quiet '$1' && echo 1 || echo 0[*],systemctl is-failed --quiet '$1' && echo 1 || echo 0[*],systemctl is-enabled --quiet '$1' && echo 1 || echo 0


Comments powered by Disqus