How to Monitor Remote Linux Systems with Glances

Glances is a free open source, modern, cross-platform, real-time top and htop-like system monitoring tool, which offers advanced features compared to its counterparts, and can run in different modes: as a standalone, in client/server mode, and in web server mode.

Considering the web server mode, you do not necessarily need to log into your remote server via SSH to run glances, you can run it in web server mode and access it via a web browser to remotely monitor your Linux server, as explained below.

To run glances in web server mode, you need to install it together with the Python bottle module, a fast, simple, and lightweight WSGI micro web-framework, using the appropriate command for your Linux distribution.

$ sudo apt install glances python-bottle         [On Debian, Ubuntu and Mint]
$ sudo yum install glances python-bottle         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
$ sudo emerge -a sys-apps/glances python-bottle  [On Gentoo Linux]
$ sudo apk add glances python-bottle             [On Alpine Linux]
$ sudo pacman -S glances python-bottle           [On Arch Linux]
$ sudo zypper install glances python-bottle      [On OpenSUSE]    

Alternatively, install it using the PIP command shown.

$ sudo pip install bottle

Once you have installed the above packages, launch glances with the -w flag to run it in web server mode. By default, it will listen on port 61208.

$ glances -w 
OR
$ glances -w &

If you are running firewalld services, then you should open port 61208 to allow inbound traffic to that port.

$ sudo firewall-cmd --permanent --add-port=61208/tcp
$ sudo firewall-cmd --reload

For the UFW firewall, run these commands.

$ sudo ufw allow 61208/tcp
$ sudo ufw reload

After that, from a web browser, use the URL http://SERVER_IP:61208/ to access the glances UI.

If you are using the systemd system and services manager, you can run glances in web server mode as a service for efficient management, as explained in the next section. I actually prefer this method to run it as a background process.

Run Glances in Web Server Mode as a Service

Start by creating your service unit file (which I have preferred to name as glancesweb.service) under /usr/lib/systemd/system/glancesweb.service.

$ sudo vim /usr/lib/systemd/system/glancesweb.service

Then copy and paste the unit file configuration below in it.

[Unit]
Description = Glances in Web Server Mode
After = network.target

[Service]
ExecStart = /usr/bin/glances  -w  -t  5

[Install]
WantedBy = multi-user.target

The above configuration tells systemd that this is a unit-of-type service, it should be loaded after the network.target.

And once the system is in the network target, systemd will invoke the command “/usr/bin/glances -w -t 5” as a service. The -t specifies an interval for live updates in seconds.

The [install] section informs systemd that this service is wanted by “multi-user.target”. Therefore, when you enable it, a symbolic link is created from the /etc/systemd/system/multi-user.target.wants/glancesweb.service to /usr/lib/systemd/system/glancesweb.service. Disabling it will delete this symbolic link.

Next, enable your new systemd service, start and view its status as follows.

$ sudo systemctl enable glancesweb.service
$ sudo systemctl start glancesweb.service
$ sudo systemctl status glancesweb.service

Finally, from your web browser, use the URL http://SERVER_IP:61208/ to remotely monitor your Linux servers via the glances UI, on any device (smartphone, tablet, or computer).

Monitor Remote Linux Server Under Glances
Monitor Remote Linux Server Under Glances
Monitor Remote Linux Processes Under Glances
Monitor Remote Linux Processes Under Glances

You can change the refresh rate of the page, simply add the period in seconds at the end of the URL, this sets the refresh rate to 8 seconds.

http://SERVERI_P:61208/8	

One downside of running glances in web server mode is that, if the Internet connection is poor the client tends to easily disconnect from the server.

You can learn how to create new systemd services from this guide: How to Create Systemd Unit File in Linux

That’s all! If you have any questions or additional information to add, use the comment form below.

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

14 thoughts on “How to Monitor Remote Linux Systems with Glances”

    • @Rasoul,

      If you’re experiencing a blank UI in the Glances application, make sure your system is connected to the internet to fetch data.

      Reply
  1. When I run

    $ sudo systemctl enable connection.service
    

    I got:

    Failed to enable unit: Unit file connection.service does not exist.

    Reply
    • @Carlos,

      Sorry, please replace “connection.service” with the correct service name “glancesweb.service” as shown.

      $ sudo systemctl enable glancesweb.service
      
      Reply
  2. Reload of ufw shouldn’t have “allow” in it. How do I know….because I copy-pasted code from the internet into my terminal of course.

    Reply
  3. Hi, is it any way to make Glances trigger actions without client connection? I’ve tried but couldn’t so I created a task or cron to issue an http request to make actions being triggered. I’ve tested in Windows but I think in Linux it should be the same.

    Any thoughts?
    Regards

    Reply
  4. Hi,

    In “$ sudo systemctl enable connection.service
    $ sudo systemctl start connection.service
    $ sudo systemctl status connection.service”,
    “connection.service” Shouldn’t be glancesweb.service ?

    Reply
    • @Hussain

      Remember you can give a custom systemd service unit any name of your choice, here for example we named our unit file: glancesweb.service.

      Reply
      • I meant he meant how you refer to it as ‘connection.service’ inconsistently in part of the tutorial. Or do I misunderstand something?

        Reply
        • @Adam

          Oh i get it, sorry for the misunderstanding. It was an editing problem during publishing, we will correct it as soon as possible.

          Thanks so much and to @Hussein as well.

          Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.