esxtop does not like to work on the Mac out of the box. And this has nothing to do with the OS itself! Read on to find out what exactly is going on and how to get esxtop working
Most *NIX systems have something called a TERM/terminal and an environment variable tells the system what the default terminal emulation is and hence, the functionalities that need to work for the terminal environment you are on
Most *nix systems have interchangeable terms available and you can use Terminal options on say a Mac to change aspects of the same.
This is what the screen looks like
As you can see, there are various terminal emulation modes that mac actually supports, including term, xterm, xterm-256 etc
So the question is, what actually happens if you change the emulation modes or terminal types?
While the system capabilities generally dictate which terminal types can be used, as a general rule of thumb, any *nix systems should generally be able to move from one terminal type to another with little concerns or issues. Things like colours and type options might change, but generally, the terminals should be functional.
The terminal types are defined in the termcap database and makes for good reading if you look up the man pages for termcap and term on your Linux machine!
Ok now coming back to the main issue. Here is how the terminal looks like once you try running esxtop on a Mac
[root@test:~] esxtop
no termcap entry for a `xterm-256color' terminal"(PDH-CSV 4.0) (UTC)(0)","\\test\Memory\Memory Overcommit (1 Minute Avg)","\\test\Memory\Memory Overcommit (5 Minute Avg)","\\test\Memory\Memory Overcommit (15 Minute Avg)","\\test\Physical Cpu Load\Cpu Load (1 Minute Avg)","\\test\Physical Cpu Load\Cpu Load (5 Minute Avg)","\\test\Physical Cpu Load\Cpu Load (15 Minute Avg)","\\test\Physical Cpu(0)\% Processor Time","\\test\Physical Cpu(1)\% Processor Time","\\test\Physical Cpu(2)\% Processor Time","\\test\Physical Cpu(3)\% Processor Time","\\test\Physical Cpu(4)\% Processor Time","\\test\Physical Cpu(5)\% Processor Time","\\test\Physical Cpu(6)\% Processor Time","\\test\Physical Cpu(7)\% Processor Time","\\test\Physical Cpu(8)\% Processor Time","\\test\Physical Cpu(9)\% Processor Time","\\test\Physical Cpu(10)\% Processor Time","\\test\Physical Cpu(11)\% Processor Time","\\test\Physical Cpu(12)\% Processor Time","\\test\Physical Cpu(13)\% Processor Time","\\test\Physical Cpu(14)\% Processor Time","\\test\Physical Cpu(15)\% Processor Time","\\test\Physical Cpu(16)\% Processor Time","\\test\Physical Cpu(17)\% Processor Time","\\test\Physical Cpu(18)\% Processor Time","\\test\Physical Cpu(19)\% Processor Time","\\test\Physical Cpu(20)\% Processor Time","\\test\Physical Cpu(21)\% Processor Time","\\test\Physical Cpu(22)\% Processor Time","\\test\Physical Cpu(23)\% Processor Time","\\test\Physical Cpu(24)\% Processor Time","\\test\Physical Cpu(25)\% Processor Time","\\test\Physical Cpu(26)\% Processor Time","\\test\Physical Cpu(27)\% Processor Time","\\test\Physical Cpu(28)\% Processor Time","\\test\Physical Cpu(29)\% Processor Time","\\test\Physical Cpu(30)\% Processor Time","\\test\Physical Cpu(31)\% Processor Time","\\test\Physical Cpu(32)\% Processor Time","\\test\Physical Cpu(33)\% Processor Time","\\test\Physical Cpu(34)\% Processor Time","\\test\Physical Cpu(35)\% Processor Time","\\test\Physical Cpu(36)\% Processor Time","\\test\Physical Cpu(37)\% Processor Time","\\test\Physical Cpu(38)\% Processor Time","\\test\Physical Cpu(39)\% Processor Time","\\test\Physical Cpu(40)\% Processor Time","\\test\Physical Cpu(41)\% Processor Time","\\test\Physical Cpu(42)\% Processor Time","\\test\Physical Cpu(43)\% Processor Time","\\test\Physical Cpu(44)\% Processor Time","\\test\Physical Cpu(45)\% Processor Time","\\test\Physical Cpu(46)\% Processor Time","\\test\Physical Cpu(47)\% Processor Time","\\test\Physical Cpu(_Total)\% Processor Time","\\test\Physical Cpu(0)\% Util Time","\\test\Physical Cpu(1)\% Util Time","\\test\Physical Cpu(2)\% Util Time","\\test\Physical Cpu(3)\% Util Time","\\test\Physical Cpu(4)\% Util Time","\\test\Physical Cpu(5)\% Util Time","\\test\Physical Cpu(6)\% Util Time","\\test\Physical Cpu(7)\% Util Time","\\test\Physical Cpu(8)\% Util Time","\\test\Physical Cpu(9)\% Util Time","\\test\Physical Cpu(10)\% Util Time","\\test\Physical Cpu(11)\% Util Time","\\test\Physical Cpu(12)\% Util Time","\\test\Physical Cpu(13)\% Util Time","\\test\Physical Cpu(14)\% Util Time","\\test\Physical Cpu(15)\% Util Time","\\test\Physical Cpu(16)\% Util Time","\\test\Physical Cpu(17)\% Util Time","\\test\Physical Cpu(18)\% Util Time","\\test\Physical Cpu(19)\% Util Time","\\test\Physical Cpu(20)\% Util Time","\\test\Physical Cpu(21)\% Util Time","\\test\Physical Cpu(22)\% Util Time","\\test\Physical Cpu(23)\% Util Time","\\test\Physical Cpu(24)\% Util Time","\\test\Physical Cpu(25)
Ok so the hint for the weird output is in the very first line
no termcap entry for a `xterm-256color' terminal"(PDH-CSV 4.0)
So essentially, the xterm-256color profile that the Mac is using is not something that ESXi understands as for ESXi, the default TERM is xTERM
Alright, so much for that. Now the question is how the heck do we change that?
Here is what needs to be done. We can either change the default TERM on Mac to xTerm – but the question is why?
So let’s check the TERM type on Mac
echo $TERM shows the below
#echo $TERM
xterm-256color
Hmm ok, so the TERM is actually an environment “variable”. What that means is we can force a environment variable change on the fly, and as long as the TERM type in defined in the term and termcap, we should be fine.
Going by the options on the Terminal preferences, we see xterm is supported.
So to change the TERM variable, log out of ESXi and drop down to the Mac terminal
Then use the EXPORT command to pass on xterm to TERM environment variable
#export TERM=xterm
Now check the value of the variable
#echo $TERM
xterm
Ok so far so good.
Now log back into ESXi and check the TERM – if all has gone well, this should show xTERM
[root@test:~] echo $TERM
xterm
Beautiful!
So fire up esxtop
So as you can see, we get the default esxtop output making it a LOT easier to read and make sense of the output
Point to remember:
We have merely changed environment parameters for this terminal. So logging out and logging back in or opening a different terminal will flip the environment variables back to System defaults as the screenshot below. You can see the terminal with esxtop is still running but on the new terminal the environment variables are back to system defaults
In other words, just use the same steps as earlier to flip to xTerm. On the other hand, if you need to flip the Terminal TERM emulation to xTerm permanently, here is what needs to be done
Go to your Terminal preferances
Flip the TERM dropdown to xTerm
Save and launch Terminal and check
The TERM variable should be set to xTerm by default
So if you want to switch back, just change the same back to defaults 🙂
Thank you for reading and stay tuned for more. Subscribe to the blog/Youtube channels to be notified when a new blog/video comes out!