`
sillycat
  • 浏览: 2486685 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Monitor Tool 2019(1)Monit Installation and Usage

 
阅读更多
Monitor Tool 2019(1)Monit Installation and Usage

On CentOS 7
> sudo yum install monit
Check version
> monit -V
This is Monit version 5.25.1
Built with ssl, with ipv6, with compression, with pam and with large files
Copyright (C) 2001-2017 Tildeslash Ltd. All Rights Reserved.

Some useful command
Check configuration file
> sudo monit -t
Control file syntax OK

The configuration file will be
/etc/monitrc
/etc/monit.d/

Start the service
> sudo monit
Starting Monit 5.25.1 daemon with http interface at [localhost]:2812

Reload the configuration
> sudo monit reload
Reinitializing monit daemon

Check status
> sudo monit status
Monit 5.25.1 uptime: 1m
System 'rancher-home'
  status                       OK
  monitoring status            Monitored
  monitoring mode              active
  on reboot                    start
  load average                 [0.09] [0.66] [0.49]
  cpu                          3.2%us 1.7%sy 0.7%wa
  memory usage                 1.3 GB [45.6%]
  swap usage                   264 kB [0.0%]
  uptime                       7m
  boot time                    Sat, 12 Oct 2019 17:14:20
  data collected               Sat, 12 Oct 2019 17:21:46

My first simple configuration file is as follow:
> sudo vi /etc/monitrc
set daemon  30              # check services at 30 seconds intervals
set httpd port 2812 and
    use address rancher-home
    allow admin:admin
include /etc/monit.d/*

Visit this page to see some basic monitor informations.
http://rancher-home:2812/

We can configure all the monitor separately in /etc/monit.d/*

Check Disk
> df -lh
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 1.4G     0  1.4G   0% /dev
tmpfs                    1.4G     0  1.4G   0% /dev/shm
tmpfs                    1.4G  9.3M  1.4G   1% /run
tmpfs                    1.4G     0  1.4G   0% /sys/fs/cgroup
/dev/mapper/centos-root   36G   12G   25G  33% /
/dev/sda1               1014M  232M  783M  23% /boot
tmpfs                    285M     0  285M   0% /run/user/1000

Add the configuration file follow the pattern

check <Type> <ServiceName> [PATH <path>] [ADDRESS <host address>]

Type - system, file, process, fifo, filesystem, directory, host, network, program

> cat /etc/monit.d/filesystem
check filesystem datafs with path /dev/mapper/centos-root
  if space usage > 50% then alert
  group server

Check config
> sudo monit -t
Control file syntax OK

Restart the service
> sudo monit reload
Reinitializing monit daemon

More example:
https://www.cnblogs.com/52fhy/p/6412547.html

Try monitor HAProxy
http://rancher-home:8100/stats
PID file
> ls -l /opt/haproxy/haproxy.pid
-rw-r--r--. 1 root root 12 Oct 13 11:33 /opt/haproxy/haproxy.pid

REG process
> ps -ef | grep haproxy
nobody   23904     1  0 11:33 ?        00:00:00 sbin/haproxy -f conf/haproxy.conf
nobody   23905     1  0 11:33 ?        00:00:00 sbin/haproxy -f conf/haproxy.conf
carl     25127 17104  0 11:38 pts/1    00:00:00 grep --color=auto haproxy

Here is how the haproxy configuration
> cat /etc/monit.d/haproxy
check process haproxy with pidfile /opt/haproxy/haproxy.pid
  start program = "/opt/haproxy/sbin/haproxy -f /opt/haproxy/conf/haproxy.conf" with timeout 20 seconds
  stop program = "/usr/bin/kill haproxy"
  if changed pid then restart

Latest document
https://mmonit.com/monit/documentation/monit.html

Source Installation
https://cloud.tencent.com/developer/article/1114319
Check the latest version from here
https://mmonit.com/monit/dist/

> wget https://mmonit.com/monit/dist/monit-5.26.0.tar.gz
> tar zxvf monit-5.26.0.tar.gz
> cd monit-5.26.0

Some possible Exception
configure: error: libz not found

configure: error: PAM enabled but headers or library not found, install the PAM development support or run configure --without-pam

Couldn't find your SSL header files.
Use --with-ssl-incl-dir option to fix this problem or disable
the SSL support with --without-ssl

Prepare build ENV if needed
> sudo yum groupinstall "Development tools"
> sudo yum install zlib-devel
> sudo yum list *pam*
> sudo yum install pam-devel
> sudo yum install openssl-devel


Configure and Build
> ./configure --prefix=/home/carl/tool/monit-5.26.0
> make
> make install

Prepare the configuration file
> sudo cp monitrc /etc/monitrc
> sudo chown root:root /etc/monitrc
> sudo chmod 0700 /etc/monitrc

> sudo ln -s /home/carl/tool/monit-5.26.0 /opt/monit-5.26.0
> sudo ln -s /opt/monit-5.26.0 /opt/monit

Change the configuration as follow:
set httpd port 2812 and
    use address rancher-worker2
    allow 0.0.0.0/0.0.0.0
    allow admin:admin
  include /etc/monit.d/*

Start the service
> sudo bin/monit


References:
https://www.jianshu.com/p/248d6456e83f
https://linjunzhu.github.io/blog/2015/08/14/ru-he-shi-yong-monitjian-kong-jin-cheng/
https://mmonit.com/monit/documentation/monit.html
https://cloud.tencent.com/developer/article/1114319
分享到:
评论

相关推荐

    ISO 16505-2019 Road vehicles — Ergonomic and performance aspects of Camera Monit

    The purpose of this document is to give minimum safety, ergonomic, and performance requirements and test methods for Camera Monitor Systems (CMS) to replace mandatory inside and outside rearview ...

    WSN.rar_ Vibration sensor_WSN MONITOR_physical_temperature monit

    A wireless sensor network (WSN) consists of spatially distributed autonomous sensors to cooperatively monitor physical or environmental conditions, such as temperature, sound, vibration, pressure, ...

    monit使用说明.docx

    Monit是unix系统上用于管理监视进程、文件、目录及设备的工具。Monit提供自动维护和修复功能,并能在出错时执行相应的关联的行为。比如monit可以开启一个进程(当它没有正常运行),重启一个进程(如果它没有反应)...

    Ansible-monit.zip

    Ansible-monit.zip,配置monit的ansible角色。还将设置ssh、ntp和cron.anxs-monit的基线监视,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。

    monit监控工具(客户端)

    centos6.5 monit 监控 性能 程序自动化监控

    Android代码-Advanced Battery Monitor

    Advanced Battery Monitor I used to have a battery usage graph widget on my home page (I won't say which one, but it was quite popular), but after I bought a Nexus 5, it started to have problems -- it ...

    ISO TR 27923-2022 Injection operations, infrastructure and monit

    ISO TR 27923-2022 Carbon dioxide capture, transportation and geological storage - Injection operations, infrastructure and monit.pdf

    monit 服务端监控

    monit软件可监控软件部署服务端口及名称,使用方便切软件规模小

    监测应用monit

    Monit是一款功能非常丰富的进程、文件、目录和设备的监测软件。它可以自动修复那些已经停止运作的程序,特使适合处理那些由于多种原因导致的软件错误。

    centos7安装monit

    监控进程,守护进程,实时拉起进程,监控工具脚本,用于程序拉起,监控程序状态,程序停止,启动等功能.....

    monit-5.4.tar.gz

    monit-5.4.tar.gz qsdk 编译包

    ansible-monit:Monit的Ansible角色

    Ansible角色,用于安装Monit并设置服务监视。 用法(示例) 典型的最小用法: - role : monit 在不安装和使用自定义服务的情况下配置monit: - role : monit monit_setup : configure monit_custom_services ...

    docker-monit:用于monit的Docker映像

    docker-monit可用于从提取该图像包括监控版本5.13概述此映像将monit安装到以下位置: / opt / monit Monit配置为由runit(phusion / baseimage-docker的init系统)执行和管理。 它将以名为monit的非特权用户身份...

    monit:ASYD 的 Monit 分叉

    AsydSolutions/monit 这是来自官方的分支,包括一些小的更改,用于从 XML Web API 获取更详细的输出以用于 ASYD(即主机故障通知)。 ASYD 版本基于带有上述补丁的最新稳定版 Monit(当前为 5.11)。 您可以查看...

    monit_bin:从源代码安装monit并使用LWRP添加几个工具

    monit_bin 食谱 从源安装monit。 包括设置工具monitensite、monitdisite。 为创建的配置添加 LWRP。 要求 制作(构建必不可少) 平台 乌本图 智能操作系统 用法 recipe[monit]默认安装。 从其他食谱调用 include...

    SourceMonitor

    SourceMonitor (TM) Version 3.5 Campwood Software LLC, Burlington, Vermont 05401. www.campwoodsw.com. Copyright ?Campwood Software LLC. All Rights Reserved. Freeware License Agreement SourceMonitor...

    monit-rpm:为最新的Monit(RedHat CentOS)构建RPM软件包

    CentOS / RHEL 7+上的最新Monit(8 ...等) 使用以下命令在CentOS上安装最新的Monit: sudo yum -y install https://extras.getpagespeed.com/release-el$(rpm -E %{rhel})-latest.rpm sudo yum install monit ...

    monit-5.0.1.tar.gz_monit-5.0.1.tar.gz

    monit-5.0.1.tar.gz 有需要的可以下载看看

    USB 1.0 Spec Position on Extension Cables and Pass-Through Monit

    USB 1.0 Spec Position on Extension Cables and Pass-Through Monitors

    monit-dashboard:Web仪表板,可一目了然地监控所有monit服务器

    每个Monit服务器未找到警报时的主视图: 一个Monit代理正在报告服务器上的错误: 展开服务器,上面有错误的问题: 它是如何工作的? 应用程序每隔300秒(经过硬编码)会在每个已配置的服务器的XMl报告中要求...

Global site tag (gtag.js) - Google Analytics