For a system administrator, monitoring the performance of Ubuntu or any other OS, is very important for day to day activities. Since many performance monitoring tools are available for Ubuntu, it is difficult to choose a good and reliable one.
In this article, we will walk you through the most common performance monitoring, network monitoring and server monitoring tools.
Top and htop are one of the best command-line based performance monitoring tools. If you are looking for a monitoring tool for your Ubuntu machine then you have probably came across “top”. “top” is a simple command-line based monitoring tool. It comes pre-installed in Ubuntu. To run top, open the terminal window and issue the command top.
‘top’ simply shows the resources used by each app. For example, it shows CPU usage, memory usage, app name, and many more. Detailed features of “top” are shown in the picture below.
htop is a top based monitoring tool with some additional features. htop makes it easier and faster to kill high-resource-usage tasks. To use htop, simply open a command-line terminal and type in htop. Keep in mind that htop doesn’t come pre-installed like top. To install htop open the terminal and enter the following command:
sudo apt-get install htop
For more on htop, you may want to read our detailed article on Monitoring system processes in Ubuntu using htop.
vmstat is a Linux command utility used to analyze and collect data about the system’s disks,CPU activity, memory, threads, swap, paging, block IO, CPU scheduling, system processes and many other parameters in real time.
if you run vmstat, you will get an output which looks like the snapshot below :
For slabinfo , you will need to have permission or add sudo with the m argument as shown below :
To report disk activity statistics, just type in the command with the D argument :
For information about active/inactive memory pages and swaps, use the command as shown below :
The W utility lists the current users that are logged in and displays their current tasks . It is similar to the who command but provides more information…
if you type in the command w username, you will get one or more lines showing information about active users and what they are up to :
A real life example output might look like :
10:18:17 up 2 days, 11:18, 2 users, load average: 0.16, 0.26, 0.29
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 10.2.0.15 10:15 5.00s 0.03s 0.02s vmstat
root pts/1 10.2.0.15 11:13 2.00s 0.02s 0.00s top
where the columns have the following descriptions :
- USER – the name of the user.
- TTY – the type of the Terminal ( pts/0 or console).
- FROM – The remote IP address or host name .
- LOGIN@ – the Log-in time.
- IDLE – the Idle time.
- JCPU – the CPU time used by the process since login .
- PCPU – The CPU time of the current process.
- WHAT – The command line the user has executed
The free command is used to show the total free space available as well as the amount of used and swap memory in the system. It also displays the buffers and caches that are used by the kernel.
If you type in free, you will get something similar to :
iptraf command tool is a colorful interactive IP LAN monitor. Based on ncurses IP LAN monitor, it generates different network statistics such asUDP counts, TCP info, OSPF and ICMP information, node stats, Ethernet load info, IP checksum errors, and others.
Much like netstat, ss (socket stats) command tool is used to dump socket statistics. It can provide additional TCP and state information when compared to other tools.
ss has many options. open up the man page to display them.
If you want to know, for how much time the system has been active, then you are in the right place. uptime tells the time during which the system has been up and running.
if you type in uptime in the terminal, you will get an output similar to the following :
As you can see, the command uptime returns the current time as well as the amount of time the system has been running along with the number of logged-on users and finally the load time for the past 1 minute, 5 minutes and 15 minutes respectively.
Justniffer is a TCP packet sniffer and network protocol analyzer utility that captures both low and high level network traffic data in order to provide a customized log output from the log files of Apache web server. It can retrieve all “intercepted” files from the network ( HTTP traffic ) and track response times. It gives you the possibility to interactively trace tcp network traffic from a previous capture file or from a live network.
atop is a tool that displays the current load on a Linux system. A powerful interactive monitoring utility, atop can provide detailed information about processes which are responsible for high CPU , memory , disk and network load on the system.
Once you install atop via the command line, run it by invoking the atop command :
iostat tool displays and collects your system’s storage input and output statistics. System administrators often rely on iostat in order to identify performance related issues with storage devices such as local or remote disks disks.
if might be that iostat is not installed by default on your system , in this case you can install it via the package sysstat as shown below :
if you type in iostat, you will end up having an output which might look similar to the one below :
Common tool used to display active-processes related information.
PID: Process ID, shows the process identification number.
TTY: Identifies the terminal from which the process was executed.
TIME: Shows the processor’s time occupied by the program.
CMD: Shows the command used to launch the process.
If you want to display all running processes , use the command ps -a :
if you want to display the top 5 Memory Consuming Processes, run the command as shown below :
# ps -auxf | sort -nr -k 4 | head -10
and in order to view the top 5 CPU Consuming Processes, type in the command below :
# ps -auxf | sort -nr -k 3 | head -5
Munin is GUI monitoring application for a systems and networks. It has a client-server based architecture and can be configured to carry out monitoring activities on the ‘main’ machine (the Munin master) it’s installed on and on the connected client machines (Munin nodes )
Here is a snapshot of the munin tool :
for more on munin, please visit : http://munin-monitoring.org/wiki/Documentation.
Ganglia is a distributed, scalable monitoring utility for high-performance networks, computing systems and clusters. The application is used to display both live or recorded statistics about various metrics such as network utilization or CPU load averages for many nodes.
Here is what it looks like :
Dstat provides valuable information about your system performance like CPU activity, virtual memory , i/o devices and many more. It actually replaces some older utilities such as iostat, ifstat, vmstat, netstat and ifstat.
If you have not installed dstat you proceed as shown below :
Once this is done, you can simply type in dstat :
If no options have been added with the command dstat, it will use a default set of options, as shown above (-cdngy) . The output above shows the following information :
- CPU stats: cpu usage by :
– a user (usr) processes
– a system (sys) process,
– the number of idle (idl) processes
– the number of waiting (wai) processes ..
- Disk stats: total number of read and write operations on disks.
- Network stats: total number of bytes received (recv) as well as sent (send) on network interfaces.
- Paging stats: number of ‘in’ and ‘out’ copy operations on the memory.
- System stats: number of interrupts (int) events and context switches (csw) events .
In order to hide the warning message displayed at the start of the result,”You did not select any stats” you can simply insert the -a option.
Monit is an open source program that can be used to monitor many processes on your server, including server related, such as Apache or Nginx. Monit has a lightweight Web based frontend that can help check the status of all services that can be monitored as well as conduct automatic repair and maintenance.
By collecting performance data, Collectl, a performance monitoring utility for Linux, provides important information about the current system status. This open source command line program acts like many other utilities, .e.g. ps, vmstat, top, and many more. It is able to record the captured data as well as provide a playback. Collectl uses less than 0.1% of CPU power in order to process its task.
Pmap is yet another open source network monitoring application that helps look up the complete address space of a specific process. It shows the memory usage map or address space of one or many processes.
Pmap is a Sun OS tool and only very limited number of features are supported by Linux.
SAR ( System Activity Report ) is a tool used to report and collect information about CPU performance, Network monitoring, Disk usage, Memory I/O devices consumption, battery performance and many more. It generates the reported information on the fly and can store it in the specified file as well using the -o filename option.
In order to start using SAR, you would need to install it first like we did with the iostat above:
sudo apt install sysstat
Once this is done, you would need to enable data collection. You can do this by marking ENABLED=”true” in /etc/default/sysstat in Ubuntu for instance.
Cacti is an open source utility used to monitor networks and network devices, such as routers, switches and servers. Cacti has a web interface which can be configured and administered by end-users .
here is an example graph generated by cacti :
iftop is a command line tool which provides statistics about network connections and bandwidth usage in a GUI. It tells which network uses the most bandwidth (how much upload and download). Much like top, iftop output is updated automatically every few seconds and the result is sorted by resource hungry first network connections.
by default iftop is not installed by default , you would need to proceed as we did with other packages. Go ahead and install iftop via the command below :
Once it is installed, just type in sudo iftop . This will open up a file as shown below :
PowerTop is command line based diagnosis utility used to monitor electrical power usage by applications which are running on a linux unplugged machine. (not plugged to a power source).The user can use PowerTop in an interactive way to configure various power management settings.
PowerTop helps system administrators monitor and identify power hungry programs . This is very useful as a battery life stretching tool for laptops.
As shown below, you would need to install powertop tool via the command below :
Once this is done, issue the command powertop :
you would need to use sudo to run it :
whowatch is an intuitive, simple command line utility used to monitor users and processes on linux. This who-like easy to use command displays the logged on users and what they are up to much like the w command above.
whowatch is not installed by default, so go ahead and install it :
now you would simply need to issue the command whowatch in order to execute the whowatch application :
As you can see, it shows the total logged on users as well as the number of users per type of connection (ssh, telnet…).
In order to view all linux user processes, press ‘t’ :
whowatch cam also display the system uptime the users’ login name, host, tty, processes along with the connection type. You also have the possibility to select a specific user in order to view his related processes tree.
In order to view the Linux system information, just type ‘s’ :
You may be interested to read: Network configuration in Ubuntu
DTrace tool is used to troubleshoot problems by showing detailed views of programs and system internals to an unprecedented level. It also provides a language to code event based C-like DTrace scripts.
nethogs is a utility used to diagnose network bandwidth traffic in real time. In case there is a sudden network traffic, nethogs will enable you to immediately identify the culprit process.
You can install nethogs via the command :
In order to run nethogs, simply issue the command sudo nethogs:
in order to view the options of this command, you can invoke man nethogs.
Similar to top command, iotop is an open source tool used to monitor disk i/o usage and outputs current i/o utilization by threads or processes. System administrators will find it useful to identify processes with unusual disk i/o read/writes.
iotop is not installed by default , so you would need to proceed as follows :
once this is completed, issue the command sudo iotop :
This will display the output below :
If you want to see only current processes or threads with I/O activities. you should use iotop with -o or –only option..
The “IO>” column above, shows total I/O operations including disk and swap usage for each process.
The SWAPIN column provides swap usage details for each process
If you want to know the network statistics and the bandwidth consumed then jnettop is your friend. If you prefer a graphical frontend, then you may want to try jnettop-gui which is a Java based interface for jnettop. System administrators will find it useful to quickly monitor the state of the network.
here is a sample output of jnettop :
lttng is a low-overhead tracing utility used mainly on production systems. lttng does not disturb the system being traced so that it can help developers identify the sources of hard-to-debug problems.
It can also record multiple traces at the same time with various configuration options. Each Unix user has the possibility to create and set up one or several tracing sessions.
As LTTng is available for major Linux distros, you can install it with your package manager, so that
you can control the tracers with lttng command-line frontend.
Net-SNMP is a set of libraries and utilities that are required to use and deploy the SNMP (Simple Network Management Protocol ) protocol which is used for monitoring network-connected devices, such as switches, routers, servers, .. .
It contains perl and python modules, command line applications, a generic client library, an SNMP agent…
pcp or Performance Co-Pilot is an open source application infrastructure used for visualizing, monitoring, recording, diagnosing and controlling the activity, status and performance of computers, networks, servers and applications.
wireshark is a free and open source utility that monitors and troubleshoots network connections. It can also analyze network packets including dropped packets and can help identify malicious activity on the network.
as usual you will need to install it via the command below :
Once installed, just call wireshark in the terminal. this will open up the window below :
You can for instance select an entity as shown above and click on Start toolbar button (shark fin shaped button). This will display the window below :
Icinga is an open source monitoring utility that can monitor whole data centers ranging from one server to multiple servers, all from a single monitor system. Icinga2 is able to check the availability of resources such as system updates, networks and services. System administrators can receive alerts in case of serious issues like power outage, network failure…
Conky is a free lightweight network monitoring application. It provides detailed information about your disk usage, CPU,RAM utilization, network devices, connections and processes.
Conky can be installed via the following commands in Ubuntu (starting from 14.04):
sudo add-apt-repository ppa:teejee2008/ppa
sudo apt-get update
sudo apt-get install conky-manager
here is a sample output :
“Linux Dash” is an open source, lightweight web based interface that displays detailed information about your Linux system such as CPU, RAM, running processes,file-system, users, real time bandwidth usage.
Since it is based on php, you would first need to install php package . Apache2 server would need to be installed as well . Issue the commands below :
# apt-get install apache2 apache2-utils
# apt-get install php5 curl php5-curl php5-json
# service apache2 start
Then you would have to download the package from github using the command :
git clone https://github.com/afaqurk/linux-dash.git
Finally, start your apache server.
here is a sample output :
You may be interested to read: How to install Apache web server on Ubuntu ?
Observium is yet another network monitoring utility which helps manage your server network which supports a wide range of operating systems, platforms and device types. For more informaion, visit the page https://www.observium.org/ .
Iftop is another command-line based utility which shows bandwidth usage only. This tool helps to get information about network speeds. Like the htop, you will need to download and install iftop first. To install iftop, you will be required to install libpcap and libncurses. Type in the following command in the terminal.
sudo apt install libpcap0.8 libpcap0.8-dev libncurses5 libncurses5-dev
sudo apt install iftop
Netstat is a powerful network monitoring tool. It monitors outgoing as well as incoming packets of the network. Netstat command-line UI will provide information about the local address, foreign address, sent data, received data and many more network parameters. There are so many commands available for Netstat. Some of the important commands of are listed below:
This command is used to see all the TCP and UDP connection ports. You can also use –at flag to see TCP port connection only and –au flag to see UDP port connection only.
This command is used to see all the listening connections available in the machine.
To show all the TCP protocols.
To show all the UDP protocols.
Lm-sensors is a powerful utility for monitoring temperature in your Ubuntu Machine. This utility is used for checking CPU temperatures. To install and run Lm-sensors use the following commands.
sudo apt-get install lm-sensors
Finally, issue the command below in order to display the CPU temperature.
Hddtemp is used for monitoring HDD temperature. To get hddtemp, type in the following command :
sudo apt-get install hddtemp
Then type in :
GNOME System Monitor is a pre-installed GUI system monitoring utility. It is like a windows task manager for windows users. It allows Ubuntu users or any other Linux distribution with a GNOME desktop environment, to monitor all real time active processes. It also has the ability to stop or resume a process. To install GNOME system monitor, perform the following command in terminal:
sudo apt-get install gnome-system-monitor
Then type in the following command to open it.
If you do not want to use the terminal, you can install the GNOME system monitor via a GUI. Just follow the steps below.
- Open the Software app from the activity toolbar.
- In the search bar type in gnome system-monitor and click search.
- Now click on the gnome system monitor to install it.
- After installation click launch to start the application.
Nagios is an open-source system monitoring tool. Nagios monitors current running processes, CPU load, memory usage, SMTP (simple, mail transfer protocol), POP3 (post office protocol), and many more. You can use it with CLI too. Nagios comes with script support, so that you can use it remotely.
Psensor is the best GUI based temperature monitoring tool. Psensor can check motherboard, CPU, Nvidia GPU, hard disk temperatures and many more. To use Psensor, you need to install lm-sensor as mentioned above. To install Psensor enter the following command in the terminal :
sudo apt install psensor
Please let us know if we missed some other monitoring tool for Ubuntu or Linux in general.