Combining Supervisor and nginx-proxy (docker) to remotely monitor Glances

I wrote a post a while back about nginx-proxy and how I was using it to resolve local DNS records. Today I decided I wanted to be able to monitor my server remotely using glances running over Supervisor and utilizing glances' internal webserver.

I could be running glances inside a docker container and exposing the docker socket to monitor most of the metrics but that would mean I'd lose useful disk and network information. So since this isn't going to be running inside a container I needed a somewhat creative way to add it to the local network.

Install glances and configure Supervisor:

Configure the program you wish to run through Supervisor:

Load and start the configured program:

Confirm everything is running:

Now the creative part, adding it to the nginx-proxy network. To be able to do this we are going to make use of a docker image called docker-host. Simply explained this image allows you to forward TCP and UDP traffic from within the container to the docker host.

By giving the glances service access to the docker host by giving it the desired Linux capabilities we can expose the 61208 port which is being used by the glances webserver and forward all traffic coming in from status.local to the correct destination.

Now whenever I visit http://status.local I'm able to monitor my server using the familiar glances interface remotely without having to ssh each time.