Linux: Keep An Eye On Your System With Glances Monitor

by on December 17, 2013 · 18 comments· LAST UPDATED December 18, 2013

in , , , ,

Is there is a tool that can provide me a maximum of information (such as cpu, disk I/O, network, nfsd, memory and more) about my Linux/Unix server in a minimum of space in a terminal?

There are plenty of monitoring tools on Linux or Unix-like systems that can provide information about your server:

  1. CPU load
  2. Tutorial details
    DifficultyEasy (rss)
    Root privilegesYes
    RequirementsPython+Terminal
    Estimated completion time10m
  3. OS Name/Kernel version
  4. System load
  5. Disk and Network I/O
  6. Process
  7. Memory usage
  8. Mount point and much more.

Say hello to Glances

From the project home page:

Glances is a free (LGPL) cross-platform curses-based monitoring tool which aims to present a maximum of information in a minimum of space, ideally to fit in a classical 80x24 terminal or higher to have additionnal information. Glances can adapt dynamically the displayed information depending on the terminal size. It can also work in a client/server mode for remote monitoring.

This utility is written in Python and uses the psutil library to fetch the statistical values from your server.

Installation

You can install Glances using pip command line tool. You will also find packages for Arch Linux, Fedora/CentOS/RHEL, Debian, Ubuntu (13.04+), FreeBSD, OSX and so you should be able to install it using your favorite package manager as follows:

Install Glances on CentOS/Fedora/RHEL/Scientific Linux

First, turn on Extra Packages for Enterprise Linux (or EPEL) repo on CentOS/RHEL/SL. Type the following yum command:
# yum -y install glances
Sample outputs:

yum install glances
Loaded plugins: product-id, protectbase, rhnplugin
This system is receiving updates from RHN Classic or RHN Satellite.
rhel-x86_64-server-6                                 | 1.5 kB     00:00
rhel-x86_64-server-optional-6                        | 1.5 kB     00:00
0 packages excluded due to repository protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package glances.noarch 0:1.7.1-1.el6 will be installed
--> Processing Dependency: python-psutil >= 0.4.1 for package: glances-1.7.1-1.el6.noarch
--> Processing Dependency: python-setuptools for package: glances-1.7.1-1.el6.noarch
--> Running transaction check
---> Package python-psutil.x86_64 0:0.6.1-1.el6 will be installed
---> Package python-setuptools.noarch 0:0.6.10-3.el6 will be installed
--> Finished Dependency Resolution
 
Dependencies Resolved
 
============================================================================
 Package             Arch     Version          Repository              Size
============================================================================
Installing:
 glances             noarch   1.7.1-1.el6      epel                   107 k
Installing for dependencies:
 python-psutil       x86_64   0.6.1-1.el6      epel                    84 k
 python-setuptools   noarch   0.6.10-3.el6     rhel-x86_64-server-6   336 k
 
Transaction Summary
============================================================================
Install       3 Package(s)
 
Total download size: 527 k
Installed size: 843 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): glances-1.7.1-1.el6.noarch.rpm                | 107 kB     00:00
(2/3): python-psutil-0.6.1-1.el6.x86_64.rpm          |  84 kB     00:00
(3/3): python-setuptools-0.6.10-3.el6.noarch.rpm     | 336 kB     00:00
----------------------------------------------------------------------------
Total                                       1.8 MB/s | 527 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : python-psutil-0.6.1-1.el6.x86_64                         1/3
  Installing : python-setuptools-0.6.10-3.el6.noarch                    2/3
  Installing : glances-1.7.1-1.el6.noarch                               3/3
  Verifying  : python-setuptools-0.6.10-3.el6.noarch                    1/3
  Verifying  : python-psutil-0.6.1-1.el6.x86_64                         2/3
  Verifying  : glances-1.7.1-1.el6.noarch                               3/3
 
Installed:
  glances.noarch 0:1.7.1-1.el6
 
Dependency Installed:
  python-psutil.x86_64 0:0.6.1-1.el6
  python-setuptools.noarch 0:0.6.10-3.el6
 
Complete!
 

Install Glances on Debian/Ubuntu Linux (13.04+)

Type the following command:
$ sudo apt-get install glances

How do I use glances?

The basic syntax is:
# glances
# glances [options]

Sample outputs:

Fig.01: glances in action (click to enlarge)

Fig.01: glances in action (click to enlarge)


To quit just press q (Esc and Ctrl-C also work). Here is another output from Ubuntu based system:
Fig.02: Glances in action (Image credit - Glances author)

Fig.02: Glances in action (Image credit - Glances author)

HTML5 capable browser user can view quick video demo by clicking the following link:

(Video 01: Glances command in action)

Fine tuning output (interactive commands)

Use the following hot keys to find tune your output:

  • a Sort processes automatically.
  • c Sort processes by CPU%.
  • m Sort processes by MEM%.
  • p Sort processes by name.
  • i Sort processes by I/O rate.
  • d Show/hide disk I/O stats.
  • f Show/hide file system stats.
  • n Show/hide network stats.
  • s Show/hide sensors stats.
  • y Show/hide hddtemp stats.
  • l Show/hide logs.
  • b Bytes or bits for network I/O.
  • w Delete warning logs.
  • x Delete warning and critical logs.
  • 1 Global CPU or per-CPU stats.
  • t View network I/O as combination.
  • u - View cumulative network I/O.

How do I use Glances in client/server mode?

On server type the following command to bind server to the given IPv4/IPv6 address or hostname:
# glances -B @IP|host
# glances -B 75.126.153.206
# glances -B www.cyberciti.biz

From your desktop client such as OSX/FreeBSD/Linux based system type the following command to connect to a Glances server by IPv4/IPv6 address or hostname:
# glances -c @IP|host
# glances -c 75.126.153.206
# glances -c www.cyberciti.biz

You may need to pass the -P password to set a client/server password. The -s run Glances in server mode:

How do I refresh information every 5 seconds?

Type the following command:
# glances -t 5

See also

Glances is not the only option. You can try:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 18 comments… read them below or add one }

1 Leszek December 17, 2013 at 9:25 pm

It looks nice and similar to Topas from AIX.

Reply

2 RakX December 18, 2013 at 1:38 pm

It does look like topas…
But nmon still rocks! ;-)

Reply

3 Aldric December 17, 2013 at 9:49 pm

Just installed on Centos, work great !
Thanks :)

Reply

4 Robert Butzke December 17, 2013 at 10:07 pm

It looks a lot like RPM (Realtime Performance Monitor) on old DG/UX and AIX’s Topas. Will definitely give it a try on my FreeBSD systems.

Reply

5 Raju K December 17, 2013 at 10:16 pm

Yuppi, it was easy :)

 cd /usr/ports/sysutils/py-glances/ && make install clean

Freebsd has the precompiled binary package too:

pkg_add -r py27-glances

Freshport: http://www.freshports.org/sysutils/py-glances/

Thanks ba!


Raju K.
Yahoo India Data Center Technician.

Reply

6 Kiran Patil December 18, 2013 at 10:41 am

Nice…Pretty good tool… Thanks for Sharing Info.

Reply

7 niraj December 18, 2013 at 5:21 am

Its a good tool all in one.

Reply

8 Sunil Bhoi December 18, 2013 at 8:15 am

Hi,

Thanks :) Great tool.

Reply

9 jkfromdevnull December 18, 2013 at 10:08 am

For Ubuntu LTS:

sudo apt-add-repository ppa:arnaud-hartmann/glances-stable
sudo apt-get update
sudo apt-get install glances

Some one may find this useful. Cheers mate.

Reply

10 shivangpatel December 18, 2013 at 2:06 pm

Looks nice…
Just installing…

Reply

11 urcindalo December 18, 2013 at 3:14 pm

It’s also in Gentoo’s portage.

Reply

12 Tommy Butler December 19, 2013 at 12:55 am

Doesn’t work on Debian 7 Wheezy. Not in Wheezy repo for main, contrib, or non-free.

Reply

13 TB December 21, 2013 at 8:01 pm

Excellent tool. Just tested it on my CentOS.

Reply

14 CYBERWARE December 29, 2013 at 4:30 pm

glances -o HTML -f /var/www/html/monitor.html
Error: Need Jinja2 library to export into HTML
Try to install the python-jinja2 package

Reply

15 D January 5, 2014 at 5:58 am

for Debian:

sudo pip install glances

Reply

16 Ph January 12, 2014 at 9:44 pm

Loved the tutorial. Just installed on CentOS. Thank you for sharing.

Reply

17 Euhill February 8, 2014 at 7:14 pm

Gkrellm and Conky are a couple of good alternatives. Conky is quite popular as it puts the info on your desktop.

Reply

18 kamalkakkar March 3, 2014 at 10:01 am

Nice1

Reply

Leave a Comment

Tagged as: , ,

Previous Faq:

Next Faq: