这期内容当中小编将会给大家带来有关如何解决ESXi 主机上最重要的调试工具esxtop输出满屏乱码的问题,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
VMware vSphere 6.7中,允许登录 SSH登录ESXi主机后,我试着运行了一下esxtop,没有看到类似Linux top相似的结果,却看到满屏幕的乱码。如下:
no termcap entry for a `xterm-256color' terminal"(PDH-CSV 4.0) (UTC)(0)", "\\172.localdomain\Memory\Memory Overcommit (1 Minute Avg)", "\\172.localdomain\Memory\Memory Overcommit (5 Minute Avg)", "\\172.localdomain\Memory\Memory Overcommit (15 Minute Avg)", "\\172.localdomain\Physical Cpu Load\Cpu Load (1 Minute Avg)", "\\172.localdomain\Physical Cpu Load\Cpu Load (5 Minute Avg)", "\\172.localdomain\Physical Cpu Load\Cpu Load (15 Minute Avg)", "\\172.localdomain\Physical Cpu(0)\% Processor Time", "\\172.localdomain\Physical Cpu(1)\% Processor Time", "\\172.localdomain\Physical Cpu(_Total)\% Processor Time", "\\172.localdomain\Physical Cpu(0)\% Util Time", "\\172.localdomain\Physical Cpu(1)\% Util Time", "\\172.localdomain\Physical Cpu(_Total)\% Util Time", "\\172.localdomain\Memory\Machine MBytes"," \\172.localdomain\Memory\Kernel MBytes", "\\172.localdomain\Memory\NonKernel MBytes", "\\172.localdomain\Memory\Free MBytes", "\\172.localdomain\Memory\Kernel Managed MBytes", "\\172.localdomain\Memory\Kernel MinFree MBytes", "\\172.localdomain\Memory\Kernel Reserved MBytes", "\\172.localdomain\Memory\Kernel Unreserved MBytes", "\\172.localdomain\Memory\Kernel State", "\\172.localdomain\Memory\PShare Shared MBytes", "\\172.localdomain\Memory\PShare Common MBytes", "\\172.localdomain\Memory\PShare Savings MBytes", "\\172.localdomain\Memory\Swap Used MBytes", "\\172.localdomain\Memory\Swap Target MBytes", "\\172.localdomain\Memory\Swap MBytes Read/sec", "\\172.localdomain\Memory\Swap MBytes Write/sec", "\\172.localdomain\Memory\Total Compressed MBytes", "\\172.localdomain\Memory\Total Saved By Compression MBytes", "\\172.localdomain\Memory\Memctl Current MBytes", "\\172.localdomain\Memory\Memctl Target MBytes", "\\172.localdomain\Memory\Memctl Max MBytes", "\\172.localdomain\Power\Power Usage Now Watts", "\\172.localdomain\Power\Power Usage Cap Watts", "\\172.localdomain\VSAN\Enabled?", "\\172.localdomain\Group Cpu(1:system)\Members", "\\172.localdomain\Group Cpu(1:system)\% Used", "\\172.localdomain\Group Cpu(1:system)\% Run", "\\172.localdomain\Group Cpu(1:system)\% System", "\\172.localdomain\Group Cpu(1:system)\% Wait", "\\172.localdomain\Group Cpu(1:system)\% Ready", "\\172.localdomain\Group Cpu(1:system)\% Idle", "\\172.localdomain\Group Cpu(1:system)\% Overlap", "\\172.localdomain\Group Cpu(1:system)\% CoStop", "\\172.localdomain\Group Cpu(1:system)\% Max Limited", "\\172.localdomain\Group Cpu(1:system)\% Swap Wait", "\\172.localdomain\Vcpu(1:system:2097153:idle1)\% Used", "\\172.localdomain\Vcpu(1:system:2097153:idle1)\% Run", "\\172.localdomain\Vcpu(1:system:2097153:idle1)\% System", "\\172.localdomain\Vcpu(1:system:2097153:idle1)\% Wait", "\\172.localdomain\Vcpu(1:system:2097153:idle1)\% VmWait", "\\172.localdomain\Vcpu(1:system:2097153:idle1)\% Ready", "\\172.localdomain\Vcpu(1:system:2097153:idle1)\% Idle",
本来vSphere还得依靠它来查看系统信息呢,esxtop却乱成一团,这可如何是好?去网上搜一搜,居然也有人经历过相同的遭遇,VMware官网上有解决方法,如下:
[root@172:~] echo $TERM xterm-256color
第1行中的no termcap entry for a `xterm-256color' terminal就是告诉我们:对于xterm-256color这种控制终端,在本机的数据库里没有找到,所以就显示不出来正确的格式。既然不支持,就找一个能支持的终端吧。
[root@172:~] find /usr/share/terminfo/ -type f /usr/share/terminfo/v/vt102 /usr/share/terminfo/x/xterm /usr/share/terminfo/s/screen /usr/share/terminfo/l/linux /usr/share/terminfo/a/ansi
看吧,terminfo数据里能被ESXi主机支持的控制终端有5个,随便选一个来试试。
# TERM=XTERM esxtop
设为第2种xterm。马上就好了!另外几种,也都可以。问题暂时解决了。要是下一次登录,又不能显示,怎么办?
那就在/etc/bashrc里添加这个TERM变量。不行,没有这个文件。/etc/profile倒是有,不过是只读的,root也没有权限修改。倒是有个/etc/profile.local的权限是1644,root是用户,可以修改。打开来看,里面有一句说:
This file is not used when UEFI secure boot is enabled.
意思是说,要是使用UEFI安全启动,这个文件就废了。不管那么多了,修改一下,在里面添加这么两句:
TERM=xterm
export $TERM
然后,再引用一下这个文件。
# source /etc/profile.local
测试一下。先把TERM设为别的变量。
# TERM=test # source /etc/profile.local # echo $TERM
显示的是xterm。下次vSphere重新启动的时候,会读这个文件吗?我还没有试过。
上述就是小编为大家分享的如何解决ESXi 主机上最重要的调试工具esxtop输出满屏乱码的问题了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。