Netdata and Glances for Quick Machine and Container Stats

Following up on my previous video showing some very simple dashboards for machine statistics and analytical information, I wanted to provide some options that are made with the power users in mind.  Both of these tools have configuration options that you can use to customize them to your liking (though I don't get into that on this video).  

I've covered Glances in a previous video as well, and here's a link to that.

Both of these tools have a distinct advantage over some others.  They can each show you the host system information, but can also show detailed information about the Docker containers being run on the host as well.

Without further ado, let's get into the installation of these tools.  First up, is one I've been talking about covering for months, Netdata!


For each of these tools there are 2 methods of installation: native install on the host machine or via Docker as a container.  I will cover both methods for Netdata as the native install had better results for the container identification, but only the Docker install for Glances:

1. Install Netdata Straight to the system.

Ubuntu based systems:

You can install directly from your distro's repositories, and for Debian / Ubuntu systems it will be like the below command...but sometimes you don't get the latest and greatest version using this method.

sudo apt install netdata -y

Alternatively, you can install using this command:

bash <(curl -Ss

and it will pull down the lates version of the software and install it for you on most distros.

Next, you may need to edit a configuration file for Netdata to allow you access from a machine other than localhost if you want it.

Edit the file at /etc/netdata/netdata.conf.

sudo nano /etc/netdata/netdata.conf

ONce inside the file, use CTRL+W to bring up the search option in nano, then enter "[web]" and press Enter, or in this file, go down to the [web] section and change the bind address to either the IP of the server itself, (in my case I used as this is the server IP), or to to allow access to the netdata web interface from other machines.

Finally, If you want to monitor the Docker containers on that server with NetData, you can, but in order to see the names of the containers instead of the container IDs (e.g. Metabase instead of 3f8ceg724fe9efbc32), you may need to add NetData to the docker group as well.

sudo usermod -aG docker netdata

Now restart your NetData service with:

sudo systemctl restart netdata, then check out your IP:19999 to see the Info onyour server and all the containers.

For me I went to  Your IP will mostly likely be different.

2. Install NetData Through Docker:

A. Create a new directory called "netdata".

mkdir netdata

cd netdata

B. create a file called "docker-compose.yml"

nano docker-compose.yml

C. Paste the following code into the file:

version: '3'
    image: netdata/netdata
    container_name: netdata
    hostname: #enter your server FQDN here
      - 19999:19999
    restart: unless-stopped
      - SYS_PTRACE
      - apparmor:unconfined
      - netdataconfig:/etc/netdata
      - netdatalib:/var/lib/netdata
      - netdatacache:/var/cache/netdata
      - /sys/fs/cgroup:/host/sys/fs/cgroup:ro
      - /etc/passwd:/host/etc/passwd:ro
      - /etc/group:/host/etc/group:ro
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /etc/os-release:/host/etc/os-release:ro
      - DOCKER_HOST=proxy:2375

    image: tecnativa/docker-socket-proxy
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - CONTAINERS=1


NOTE: Added the lines for "environment" under the docker section which gets the container names to show correctly. Woot, thanks to @Limpep on YouTube for that!

D. Save the file and close with CTRL+O then Enter to save, adn CTRL+X to exit the nano editor.

Now, run the file with the command

docker-compose up -d

Visit your install at it's IP:19999, so for me it is

UPDATE: Thanks to @Limpep on YouTube comments, I added the lines in the file above

      - DOCKER_HOST=proxy:2375

/sys/fs/cgroup:/host/sys/fs/cgroup:ro, but I have not yet been able to get it to show me the Container Name instead of the Container ID.


Install Glances in Docker

For this installation, we are going to use the image on dockerhub at the url below.  


Simply run

docker run -d --restart="always" -p 61208-61209:61208-61209 -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host nicolargo/glances:dev


You can also run the "latest" generally the more stable version than the "dev" version with the command below.

docker run -d --restart="always" -p 61208-61209:61208-61209 -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host nicolargo/glances:latest

Note the portion in both options that says GLANCES_OPT="-w".  This tells the application we want to see the information via the browser.

These will run on x86_64 and Arm based systems as well.

You can also add your own glances config by adding the volume flag

-v 'pwd'/glances.conf:/glances/conf/glances.conf:ro into the docker run line.

The pwd portion tells the docker command to look for your glances.conf file in the current directory.  So it might be best to make a "glances" directory, cd into it, then run the docker command from there.

mkdir glances

cd glances

nano glances.conf

-- run the command.

Now you can enjoy all of the greatness both NetData and Glances have to offer interms of system and container information overviews.