

If you have a web app, while the proces might be active it does not mean it’s serving http request. Now it also means we also have another way of starting/stoping the services through monit like: sudo monit stop buyitĪnd also a quick summary of the services status with sudo monit status If 2 restarts within 3 cycles then exec "/my/cleanup/script"
Digitalocean monit how to#
Monit is checking that the process called buyit(we just give it a name for monit to know how to refer to it) with id taken from the pid file is running. I think the setup above is pretty self explanatory already, just to sum up this

Stop program = "/home/sbalamaci/projects/buyit/stop.sh" Start program = "/home/sbalamaci/projects/buyit/start.sh" as uid="www" Lets see how a test looks like: check process buyit with pidfile /home/sbalamaci/projects/buyit/process.pid Now Monit runs continuously as a daemon, but periodically(the period which we set to 120 is called a cycle) it wakes up and evaluates each service entry test defined in its configuration file.
Digitalocean monit install#
Install in Ubuntu is as simple as: sudo apt-get install monitĪnd edit the config in /etc/monit/monitrc set daemon 120 #sets cycle=120secs It’s also surprisingly more powerful as it can monitor system resource usage or make network calls to check response on remote services and I think it can prove quite sufficient for most cases. I really like monit as I found it easy to setup and reading the config file for the service monitoring feels natural and self explanatory. Digital ocean already provides graphs for cpu usage and I did not need fancy graphs therefore more complex solutions like nagios seemed like overkill.
Digitalocean monit free#
I prefer many small 512MB memory Digital Ocean hosted instances to host my apps and therefore I was looking for a lightweight free opensource solution that is able to monitor a process, tries to restart it in case it stops, or emails me in case it fails. I was looking for a complete and lightweight monitoring solution for my java processes when I found the perfect match Monit.
