Glances – System Monitoring

Since I have only one (Ubuntu) server at home currently running as a PVR (personal video recorder) for recording TV shows from a OTA (over-the-air) antenna and Plex for viewing my content via the Roku (more on all that on a later post), I like to see what my server is doing as far as performance at a glance from time to time. Sure, top or htop will do the job but I want more. I get more fromĀ using Glances. You can get more information on the utility here.

I setup my server to run the web UI and launch at start. I created this script to easily deploy to any machine running Ubuntu. I included in the script to also create a systemd service so that it would start after each reboot. Here’s the script:

#!/bin/bash
# This script will install the Glances monitoring tool and create
# a startup service for the Glances web server. See 'glances --help'
# for details

# Update and install
sudo apt update && sudo apt install -y glances
sleep 3

# Change the startup switch from false to true
sudo sed -i 's/false/true/g' /etc/default/glances
sleep 3

# Create the systemd service
sudo touch /lib/systemd/system/glances.service
sudo bash -c 'cat <<EOF > /lib/systemd/system/glances.service
[Unit]
Description = Glances web server
After = network.target

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

[Install]
WantedBy=multi-user.target
EOF'
sleep 2

# Reload systemd
sudo systemctl daemon-reload
sleep 2
sudo systemctl enable glances.service
sleep 2
sudo systemctl restart glances.service
sleep 2
sudo systemctl status glances.service
sleep 2
hostip=`hostname -I`
echo
echo "Monitoring of this server will be viewable at http://$hostip:61208"
echo

I have a third monitor above my other monitors that has a Raspberry Pi 3 connected where I have my Glances page running.

IMG_20170502_201709

Here is a closer look at the web UI.

Screenshot at 2017-05-02 20:21:38
It’s been very convenient to view during recordings so that 1.) I know when there is a recording and conversion of the video file going on by seeing a spike in CPU and memory and 2.) to see how well my machine performs during those recordings and conversions.

Advertisements