Monitoring with monit

Tech Notes


  1. Install monit sudo apt-get install monit
  2. Configure (turn on web interface) $ sudo vi /etc/monit/monitrc set httpd port 2812 and # use address localhost # only accept connection from localhost allow allow xxxxxxxx:xxxxxxxx
  3. Create a configuration for solr $ sudo vi /etc/monit/conf.d/solr check process solr with pidfile /var/run/ start program = "/usr/sbin/service tomcat6 start" stop program = "/usr/sbin/service tomcat6 stop" if failed host localhost port 8080 protocol http and request "/solr" then restart if totalmem is greater than 7268 MB for 10 cycles then restart
  4. Reload monit $ sudo service monit reload
  5. Check the output $ sudo monit status The Monit daemon 5.3.2 uptime: 6mProcess 'solr' status Running monitoring status Monitored pid 28201 parent pid 1 uptime 8h 27m children 0 memory kilobytes 84480 memory kilobytes total 84480 memory percent 13.9% memory percent total 13.9% cpu percent 0.1% cpu percent total 0.1% port response time 0.001s to localhost:8080/solr [HTTP via TCP] data collected Wed, 24 Oct 2012 06:32:57