Monit

is a utility for managing and monitoring processes, programs, files, directories and filesystems on a UNIX system.

Configuration
Config file of monit resides in. And there is a item to specify a config directory. Uncomment if needed.

Start the service & load at boot.

Squid memory example
is a caching proxy that is memory hungry. It can control its memory consumption by itself in the configuration file, while we can make an redundent check here.

We can run monit foreground and see the effect.

pidfile check
monit relies on the pidfile convention, it can only monitor background daemons. For daemons that do not create a pidfile, a trick is needed.

pidfile approach is intrinsically broken for monitforing process. Monit can overcome this by checking the pidfile frequently enough to be reliable, though.

Web interface
Navigate to http://localhost:2812/ & login using your edited configuration line or admin / monit if you have not changed it yet.