centos7使用monit监控服务运行状态

centos7使用monit监控服务运行状态

Lee_吉关注0人评论427人阅读2018-10-23 00:22:46

  1. 安装:
    yum  -y  install  epel-release
    yum  -y  install  monit
  2. 配置:
    vim /etc/monitrc
    set daemon  30
    set log syslog
    set httpd port 2812 and
    use address 172.20.10.11
    allow 172.20.10.2
    allow admin:monit
    #with ssl {            # enable SSL/TLS and set path to server certificate
    #    pemfile: /etc/ssl/certs/monit.pem
    #}
    include /etc/monit.d/*
  3. 配置监控服务:
    a. 监控apache:
    vim /etc/monit.d/apache
    check  process  apache  with  pidfile  /etc/httpd/logs/httpd.pid
    start  program  =  "/usr/bin/systemctl  start  httpd"
    stop  program    =  "/usr/bin/systemctl  stop  httpd"

    b. 监控mysql:
    vim /etc/monit.d/mysql

    check  process  mysql  with  pidfile  /usr/local/mysql/data/lee.pid
    start  program  =  "/usr/bin/systemctl  start  mysqld"
    stop  program    =  "/usr/bin/systemctl  stop  mysqld"

    c. 监控ssh:
    vim /etc/monit.d/ssh

    check  process  ssh  with  pidfile  /run/sshd.pid
    start  program  =  "/usr/bin/systemctl  start  sshd"
    stop  program    =  "/usr/bin/systemctl  stop  sshd"
  4. 常用语法:
    a. 检测配置文件语法:
    monit  -t

    centos7使用monit监控服务运行状态
    b. 启动服务:

    systemctl  start  monit

    c. 停止服务:

    systemctl  stop  monit

    d. 重启服务:

    systemctl  restart  monit

    e. 查看服务运行状态:

    systemctl  status  monit  -l

    f. 查看错误日志:

    tail  /var/log/monit.log
  5. 监控页面截图:
    centos7使用monit监控服务运行状态
    centos7使用monit监控服务运行状态

©著作权归作者所有:来自51CTO博客作者Lee_吉的原创作品,如需转载,请注明出处,否则将追究法律责任

好知识,才能

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值