Monit & Munin

Discussion in 'HOWTO-Related Questions' started by SamTzu, May 3, 2008.

  1. SamTzu

    SamTzu HowtoForge Supporter

    I noticed that there are not so many configuration files available for Monit & Munin so I decided to share my Monit config here in the hope that someone will share theirs and hopefully we can see some Munin config file here (I have had some problems getting anything but the default graphs.)

    I would also like to see how can the chrooted Bind be included in Monit?
    It has no pid file in My Ubuntu setup.

    Also can someone who has already ISPConfig running add something more here? (Like clamav, etc?)


    Ubuntu 8.04 LTS
    /etc/monit/monitrc

     
    Last edited: May 12, 2008
  2. falko

    falko Super Moderator

    The pid file of the chrooted BIND should be in /var/lib/named/var/run/bind/run.

    Here's a monit configuration from one of my servers (Debian Etch):

    Code:
    check process proftpd with pidfile /var/run/proftpd.pid
       start program = "/etc/init.d/proftpd start"
       stop program  = "/etc/init.d/proftpd stop"
       if failed port 21 protocol ftp then restart
       if 5 restarts within 5 cycles then timeout
    
    check process sshd with pidfile /var/run/sshd.pid
       start program  "/etc/init.d/ssh start"
       stop program  "/etc/init.d/ssh stop"
       if failed port 22 protocol ssh then restart
       if 5 restarts within 5 cycles then timeout
    
    check process mysql with pidfile /var/run/mysqld/mysqld.pid
       group database
       start program = "/etc/init.d/mysql start"
       stop program = "/etc/init.d/mysql stop"
       if failed host 127.0.0.1 port 3306 then restart
       if 5 restarts within 5 cycles then timeout
    
    check process apache with pidfile /var/run/apache2.pid
       group www
       start program = "/etc/init.d/apache2 start"
       stop program  = "/etc/init.d/apache2 stop"
       if failed host www.falkotimme.com port 80 protocol http
          and request "/monit/token" then restart
       if cpu is greater than 60% for 2 cycles then alert
       if cpu > 80% for 4 cycles then restart
       if children > 250 for 3 cycles then restart
       if children > 300 then restart
       if loadavg(5min) greater than 5 then restart
       if 3 restarts within 5 cycles then timeout
    
    check file apache_errorlog with path /var/log/apache2/error.log
       if match "exit signal Segmentation fault \(11\)$" then exec "/etc/init.d/apache2 restart"
    
    check process postfix with pidfile /var/spool/postfix/pid/master.pid
       group mail
       start program = "/etc/init.d/postfix start"
       stop  program = "/etc/init.d/postfix stop"
       if failed port 25 protocol smtp then restart
       if 5 restarts within 5 cycles then timeout
     
  3. qops1981

    qops1981 New Member

    Monit Configuration Check

    Hey All,

    New to this forum. I have a question about my Monit Confiuration:
    Code:
    set alert dex123@x123.com 
    
    check process nginx with pidfile /var/run/nginx.pid
      start program = "/etc/init.d/nginx start" with timeout 30 seconds
      stop program  = "/etc/init.d/nginx stop"
      if failed host 127.0.0.1 port 80 for 3 cycles then restart
      if 3 restarts within 11 cycles 
      	then exec "/sbin/fuser --kill 80\tcp && /sbin/service nginx restart"
      	then alert # something to test
    1. Is this code valid and will it function correctly?
    2. Can I have multiple "then" events in a row?
    3. Will multiple "then" events in a row execute one at a time or concurrently?
    4. Could I change the && section and just add another "then" event after the 1st "then" event? Example Below.
    Code:
    then exec "/sbin/fuser --kill 80\tcp"
    then exec "/sbin/service nginx restart"
    then alert # something to test
    Any advice is greatly appreciated!
    Thank you,
    -Bill
     

Share This Page