zoukankan      html  css  js  c++  java
  • Linux Monit 开源服务器监控工具

    Monit是一个用于管理和监控系统的小型开源工具。monit可以监控服务器进程状态、HTTP/TCP状态码、服务器资源、文件系统变化等。可以设置邮件报警,重启进程等。

    官网文档
    https://mmonit.com/monit/documentation/monit.html

    安装

    yum install monit

    常用命令

    monit -t  检查配置文件
    monit -c  启动monit时指定配置文件
    monit reload  更新配置后重新加载
    monit status  查看所有服务状态
    monit status servicename  查看某个服务状态
    monit stop all  停止所有服务
    monit stop servicename  停止某个服务
    monit start all  启动所有服务
    monit start servicename  启动某个服务
    monit -V  查看monit版本

    全局配置Web界面

    1、Monit version 5.25.1 默认监听 2812
       浏览器输入http://localhost:2812登录网页版查看实时状态
    2、对web界面的访问是通过SSL加密的
    3、使用monit/admin账号密码登陆

    配置文件

    cat /etc/monit.conf
    set daemon  30              # check services at 30 seconds intervals
    set log syslog
    set httpd port 2812 and
        allow localhost        # allow localhost to connect to the server and
        allow 192.168.0.0/255.0.0.0
        allow 192.17.0.0/255.255.0.0
        allow monit:admin      # require user 'monit' with password 'admin'
    
    check process zabbix-agent with pidfile "/var/run/zabbix_agented.pid"
            start program = "/etc/init.d/zabbix-agent start"
            stop program = "/etc/init.d/zabbix-agent stop"
    check process dnsmasq with pidfile "/var/run/dnsmasqe.pid"
            start program = "/etc/init.d/dnsmasq start"
            stop  program = "/etc/init.d/dnsmasq stop"
    
    # 匹配进程名 
    #check process flask MATCHING gunicorn 
    # 配置服务启动和重启命令 
    #start program = "/usr/bin/sudo service mongod start" 
    #restart program = "/usr/bin/sudo service mongod restart" 
    # 如果端口27017无法访问则认为服务失败,发报警邮件并重启服务 
    #if failed port 27017 type tcp then alert 
    #if failed port 27017 type tcp then restart 
    # 如果在三个周期内重启了3次,则不再监控 # 
    #if 3 restarts within 3 cycles then unmonitor

    其他更多功能可查看官方文档。

    参考https://blog.csdn.net/qin_weilong/article/details/90639769

          https://www.cnblogs.com/zzhaolei/p/11068041.html

  • 相关阅读:
    ssh中使用spring的集成quartz 编写定时任务
    ssh只读事务的管理
    ssh2的application.xml配置文件配置详解
    spring中使用 @value 简化配置文件的读取
    【转】Spring Annotation 详解
    ssh之<context:component-scan base-package="com.xx" />
    ssh2学习-applicationContext.xml文件配置-----<context:annotation-config/>详解
    【转】线程同步------java synchronized详解
    java web程序中项目名的更改(http://localhost:8080/)后面的名字
    mysql 5.6 修改root原始密码不为空方法
  • 原文地址:https://www.cnblogs.com/hankyoon/p/13502699.html
Copyright © 2011-2022 走看看