The nmon tool will, using a simple ncurses interface, display the usage for CPU, memory, network, disks, file system, NFS, top processes, resources, and power micro-partition. What's best is that you get to choose what nmon displays. And since it's text-based, you can secure shell into your servers and get a quick glimpse from anywhere (as long as "anywhere" has access to said server).
Let's install nmon and see how it is used.
Installation
The nmon application can be installed from your distribution's standard repository. This means you should be able to install nmon without too much fuss. For a distribution that uses apt (Debian, Ubuntu, etc.), do the following:- Open up your terminal window
- Issue the command sudo apt-get update
- Install the software with the command sudo apt-get install nmon
- Allow the installation to complete
- Open up your terminal window
- Issue the command dnf install epel-release
- Install nmon with the command dnf install nmon
- Allow the installation to complete
Usage
Now that nmon is installed, you can fire it up by issuing the command nmon. In the nmon window (Figure A), you simply have to toggle the statistic(s) you want to view.Figure A
Say you want to view information about disks. If you hit the d key on your keyboard, nmon will display real-time statistics about any and all attached disks (Figure B).
Figure B
Next we'll add network and memory to the mix by hitting the n key followed by the m key (on your keyboard). The resulting window will add those real-time statistics to the mix (Figure C).
Figure C
You can toggle any of the added statistics off by hitting the associated keyboard key (the same used to add). The tool also includes the ability to increase and decrease the speed of updates. By hitting the - key on your keyboard you will speed up the screen updates and, conversely, the + key will slow them down.
To quit nmon, hit the q key and you will be returned to your bash prompt.
The tool also includes the ability to capture information and save it to a file. This can come in very handy if you need to monitor a system for a set period of time and then review the collected data later. Say you want to collect thirty rounds of information every 60 seconds. To do this, you would issue the command:
nmon -f -s 60 -c 30After issuing the above command you will find a file in the current working directory with the extension .nmon. Open that file to view the collected data.
Scheduling data collection
You could even create a cron job to schedule a regular dump of nmon-collected data (which could be handy for troubleshooting an recurring issue). A simple solution for this would be to create a bash script (we'll call it nmon.sh) that contained something like the following:#! /bin/sh nmon -f -s 60 -c 30Save that file and give it executable permissions with the command chmod u+x nmon.sh. Now open crontab for editing with the command crontab -e and enter something like this:
30 11 * * * ~/nmon.shSave and close crontab. The above cron job will run every day at 11:30 AM. Modify that to fit your needs and you have an easy solution for troubleshooting an issue occurring on your Linux data center machines.
After you have collected the .nmon file you can convert it to html by the tool called nmon-chart
Syntax:
- nmonchart
.html
For example:
- nmonchart blue_150508_0800.nmon blue_150508_0800.html
- nmonchart blue_150508_0800.nmon
- if you miss out the target filename is will use the source filename and replace .nmon with .html
Or you could put the .html straight on to your website (assuming Apache is using /var/www/html)
- nmonchart blue_150508_0800.nmon /var/www/html/blue_150508_0800.html