Article Directory
HostMonitor User Manual-monitor network, remaining disk space, remaining memory, CPU usage, whether you can access the port number corresponding to an IP address
1. Install HostMonitor on windows
HM download address :https://www.ks-soft.net/hostmon.eng/downpage.htm
Double-click to host-mon.exe
install and continue to the next step.
After opening HostMonitor, you can see the following interface, there are many monitoring templates for reference. If you are not familiar with the configuration, do not delete it at the end, for the convenience of viewing later.
You can see from the template: HM can monitor the network , cpu , disk space , memory usage , URL access , nginx .
In order to keep the interface clean, I deleted the template as follows:
2. Install rma on the linux host
rma download address : https://www.ks-soft.net/download/rma/rma136_lin_64.tgz
upload and decompress the rma compressed package to the /opt/rma directory:
[root@master ~]# ll rma136_lin_64.tgz
-rw-r--r--. 1 root root 225280 9月 25 13:45 rma136_lin_64.tgz
[root@master ~]# mkdir /opt/rma
[root@master ~]# tar xf rma136_lin_64.tgz -C /opt/rma
[root@master ~]# cd /opt/rma/
[root@master rma]# ll
总用量 224
-rwxrwxrwx. 1 abong abong 809 1月 20 2010 cpu.sh
-rw-rw-rw-. 1 abong abong 12753 4月 23 01:53 INSTALL
-rw-rw-rw-. 1 abong abong 4641 4月 23 01:54 LICENSE
-rwxrwxrwx. 1 abong abong 787 2月 22 2007 proccnt.sh
-rwxrwxrwx. 1 abong abong 543 2月 22 2007 proclist.sh
-rw-rw-rw-. 1 abong abong 2996 4月 23 01:53 README
-rwxrwxr-x. 1 abong abong 178976 4月 23 01:58 rma
-rw-rw-rw-. 1 abong abong 7635 4月 23 01:55 rma.ini
Edit the rma configuration file:
[root@master ~]# vim /opt/rma/rma.ini
23 [Basic]
30 RmaPath = /opt/rma/rma # 启动程序
80 Password=123456 # 密码
Start the rma client:
[root@master rma]# /opt/rma/rma -d /opt/rma/rma.ini
-------------------------------------------------------------
Application: RMA (Remote Monitoring Agent for HostMonitor)
Version: 1.36 for Linux (Red Hat, Debian, Ubuntu)
Copyright: 2004 - 2010 Alexander Kozlov
web: http://www.ks-soft.net
e-mail: [email protected]
-------------------------------------------------------------
Command line checking .. Ok
Settings checking .. Ok
CPU testing .. Ok
Basic encyption checking .. Ok
RMA encyption checking .. Ok
Sock testing .. Ok
Daemon started
# rma要启动成功,需要glibc达到2.14或者2.15版本。这里的glibc是2.17版本。
[root@master ~]# rpm -qa | grep glibc
glibc-common-2.17-260.el7.x86_64
glibc-2.17-260.el7.x86_64
glibc-headers-2.17-260.el7.x86_64
glibc-devel-2.17-260.el7.x86_64
[root@master ~]# strings /lib64/libc.so.6 | grep GLIBC
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE
If you start the rma client and find an error saying that you cannot find GLIBC_2.15 or GLIBC_2.14, you can upgrade to the GLIBC version
[root@master lib64]# /opt/rma/rma -d /opt/rma/rma.ini
/opt/rma/rma: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /opt/rma/rma)
/opt/rma/rma: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/rma/rma)
[root@master ~]# rpm -qa | grep glibc # 可以看到安装的仅仅是glibc2.12版本的,故问题应该是在于glibc版本太低了。
glibc-headers-2.12-1.107.el6.x86_64
compat-glibc-2.5-46.2.x86_64
glibc-2.12-1.107.el6.x86_64
compat-glibc-headers-2.5-46.2.x86_64
glibc-devel-2.12-1.107.el6.x86_64
glibc-2.12-1.107.el6.i686
glibc-common-2.12-1.107.el6.x86_64
[root@master ~]# strings /lib64/libc.so.6 | grep GLIBC # 查看包含libc.so.6模块的GLIBC各个版本情况,最新的就是2.12版本。
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_PRIVATE
Upgrade glibc to version 2.15:
下载地址:http://ftp.gnu.org/pub/gnu/glibc/
glibc-2.15下载地址:http://ftp.gnu.org/pub/gnu/glibc/glibc-2.15.tar.gz
[root@master ~]# tar xzvf glibc-2.15.tar.gz
[root@master ~]# cd glibc-2.15/
[root@master glibc-2.15]# mkdir build
[root@master glibc-2.15]# cd build/
[root@master build]# ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
[root@master build]# make && make install # 最后显示如下就表示已经安装好glibc-2.15了
Your new glibc installation seems to be ok.
make[1]: Leaving directory `/root/glibc-2.15'
3. Monitor the network
[root@master ~]# iptables -F # 清空防火墙策略,可以通过/var/log/messages看到被拦截了。
Add remote host to the remote host list:
configure the network to monitor the remote host:
view network conditions:
4. Monitor Disk Space
You can see that the remaining space of the / directory is 22%, and the remaining space of the /boot directory is 83%
5. Monitor memory usage
Check the memory usage:
free=72,total=972, the percentage of free memory is 7.41%
The script to monitor the percentage of remaining memory is as follows:
#!/bin/sh
if [ $# -ge 1 ]
then
OS=`uname`
case $OS in
AIX) PCOUNT=`vmstat|tail -1|awk '{print $4*4}'`;;
Linux) PfreeMem=`free -m | awk 'NR==2{print $4}'`;Ptotal=`free -m | awk 'NR==2{print $2}'`;PCOUNT=`echo "($PfreeMem*100/$Ptotal)"|bc`;;
FreeBSD)PCOUNT=`vmstat|tail -1|awk '{print $5}'`;;
NetBSD) PCOUNT=`vmstat|tail -1|awk '{print $5}'`;;
OpenBSD)PCOUNT=`vmstat|tail -1|awk '{print $5}'`;;
SunOS) PCOUNT=`vmstat|tail -1|awk '{print $5}'`;;
*) echo 'ScriptRes:Unknown:script is not designed for '$OS
exit;;
esac
if [ $PCOUNT -le $1 ]
then
echo "ScriptRes:Bad:"$PCOUNT"%"
else
echo "ScriptRes:Ok:"$PCOUNT"%"
fi
else
echo 'ScriptRes:Unknown:not enough parameters specified'
fi
The monitoring results are as follows, you can see that the remaining memory is less than 20%, only 7%.
Adjust the monitoring threshold to 5% here and see if it will be displayed in green. You can see that it will. At this point, the percentage of remaining memory has also been monitored. [The remaining memory threshold is generally above 20%, that is, when the memory usage exceeds 80%, an alert will be issued. 】
6. Monitor CPU
7. Detect the connectivity of a certain port of a certain IP address
Baidu address : http://14.215.177.39/
monitor whether the host 192.168.43.5 can access Baidu:
You can see that it is accessible.
8. Summary
HostMonitor this free and open source monitoring software, monitor more content, this article describes ping
, 剩余磁盘空间
, 剩余内存
, CPU使用百分比
, 是否可以访问某个网站
. When there are many monitoring contents to be configured, Test name
be sure to write clearly the role, so that operation and maintenance personnel and developers can see more clearly. To monitor other content, you can refer to the monitoring template that comes with the installation, and the configuration is similar. You can also leave a message under this article to discuss together.