Centos7 using Monit to monitor service operation status

Source: Internet
Author: User

  • Installation:
    yum  -y  install  epel-releaseyum  -y  install  monit
  • Configuration:
    Vim/etc/monitrc
    set daemon  30set log syslogset httpd port 2812 anduse address 172.20.10.11allow 172.20.10.2allow admin:monit#with ssl {            # enable SSL/TLS and set path to server certificate#    pemfile: /etc/ssl/certs/monit.pem#}include /etc/monit.d/*
  • Configuring Monitoring services:
    A. Monitoring apache:
    Vim/etc/monit.d/apache
      check process Apache with PIDFILE/ETC/HTTPD/LOGS/HT Tpd.pidstart program = "/usr/bin/systemctl start httpd" Stop program = "/usr/bin/systemctl Stop httpd"  pre> 

    B. Monitoring mysql:
    vim/etc/monit.d/mysql

      check process MySQL with Pidfile/usr/local/mysql/data/lee . Pidstart program = "/usr/bin/systemctl start mysqld" Stop program = "/usr/bin/systemctl Stop mysqld"  

    C. Monitoring ssh:
    vim/etc/monit.d/ssh

      check process ssh with Pidfile/run/sshd.pidstart program = "/usr/bin/systemctl start sshd" Stop program = "/usr/bin/systemctl stop sshd"  
  • Common syntax:
    A. Detection profile syntax:
    monit  -t


    B. Start the service:

    systemctl  start  monit

    C. Cessation of Service:

    systemctl  stop  monit

    D. Restart the service:

    systemctl  restart  monit

    E. View service health status:

    systemctl  status  monit  -l

    F. Viewing the error log:

    tail  /var/log/monit.log
  • Monitoring page:

  • Centos7 using Monit to monitor service operation status

    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.