Thursday, October 20, 2016

Installing monit in Ubuntu (IP: 10.20.30.40)


1. Repair missing LSB tags on tomcat and vncserver and other daemon as well

   $ sudo vi tomcat 
   $ sudo vi vncserver 
  
  add this after shebang
  
  ### BEGIN INIT INFO
  # Provides:          skeleton
  # Required-Start:    $remote_fs $syslog
  # Required-Stop:     $remote_fs $syslog
  # Default-Start:     2 3 4 5
  # Default-Stop:      0 1 6
  # Short-Description: Example initscript
  # Description:       This file should be used to construct script
  #                    placed in /etc/init.d.
  ### END INIT INFO
  
  
2. Install monit
   $ sudo apt-get install monit
   
   
3. Edit /etc/monit/monitrc
$ sudo vi /etc/monit/monitrc

3.1. Uncomment this section:

set httpd port 2812 and
         use address 10.20.30.40 # only accept connection from localhost
         allow 0.0.0.0/0.0.0.0   # allow localhost to connect to the server and
         allow admin:monit      # require user 'admin' with password 'monit'
         allow @users readonly  # allow users of group 'users' to connect readonly 

3.2. Append at the end of the config

# monitor sshd
check process sshd with pidfile /var/run/sshd.pid
#
# monitor jenkins
check process jenkins with pidfile /var/run/jenkins/jenkins.pid
#
# monitor apache2
check process apache2 with pidfile /var/run/apache2/apache2.pid


4. Install upstart
$ sudo apt-get install upstart-sysv

5. Reload monit
$ sudo reload monit

OR

$ sudo service monit restart

6. Open browser and check
http://10.20.30.40:2812/

No comments:

Post a Comment