# Monitoring Systemd Service Using Monit

[Monit](https://mmonit.com/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](https://bit.ly/44C6Gc5) to define how each service/resource is monitored. This a sample control file for monitoring Systemd service.

```bash
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.
