DEV Community

Cover image for Easily monitor your server's stats
Amjad Abujamous
Amjad Abujamous

Posted on • Edited on

Easily monitor your server's stats

TL;DR

One can use Glances along with a reverse proxy to easily monitor the health of their Server/PC from any location by simply accessing a link. This tutorial walks you through exactly that.

Introduction

Many of us want a straightforward solution to monitoring the health of their Home server, Web server, or essentially any PC. While Grafana and Metabase are good realtime dashboard solutions, their setup can be difficult, which is why we will explore and setup Glances.

Steps to set it up

  1. Install Glances (cross-platform) on your system.
  2. Enable its monitoring feature via a web browser.
  3. Run a reverse proxy on the server.
  4. Access the link from anywhere.

Prerequisites

As is from their github repository.

  • python>=3.8 (use Glances 3.4.x for lower Python version)
  • psutil (better with latest version)
  • defusedxml (in order to monkey patch xmlrpc)
  • packaging (for the version comparison)
  • ujson (an optimized alternative to the standard json module)
  • pytz (for the timezone support)
  • pydantic (for the data validation support)

Step 1: Install Glances

Can be done via the pip package manager for python.

pip install --user 'glances[all]'

Note that you may need to type pip3 instead of pip, depending on your Python installation.

Image description

Step 2: Run glances and monitor the system

To run it in the terminal, run the command:
glances

In our case, we want to run it in a browser, so we type:
glances -w

which gives us the following.

Image description

Image description

Step 3: Access from anywhere

Many good reverse proxy solutions currently exist on the market such as ngrok and Cloudflare tunnels. They give one the ability to reliably run a tunnel and ensure it does not go down. They also offer the ability to securely access their links using whitelisted IP addresses or by using HTTP Basic Authentication.

For this tutorial, however, we will go with the simpler solution serveo.net for demonstration purposes.

Image description

Image description

Voila! That link can now allow us to monitor the system from anywhere with very minimal setup and installation.

Final Thoughts

I hope you found this tutorial useful, and please feel free to comment below if you have questions, additions, modifications, or criticism of this method. All the best!

Top comments (1)

Collapse
 
anilvcube profile image
Anil

Great Blog!
All The Information Provided is very useful;
Thanks For The Information:)
Keep Posting More!