nicolargo / glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
http://nicolargo.github.io/glances/
Other
26.8k stars 1.53k forks source link

Docker container running latest-full returns blank web page #2273

Closed instantdreams closed 1 year ago

instantdreams commented 1 year ago

Describe the bug Starting the docker container results in a running container, but accessing the server web page at http://[server]:61208/ results in a blank web page with the following HTML:

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Glances</title>

    <link rel="icon" type="image/x-icon" href="favicon.ico" />
    <script>
      window.__GLANCES__ = {
        'refresh-time': '2'
      }
    </script>
    <script src="glances.js" defer></script>

</head>

<body>
  <div id="app"></div>
</body>
</html>

To Reproduce Steps to reproduce the behavior:

  1. Create a docker-compose.yml file with the following content:

    version: "3.5"
    services:
    glances:
    image: nicolargo/glances:latest-full
    container_name: ${CONTAINER_NAME}
    hostname: ${CONTAINER_NAME}.${HOSTNAME}
    network_mode: host
    privileged: true
    pid: host
    # ports:
    #   - 61208:61208 # web ui
    environment:
      - TZ=${TZ}
      - GLANCES_OPT=--webserver --config /glances/conf/glances.conf
    volumes:
      - ${DIRECTORY_CONF}:/glances/conf
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped
  2. Create a .env file with the following content:

    CONTAINER_NAME=glances
    HOSTNAME=[server]
    TZ=[timezone]
    DIRECTORY_CONF=/srv/glances/conf
  3. Launch container with the following command:

    docker compose --file /srv/glances/docker-compose.yml up --detach

Expected behavior The Glances webserver to render a web page with full monitoring details.

Screenshots n/a, text is more suitable and can be indexed and searched.

Desktop (please complete the following information):

Additional context I have four headless servers running versions of Debian:

Here are their relative operating systems:

$ uname --all
Linux server1 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux
Linux server2 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux
Linux server3 5.18.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.2-1 (2022-06-06) x86_64 GNU/Linux
Linux server4 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux

Docker volume bind mounts:

$ docker container inspect glances --format='{{range .Mounts}}{{.Type}}:{{.Source}}:{{.Destination}}{{println}}{{ end }}'
bind:/srv/glances/conf:/glances/conf
bind:/var/run/docker.sock:/var/run/docker.sock

Glances version:

$ docker exec -it glances glances --version
Glances v3.3.1.1 with PsUtil v5.9.4
Log file: /tmp/glances-root.log

Log file:

$ docker exec -it glances cat /tmp/glances-root.log
2023-02-18 03:31:31,761 -- INFO -- Start Glances 3.3.1.1
2023-02-18 03:31:31,761 -- INFO -- CPython 3.10.9 (/usr/bin/python3) and psutil 5.9.4 detected
2023-02-18 03:31:31,777 -- INFO -- Read configuration file '/glances/conf/glances.conf'
2023-02-18 03:31:31,811 -- INFO -- Start GlancesWebServer mode
2023-02-18 03:31:31,869 -- WARNING -- Wifi lib is not compliant with Python 3, Wifi plugin is disabled
2023-02-18 03:31:33,696 -- INFO -- Glances RESTful API Server started on http://0.0.0.0:61208/api/3/
2023-02-18 03:31:33,705 -- INFO -- Glances Web User Interface started on http://0.0.0.0:61208/
2023-02-18 03:32:16,371 -- INFO -- Start Glances 3.3.1.1
2023-02-18 03:32:16,371 -- INFO -- CPython 3.10.9 (/usr/bin/python3) and psutil 5.9.4 detected

Issue checked:

$ docker exec glances glances --issue
===============================================================================
Glances 3.3.1.1 (/usr/lib/python3.10/site-packages/glances/__init__.py)
Python 3.10.9 (/usr/bin/python3)
PsUtil 5.9.4 (/usr/lib/python3.10/site-packages/psutil/__init__.py)
===============================================================================
alert         [OK]    0.00001s [[1676694201.0, -1, 'WARNING', 'MEM',
amps          [OK]    0.00005s []
cloud         [OK]    0.00003s {}
connections   [OK]    0.01851s {'LISTEN': 30, 'ESTABLISHED': 69, 'SYN
core          [OK]    0.00064s {'phys': 2, 'log': 4}
cpu           [OK]    0.00037s {'total': 91.6, 'user': 65.1, 'nice':
diskio        [OK]    0.00100s key=disk_name [{'time_since_update': 2
docker        [OK]    0.05551s key=name [{'key': 'name', 'name': 'fri
folders       [OK]    0.00006s []
fs            [OK]    0.00197s key=mnt_point [{'device_name': '/dev/s
gpu           [OK]    0.00005s []
help          [OK]    0.00001s None
ip            [OK]    0.00058s {'gateway': '192.168.1.1', 'address':
irq           [OK]    0.00103s key=irq_line [{'irq_line': '152_eno1',
load          [OK]    0.00008s {'min1': 10.29150390625, 'min5': 9.117
mem           [OK]    0.00026s {'total': 33537216512, 'available': 88
memswap       [OK]    0.00276s {'total': 1024454656, 'used': 0, 'free
network       [OK]    0.00088s key=interface_name [{'interface_name':
now           [OK]    0.00004s 2023-02-18 04:23:24 UTC
percpu        [OK]    0.00009s key=cpu_number [{'key': 'cpu_number',
ports         [OK]    0.00051s []
processcount  [OK]    0.14487s {'total': 306, 'running': 2, 'sleeping
processlist   [OK]    0.00059s key=pid [{'memory_percent': 1.52297376
psutilversion [OK]    0.00006s (5, 9, 4)
quicklook     [OK]    0.00112s {'cpu': 80.8, 'percpu': [{'key': 'cpu_
raid          [OK]    0.00020s {}
sensors       [OK]    0.00001s key=label [{'label': 'acpitz 1', 'unit
smart         [OK]    0.00149s []
system        [OK]    0.00001s {'os_name': 'Linux', 'hostname': 'glan
uptime        [OK]    0.00028s {'seconds': 465233}
wifi          [OK]    0.00013s []
===============================================================================
Total time to update all stats: 0.24276s
===============================================================================

Running this without a conf file or with a conf file results in the same result. I've read the documentation, and I've searched the Google Groups and github issues with no significant luck.

What am I missing?

RazCrimson commented 1 year ago

@instantdreams Is this issue happening on all four of your machines?

I am not able to replicate this on my end.

Also can you also share the details regarding which browser was used? Did you try with multiple browsers (if you did please mention the names too)?

instantdreams commented 1 year ago

It's happening on all four machines.

I've tried with latest Chrome and latest Firefox.

nicolargo commented 1 year ago

@instantdreams as @RazCrimson i can not reproduce the issue on my side.

Can you please try to clean your browser cache (using CTRL+F5) ?

If it did not work, edit your docker-compose.yml file in order to enable the debgug mode:

GLANCES_OPT=--webserver --config /glances/conf/glances.conf -d

Then restart the container and pastebin us the glances.log file.

Thanks !

instantdreams commented 1 year ago

Will do.

instantdreams commented 1 year ago

I fully refreshed an instance of Edge and all four work now!

Here's the log from one of them: https://pastebin.com/4rv5ieRn

instantdreams commented 1 year ago

I think this issue was caused by shifting from image joweisberg/glances to image nicolargo/glances.

Lesson learned, fully refresh the browser with ctrl+shift+r after any significant update.

brunohenriquy commented 7 months ago

I am having the same issue, tried to reboot the server several times, cleared browser cache, tried on several browsers.

I can access the api, it returns data, but not the main page.

brunohenriquy commented 6 months ago

I am having the same issue, tried to reboot the server several times, cleared browser cache, tried on several browsers.

I can access the api, it returns data, but not the main page.

I've switched to a docker container, now it is running well.