因为nmon最新版不支持arm架构,所以需要手动下载源码和编译文件手动生成可执行文件
mkdir -p /usr/local/tools/nmon
cd /usr/local/tools/nmon
1、下载源码
地址:https://nmon.sourceforge.io/pmwiki.php?n=Site.CompilingNmon
wget http://sourceforge.net/projects/nmon/files/lmon16p.c
2、下载编译文件
wget http://sourceforge.net/projects/nmon/files/makefile
手动下载,通过xshell或者其他工具传到虚拟机也行。
3、编辑编译文件
FILE= 这个字段放当前目录里源码文件的名字(上面下载的lmon16p.c文件)
HW= 这个字段按格式放当前系统下执行“uname -p”的内容,还需要拼接架构名arm
OSNAME= 这个字段按格式放当前系统下执行“grep ^NAME /etc/os-release”的内容,还需要拼接系统id(id是通过grep ^ID /etc/os-release得到的)
下面的加粗字体中红色字体就是需要修改或额外添加的内容(总共三处)
vim makefile
# NOTE: link the curent working copy of the code to lmon.c for compiling CFLAGS=-g -O3 -Wall -lm LDFLAGS=-lncurses #FILE=lmo.c FILE=lmon16p.c VERSION=16q #HW=$(shell uname -p | sed 's/ppc64le/POWER/' | sed 's/x86_64/X86/') HW=$(shell uname -p | sed 's/ppc64le/POWER/' | sed 's/x86_64/X86/' | sed 's/aarch64/arm/' ) #OSNAME=$(shell grep ^NAME /etc/os-release | sed 's/NAME=//' | sed 's/Red Hat Enterprise Linux Server/RHEL/' | sed 's/Red Hat Enterprise Linux Workstation/RHEL/' | sed 's/Red Hat Enterprise Linux/RHEL/' | sed 's/"//g' ) OSNAME=$(shell grep ^NAME /etc/os-release | sed 's/NAME=//' | sed 's/Red Hat Enterprise Linux Server/RHEL/' | sed 's/Red Hat Enterprise Linux Workstation/RHEL/' | sed 's/Red Hat Enterprise Linux/RHEL/' | sed 's/CentOS Linux/centos/' | sed 's/"//g' ) OSVERSION=$(shell grep ^VERSION_ID /etc/os-release | tr '"' '.' | cut --delimiter=. --fields=2 ) nmon: cc $(FILE) -o nmon_$(HW)_$(OSNAME)$(OSVERSION)_$(VERSION) $(CFLAGS) $(LDFLAGS) -D $(HW) -D $(OSNAME)$(OSVERSION) gpu: cc $(FILE) -o nmon_$(HW)_$(OSNAME)$(OSVERSION)_$(VERSION)_gpu $(CFLAGS) $(LDFLAGS) -D $(HW) -D $(OSNAME)$(OSVERSION) -D NVIDIA_GPU /usr/lib64/libnvidia-ml.so list: @echo HW $(HW) @echo osname $(OSNAME) @echo osversion $(OSVERSION)
4、安装依赖
yum install ncurses-devel
5、执行make
以下报错就是makefile文件没改好(按照上述改好即可)
改好后,会多出来一个可执行文件,这个时候就能运行了。
mv nmon_arm_centos7_16q nmon
./nmon
引用:
https://blog.csdn.net/mingli_a/article/details/139136654
https://www.modb.pro/db/426322
标签:nmon,虚拟机,cent7,HW,OSNAME,mac,sed,Linux,arm From: https://www.cnblogs.com/yllovexjj/p/18432181