Visualize centralized process management using M/monit

Source: Internet
Author: User

A: Preface

Monit is an open source monitoring management tool (similar to supervisor) that monitors the load, files, processes, etc. of Linux systems. When the system load is too high, the monitoring file is tampered with, the process exits unexpectedly, can send the mail alarm, and can automatically start or close the exception process. Monit embedded web interface to see the status of monitoring items on the current host.


M/monit is a centralized visualization tool for managing multiple monit and is a toll-free 30-day trial.


II: Planning

M/monit (centralized management) 192.168.0.1

Monit (monitoring machine) 192.168.0.2

Monit (monitoring machine) 192.168.0.3


Three: Install M/monit

(1) Installation M/monit

$CD/opt$wget Https://mmonit.com/dist/mmonit-3.5.1-linux-x64.tar.gz$tar XF MMONIT-3.5.1-LINUX-X64.TAR.GZ$CD mmonit-3.5.1

(2) Configuration M/monit

The 1:mmonit configuration file is Conf/server.xml and can be used without any changes, and the default configuration is port 8080.

<connector address= "*" port= "8080" processors= "/>"

2:mmonit default is to use the Sqlite3 database in the package, the default configuration is as follows

<realm url= "Sqlite:///db/mmonit.db?synchronous=normal&heap_limit=8000&foreign_keys=on&journal_ Mode=wal "minconnections=" 5 "maxconnections=" reapconnections= "300" />

can also be changed to MySQL and PostgreSQL database. Take MYQSL as an example (using the default SQLite can be skipped):

    • Modify the SQLite configuration to

<realm url= "Mysql://mmonit:[email protected]/mmonit" minconnections= "5" maxconnection s= "reapconnections="/>
    • and import the MySQL database

$mysql-UMMONIT-PPASSWD </opt/mmonit-3.5.1/db/mmonit-schema.mysql


(3) Start M/monit

$bin/mmonit-c Conf/server.xml

(4) Start M/monit

Visit 192.168.0.1:8080 to display the login page.

Default User Name

User

Password

Permissions

 admin

 swordfish

  Administrator

Monit

Monit

Normal User

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/89/20/wKiom1gIeYqgHaG9AAE-ZSdbuIw189.png "title=" 1.png " Width= "height=" 397 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:500PX;HEIGHT:397PX; "alt=" Wkiom1gieyqghag9aae-zsdbuiw189.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/89/20/wKiom1gIecDxBItSAAEc7JbLEgc172.png "title=" 2.png " Width= "height=" 348 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:348px; "alt=" Wkiom1giecdxbitsaaec7jblegc172.png "/>

Log in, the inside is blank, no hosts, this is because Monit has not joined in, the following configuration Monit

Four: Installation configuration Monit


(1) Installation Monit

    • 192.168.0.2 192.168.0.3

$CD/opt$wget Https://mmonit.com/monit/dist/binary/5.19.0/monit-5.19.0-linux-x64.tar.gz$tar XF MONIT-5.19.0-LINUX-X64.TAR.GZ$CD monit-5.19.0

(2) Configuration Monit

$vim  conf/monitrc# Detection Cycle set daemon  30# process file configuration Set logfile syslogset pidfile  /var/run/monit.pidset idfile /var/.monit.idset statefile /var/.monit.state# Event Queue Set  eventqueue basedir /var/monit slots 100            #配置mmonit (send monitoring data to mmonit for a unified presentation) set mmonit http://monit:[email protected]:8080 /collector# Mail server address set mailserver 10.10.10.10 port 25   username  "[ Email protected] " password " Monit "#自定义发送邮件格式 ($DATE, etc. are monit built-in variables) set mail-format {    from:    [email protected]   subject: monit  alert --   $EVENT   $SERVICE    message:  $EVENT  service $ service                  Date:         $DATE                   Action:       $ACTION                   Host:          $HOST                   Description:  $DESCRIPTION  } #设置报警收件人set  alert [email protected]set alert  [email protected] #配置https, for web interface, can not be configured due to the use of Mmonit interface management .set httpd port 2812  And    use address localhost     allow localhost            allow admin:monit      #----The following are monitoring items, taking several common monitoring items as examples----# #检查monit配置文件更新check  file monitrc path /opt/ monit-5.19.0/conf/monitrc    if changed sha1 checksum    then exec  "/opt/ Monit-5.19.0/bin/monit -c /opt/monit-5.19.0/conf/monitrc reload "#检查系统负载check  system  192.168.0.2    group system    if loadavg  (1min)   > 4 then alert    if loadavg  (5min)  > 2 then  alert    if cpu usage > 95% for 10 cycles  then alert    if memory usage > 75% then alert     if swap usage > 25% then alert# disk each directory space check  filesystem root with path /    group system     if space usage > 90% then alertcheck filesystem usr with  path /usr  &Nbsp; group system    if space usage > 80% then  alertcheck filesystem var with path /var    group  system    if space usage > 90% then alert# Monitoring SSH Service check  process sshd with pidfile /var/run/sshd.pid     start  program  "/etc/init.d/sshd start"      stop program  "/etc/init.d/ Sshd stop "     if failed host 127.0.0.1 port 22  protocol ssh then restart# Monitor Nginx (not only can monitor the process PID file changes, also can monitor 80 ports) Check process nginx  with pidfile /var/run/nginx.pid    start program =  "/etc/ Init.d/nginx start " with timeout 60 seconds    stop program   =  "/etc/init.d/ngInx stop "    if changed pid for 5 cycles then  Restart    if failed port 80 protocol http with timeout  2 seconds then alert


(3) Start Monit

$bin/monit-c CONF/MONITRC

(4) Visit mmonit,192.168.0.1:8080

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/89/20/wKiom1gIeqnCkeJTAACQnLhBvsI764.png "style=" width : 700px;height:427px; "title=" 3.png "width=" "height=" 427 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1gieqnckejtaacqnlhbvsi764.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/89/1E/wKioL1gIeqnwRBMJAACnnQCX0CE150.png "style=" width : 700px;height:228px; "title=" 4.png "width=" "height=" 228 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiol1gieqnwrbmjaacnnqcx0ce150.png "/>

have been able to see 192.168.0.2 and 192.168.0.3 two machines.

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/89/20/wKiom1gIeqqh23nsAAFi1X8Zhe4733.png "style=" width : 700px;height:538px; "title=" 5.png "width=" "height=" 538 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Wkiom1gieqqh23nsaafi1x8zhe4733.png "/>

Click into the machine, you can see the monitoring items of the machine, including system monitoring, process monitoring, file system, configuration file monitoring.




Done!!!!!

At this point, you can go to the machine to try, manually kill the Nginx process, you will find that the process will automatically be pulled up.




Here are two pictures I use to monitor elk clusters, a little more machines.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/89/21/wKiom1gIfNrjktGAAAHyOHhfGhQ827.png "title=" 8.png " Width= "height=" 496 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:496px; "alt=" Wkiom1gifnrjktgaaahyohhfghq827.png "/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/89/21/wKiom1gIfRjDSnx_AAHu_6S9-v8729.png "title=" 9.png " Width= "height=" 560 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:560px; "alt=" wkiom1gifrjdsnx_ Aahu_6s9-v8729.png "/>



This article is from the "Sauce paste" blog, please make sure to keep this source http://heqin.blog.51cto.com/8931355/1863924

Visualize centralized process management using M/monit

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.