​19-nmon

nmon

http://nmon.sourceforge.net/

C语言编写本身资源消耗非常小

部署到被测试服务器上,可以监控不同的Linux系统(不同的linux发行版本,nmon命令是不同的)

查看Linux的发行版本

cd /etc查看路径下有没有「release」关键字的文件

查看redhat家族的发行版本
[root@vircent7 ~]# cat /etc/redhat-release 
CentOS Linux release 7.8.2003 (Core)
查看Ubuntu的发行版本
root@zx:/# cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

确定下载的文件

进入http://nmon.sourceforge.net/pmwiki.php?n=Site.Download找到有符合当前Linux版本信息的文件下载

解压

[root@vircent7 nmon16m_helpsystems]# ls
nmon_power_64_centos6      nmon_power_64_linux   nmon_x86_64_mint19      nmon_x86_64_rhel8
nmon_power_64_centos7      nmon_power_64_rhel6   nmon_x86_64_oel5        nmon_x86_64_sles10
nmon_power_64le_centos7    nmon_power_64_rhel7   nmon_x86_64_oel6        nmon_x86_64_sles11
nmon_power_64le_centos8    nmon_power_64_sles11  nmon_x86_64_oel7        nmon_x86_64_sles12
nmon_power_64le_linux      nmon_x86_64_centos5   nmon_x86_64_oel8        nmon_x86_64_sles15
nmon_power_64le_rhel7      nmon_x86_64_centos6   nmon_x86_64_opensuse10  nmon_x86_64_ubuntu14
nmon_power_64le_rhel7_gpu  nmon_x86_64_centos7   nmon_x86_64_opensuse11  nmon_x86_64_ubuntu16
nmon_power_64le_rhel8      nmon_x86_64_centos8   nmon_x86_64_opensuse12  nmon_x86_64_ubuntu18
nmon_power_64le_sles12     nmon_x86_64_debian08  nmon_x86_64_opensuse15  nmon_x86_64_ubuntu19
nmon_power_64le_ubuntu14   nmon_x86_64_debian09  nmon_x86_64_rhel5
nmon_power_64le_ubuntu16   nmon_x86_64_debian10  nmon_x86_64_rhel6
nmon_power_64le_ubuntu18   nmon_x86_64_mint18    nmon_x86_64_rhel7

nmon三种运行模式

实时屏幕交互

优点:可以通过屏幕实时看到服务器资源使用情况

缺点:只能看到,无法保存数据

[root@vircent7 nmon16m_helpsystems]# ./nmon_x86_64_centos7
实时屏幕交互

常用命令cmdrtn

截屏2021-05-16 上午7.50.17
  • c:cpu信息

CPU

CPU下面的数字表示有几核

User%:用户态cpu的使用率

Sys%:系统态cpu的使用率

Wait%:等待的cpu占用率

Idle%:空闲cpu的占用率

  • m:内存

内存
  • d:磁盘读写

磁盘读写
  • r:资源

资源
  • t:top命令

top
  • n:网络

网络
数据收集模式
-f            spreadsheet output format [note: default -s300 -c288]
                         output file is <hostname>_YYYYMMDD_HHMM.nmon
-s <seconds>  Time between snap shots - with "-c count" decides duration of the data capture
-c <number>   The number of snapshots before nmon stops

-f=-s 300 -c 288每隔300秒收集一次数据,收集288次。收集完成后自动结束。总共会收集300*288=24小时

-s num:间隔多长时间收集一次数据

-c num:总共收集的次数

运行后会生成vircent7_210327_1457.nmon

该文件打开后难以查看结果,需要导出后使用Excel宏解读

解析的nmon analyser v66.xlsm文件,需要使用Office的Excel打开

打开后点击分析按钮,就可以查看到图表展示

链接: https://pan.baidu.com/s/183jY_ktWO3gxouIFb3KYfw  密码: ri7h

./nmon_x86_64_centos7 -f #收集24小时
./nmon_x86_64_centos7 -f -s2 -c200 #按照设定的间隔和次数收集
./nmon_x86_64_centos7 -f -s2 -c200 -m /tmp/mon #指定输出到一个存在的文件夹路径下
定时收集模式
Capacity Planning mode - use cron to run each day
        -x            Sensible spreadsheet output for one day
                      Every 15 mins for 1 day ( i.e. -ft -s 900 -c 96)
        -X            Sensible spreadsheet output for busy hour
                      Every 30 secs for 1 hour ( i.e. -ft -s 30 -c 120)
        -z            Like -x but the output saved in /var/perf/tmp assuming root user

-X:收集一小时

-x:收集一天

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值