前言
nmon 是一款分析 AIX 和 Linux 性能的免费工具。使用非常简单。可以方便的把服务器的CPU、IO、网络等信息转化成方便查看的表格和图形。
nmon 的arm版本目前没有看到有现成的rpm包,自己从源码编译一下也很简单,可以参考官网的说明。
软件获取
x86直接官网下载就好了
arm 根据下面的指导编译
编译指导
下载源码
这里下载源码,源码就一个c文件
安装依赖
- Debian / Ubuntu
sudo apt-get update
sudo apt-get install gcc*
sudo apt-get install ncurses-dev*
sudo apt-get install make
- Fedora / Redhat /Centos - as the root user (centos7.6 参考这个)
yum install gcc*
yum install ncurses-dev*
yum install make
- OpenSUSE / SUSE - as the root user
yast install gcc*
yast install ncurses-dev*
yast install make
下载makefile示例
下载查看makefile样例,直接用gcc命令编译:
gcc -o [输出文件名] [源码文件] [CFLAGS] [LDFLAGS] -D ARM
CFLAGS=-g -O3 -Wall -D JFS -D GETUSER -D LARGEMEM
LDFLAGS=-lncurses -lm -g
编译
gcc -o nmon_arm lmon16m.c -g -O3 -Wall -D JFS -D GETUSER -D LARGEMEM -lncurses -lm -D ARM
编译成功:
可以看到目标文件 nmon_arm
已经生成
./nmon_arm
测试下:
![待补充][1]
root@atlas:/home/S1# ./nmon
┌nmon─16k───────H for help]───Hostname=atlas─Refresh= 2secs ───04:51.20─┐ 2
│ │
│ - │
│ _ __ _ __ ___ ___ _ __ For help type H or ... │
│ | '_ \| '_ ` _ \ / _ \| '_ \ nmon -? - hint │
│ | | | | | | | | | (_) | | | | nmon -h - full details │
│ |_| |_|_| |_| |_|\___/|_| |_| │
│ To stop nmon type q to Quit │
│ - │
│ │
│ DISTRIB_ID=Ubuntu DISTRIB_CODENAME=bionic │
│ Vendor=not-set Model=not-set │
│ MHz=not-set bogomips=200.00 lscpu:CPU=128 Little Endian │
│ Sockets=2 Cores=64 Thrds=1 │
│ MHz=0 max=0 min=0 │
│ │
│ Use these keys to toggle statistics on/off: │
│ c = CPU l = CPU Long-term - = Faster screen updates │
│ C = " WideView U = Utilisation + = Slower screen updates │
│ m = Memory V = Virtual memory j = File Systems │
│ d = Disks n = Network . = only busy disks/procs │
│ r = Resource N = NFS h = more options │
│ k = Kernel t = Top-processes q = Quit │
│─│
后台抓log,命令:
./nmon_arm -c 360 -s 10 -F /xxx/nmon_logfile1.nmon
每隔10s采样一次 ,共抓去360个点(一个小时)的性能数据存入 /xxx/nmon_logfile1.nmon
文件
文件解析工具nmon_analyser:
通过查看磁盘利用率,就可以知道磁盘是否是全部占用。
iostat -xm 2 /dev/sdb
-x
表示刷新时间,对应后端2,表示每2 s刷新一次
-m
表示以MB的单位时间。
最新版本:
https://sourceforge.net/projects/nmon/files/nmon_analyser_v66.zip
http://nmon.sourceforge.net/pmwiki.php?n=Site.Nmon-Analyser
https://www.ibm.com/developerworks/cn/aix/library/nmon_analyser/