Monitoring Systemd Service Using Monit
Monit is an easy-to-use software for monitoring servers. It does not require any agent and runs locally within the server. The ability to use custom scripts makes it versatile for monitoring any services/resources.
Monit uses control files to define how each service/resource is monitored. This a sample control file for monitoring Systemd service.
check program php-fpm with path "/usr/bin/systemctl --quiet is-active php-fpm.service"
if status != 0 then alert
if status != 0 then exec "/usr/bin/systemctl start php-fpm.service"
This is especially useful for monitoring custom-defined Systemd services.