Merge from develop - aka Glances 3.4.0

This commit is contained in:
nicolargo 2023-05-16 10:31:06 +02:00
commit 6343db0344
28 changed files with 3638 additions and 6399 deletions

View File

@ -1,2 +1,17 @@
.dockerignore
.git
# Ignore everything
*
# Include only code files
!/glances/**/*.py
# Include WebUI files (remove when webui moved to seperate package)
!/glances/outputs/static
# Include Requirements files
!/requirements.txt
!/docker-requirements.txt
!/webui-requirements.txt
!/optional-requirements.txt
# Include Config file
!/docker-compose/glances.conf

View File

@ -39,15 +39,15 @@ test: ## Run unit tests
./venv/bin/python ./unitest.py
./venv/bin/python ./unitest-restful.py
./venv/bin/python ./unitest-xmlrpc.py
./venv/bin/python -m black ./glances --check --config pyproject.toml
./venv/bin/pyright glances
./venv/bin/python -m black ./glances --check --exclude outputs/static
# ./venv/bin/pyright glances
test-with-upgrade: venv-upgrade venv-dev-upgrade ## Run unit tests
./venv/bin/python ./unitest.py
./venv/bin/python ./unitest-restful.py
./venv/bin/python ./unitest-xmlrpc.py
./venv/bin/python -m black ./glances --check --config pyproject.toml
./venv/bin/pyright glances
./venv/bin/python -m black ./glances --check --exclude outputs/static
# ./venv/bin/pyright glances
# ===================================================================
# Linters and profilers
@ -162,22 +162,22 @@ run-local-conf: ## Start Glances in console mode with the system conf file
./venv/bin/python -m glances
run-docker-alpine-minimal: ## Start Glances Alpine Docker minimal in console mode
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-minimal
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-minimal
run-docker-alpine-full: ## Start Glances Alpine Docker full in console mode
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-full
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-full
run-docker-alpine-dev: ## Start Glances Alpine Docker dev in console mode
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-dev
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-alpine-dev
run-docker-ubuntu-minimal: ## Start Glances Ubuntu Docker minimal in console mode
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-minimal
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-minimal
run-docker-ubuntu-full: ## Start Glances Ubuntu Docker full in console mode
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-full
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-full
run-docker-ubuntu-dev: ## Start Glances Ubuntu Docker dev in console mode
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-dev
docker run --rm -e TZ="${TZ}" -e GLANCES_OPT="" -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it glances:local-ubuntu-dev
run-webserver: ## Start Glances in Web server mode
./venv/bin/python -m glances -C ./conf/glances.conf -w

View File

@ -6,7 +6,74 @@
Version 3.4.0
===============
See roadmap here: https://github.com/nicolargo/glances/issues?q=is%3Aopen+is%3Aissue+milestone%3A%22Glances+3.4.0%22
Enhancements:
* Enhance process "extended stats" display (in Curses interface) #2225
_You can now *pin* a specific process to the top of the process list_
* Improve Glances start time by disabling Docker and Podman version getter - Related to #1985
* Customizable InfluxDB2 export interval #2348
* Improve kill signal management #2194
* Display a critical error message if Glances is ran with both webserver and rpcserver mode
* Refactor the Cloud plugin, disable it by default in the default configuration file - Related to #2279
* Correct clear-text logging of sensitive information (security alert #29)
* Use of a broken or weak cryptographic hashing algorithm (SHA256) on password storage #2175
Bug corrected:
* Correct issue (error message) concerning the Cloud plugin - Related to #2392
* InfluxDB2 export doesn't process folders correctly - missing key #2327
* Index error when displaying programs on MacOS #2360
* Dissociate 2 sensors with exactly the same names #2280
* All times displayed in UTC - Container not using TZ/localtime (Docker) #2278
* It is not possible to return API data for a particular mount point (FS plugin) #1162
Documentation and CI:
* chg: Dockerfile - structured & cleaner build process #2386
* Ubuntu is back as additional Docker images. Alpine stays the default one. Related to #2185
* Improve Makefile amd docker-compose to support Podman and GPU
* Workaround to pin urlib3<2.0 - Related to #2392
* Error while generating the documentation (ModuleNotFoundError: No module named 'glances') #2391
* Update Flamegraph (memory profiling)
* Improve template for issue report and feature request
* Parameters in the VIRT column #2343
* Graph generation documentation is not clear #2336
* docs: Docker - include tag details
* Add global architecture diagram (Excalidraw)
* Links to documents in sample glances.conf are not valid. #2271
* Add semgrep support
* Smartmontools missing from full docker image #2262
* Improve documentation regarding regexp in configuration file
* Improve documentation about the [ip] plugin #2251
Cyber security update:
* All libs have been updated to the latest version
Full roadmap here: https://github.com/nicolargo/glances/milestone/62?closed=1
Refactor the Docker images factory, from now, Alpine and Ubuntu images will be provided (nicolargo/glances):
- *latest-full* for a full Alpine Glances image (latest release) with all dependencies
- *latest* for a basic Alpine Glances (latest release) version with minimal dependencies (Bottle and Docker)
- *dev* for a basic Alpine Glances image (based on development branch) with all dependencies (Warning: may be instable)
- *ubuntu-latest-full* for a full Ubuntu Glances image (latest release) with all dependencies
- *ubuntu-latest* for a basic Ubuntu Glances (latest release) version with minimal dependencies (Bottle and Docker)
- *ubuntu-dev* for a basic Ubuntu Glances image (based on development branch) with all dependencies (Warning: may be instable)
Contributors for this version:
* Nicolargo
* RazCrimson: a very special thanks to @RazCrimson for his huge work on this version !
* Bharath Vignesh J K
* Raz Crimson
* fr4nc0is
* Florian Calvet
* Ali Erdinç Köroğlu
* Jose Vicente Nunez
* Rui Chen
* Ryan Horiguchi
* mfridge
* snyk-bot
===============
Version 3.3.1.1

View File

@ -210,6 +210,9 @@ The following tags are availables:
- *latest-full* for a full Alpine Glances image (latest release) with all dependencies
- *latest* for a basic Alpine Glances (latest release) version with minimal dependencies (Bottle and Docker)
- *dev* for a basic Alpine Glances image (based on development branch) with all dependencies (Warning: may be instable)
- *ubuntu-latest-full* for a full Ubuntu Glances image (latest release) with all dependencies
- *ubuntu-latest* for a basic Ubuntu Glances (latest release) version with minimal dependencies (Bottle and Docker)
- *ubuntu-dev* for a basic Ubuntu Glances image (based on development branch) with all dependencies (Warning: may be instable)
Run last version of Glances container in *console mode*:
@ -242,6 +245,8 @@ Run the container in *Web server mode*:
docker run -d --restart="always" -p 61208-61209:61208-61209 -e TZ="${TZ}" -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host nicolargo/glances:latest-full
For a full list of options, see the Glances `Docker`_ documentation page.
GNU/Linux
---------
@ -477,3 +482,4 @@ Glances is distributed under the LGPL version 3 license. See ``COPYING`` for mor
.. _wishlist: https://www.amazon.fr/hz/wishlist/ls/BWAAQKWFR3FI?ref_=wl_share
.. _issue2021: https://github.com/nicolargo/glances/issues/2021#issuecomment-1197831157
.. _issue2021comment: https://github.com/nicolargo/glances/issues/2021#issuecomment-1197831157
.. _Docker: https://github.com/nicolargo/glances/blob/develop/docs/docker.rst

View File

@ -22,10 +22,18 @@ services:
network_mode: "host"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro"
- "./glances.conf:/glances/conf/glances.conf"
environment:
- GLANCES_OPT: "-C /glances/conf/glances.conf -w"
- TZ: "${TZ}"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
labels:
- "traefik.port=61208"
- "traefik.frontend.rule=Host:glances.docker.localhost"

View File

@ -10,7 +10,15 @@ services:
network_mode: "host"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "/run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro"
- "./glances.conf:/glances/conf/glances.conf"
environment:
- GLANCES_OPT: "-C /glances/conf/glances.conf -w"
- TZ: "${TZ}"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]

View File

@ -8,7 +8,7 @@
# It is also possible to overwrite it in each plugin sections
refresh=2
# Does Glances should check if a newer version is available on PyPI ?
check_update=false
check_update=False
# History size (maximum number of values)
# Default is 1200 values (~1h with the default refresh rate)
history_size=1200

View File

@ -11,11 +11,27 @@
ARG IMAGE_VERSION=3.18.0
ARG PYTHON_VERSION=3.11
FROM alpine:${IMAGE_VERSION} as build
ARG PYTHON_VERSION
##############################################################################
# Base layer to be used for building dependencies and the release images
FROM alpine:${IMAGE_VERSION} as base
RUN apk add --no-cache \
python3 \
curl \
lm-sensors \
wireless-tools \
smartmontools \
iputils \
tzdata
##############################################################################
# BUILD Stages
##############################################################################
# BUILD: Base image shared by all build images
FROM base as build
ARG PYTHON_VERSION
RUN apk add --no-cache \
python3-dev \
py3-pip \
py3-wheel \
@ -24,124 +40,77 @@ RUN apk add --no-cache \
build-base \
libzmq \
zeromq-dev \
curl \
lm-sensors \
wireless-tools \
smartmontools \
iputils \
tzdata \
# Required for 'cryptography' dependency of optional requirement 'cassandra-driver' \
# Refer: https://cryptography.io/en/latest/installation/#alpine \
# `git` required to clone cargo crates (dependencies)
gcc libffi-dev openssl-dev cargo pkgconfig git
git \
gcc \
cargo \
pkgconfig \
libffi-dev \
openssl-dev
RUN python${PYTHON_VERSION} -m venv --without-pip venv
COPY requirements.txt docker-requirements.txt webui-requirements.txt optional-requirements.txt ./
##############################################################################
# Install the dependencies beforehand to make them cacheable
# BUILD: Install the minimal image deps
FROM build as buildMinimal
FROM build as buildRequirements
ARG PYTHON_VERSION
COPY requirements.txt .
RUN pip3 install --no-cache-dir --user -r requirements.txt
# Minimal means no webui, but it break what is done previously (see #2155)
# So install the webui requirements...
COPY webui-requirements.txt .
RUN pip3 install --no-cache-dir --user -r webui-requirements.txt
# As minimal image we want to monitor others docker containers
RUN pip3 install --no-cache-dir --user docker
# Force install otherwise it could be cached without rerun
ARG CHANGING_ARG
RUN pip3 install --no-cache-dir --user glances
RUN python${PYTHON_VERSION} -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \
# Note: requirements.txt is include by dep
-r docker-requirements.txt \
-r webui-requirements.txt
##############################################################################
FROM build as buildOptionalRequirements
ARG PYTHON_VERSION
# BUILD: Install all the deps
FROM build as buildFull
# Required for optional dependency cassandra-driver
ENV CASS_DRIVER_NO_CYTHON=1
ARG CASS_DRIVER_NO_CYTHON=1
# See issue 2368
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
ARG CARGO_NET_GIT_FETCH_WITH_CLI=true
COPY requirements.txt .
COPY optional-requirements.txt .
RUN pip3 install --no-cache-dir --user -r optional-requirements.txt
RUN python${PYTHON_VERSION} -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \
# Note: requirements.txt is include by dep
-r optional-requirements.txt
##############################################################################
# full image
# RELEASE Stages
##############################################################################
# Base image shared by all releases
FROM base as release
FROM build as full
ARG PYTHON_VERSION
COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY --from=buildOptionalRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
# Copy source code and config file
COPY ./docker-compose/glances.conf /etc/glances.conf
COPY /glances /app/glances
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
# Define default command.
WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
WORKDIR /app
CMD /venv/bin/python3 -m glances -C /etc/glances.conf $GLANCES_OPT
##############################################################################
# minimal image
##############################################################################
################################################################################
# RELEASE: minimal
FROM release as minimal
# Create running images without any building dependency
FROM alpine:${IMAGE_VERSION} as minimal
ARG PYTHON_VERSION
COPY --from=buildMinimal /venv /venv
RUN apk add --no-cache \
python3 \
py3-packaging \
py3-dateutil \
py3-requests \
curl \
lm-sensors \
wireless-tools \
smartmontools \
iputils \
tzdata
################################################################################
# RELEASE: full
FROM release as full
COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY ./docker-compose/glances.conf /etc/glances.conf
RUN apk add --no-cache libzmq
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
# Define default command.
WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
##############################################################################
# dev image
##############################################################################
COPY --from=buildFull /venv /venv
################################################################################
# RELEASE: dev - to be compatible with CI
FROM full as dev
ARG PYTHON_VERSION
COPY --from=buildRequirements /root/.local/bin /usr/local/bin/
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY --from=buildOptionalRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /usr/lib/python${PYTHON_VERSION}/site-packages/
COPY ./docker-compose/glances.conf /etc/glances.conf
# Copy the current Glances source code
COPY . /glances
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
# Forward access and error logs to Docker's log collector
RUN ln -sf /dev/stdout /tmp/glances-root.log \
&& ln -sf /dev/stderr /var/log/error.log
# Define default command.
WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
&& ln -sf /dev/stderr /var/log/error.log \

View File

@ -8,143 +8,106 @@
# Ex: Python 3.10 for Ubuntu 22.04
# Note: ENV is for future running containers. ARG for building your Docker image.
# Image from CUDA https://hub.docker.com/r/nvidia/cuda/tags
ARG IMAGE_VERSION=12.1.1-base-ubuntu22.04
ARG PYTHON_VERSION=3.10
ARG PIP_MIRROR=https://mirrors.aliyun.com/pypi/simple/
FROM nvidia/cuda:${IMAGE_VERSION} as build
ARG IMAGE_VERSION=23.04
ARG PYTHON_VERSION=3.11
##############################################################################
# Base layer to be used for building dependencies and the release images
FROM ubuntu:${IMAGE_VERSION} as base
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3 \
curl \
lm-sensors \
wireless-tools \
smartmontools \
net-tools \
tzdata \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
##############################################################################
# BUILD Stages
##############################################################################
# BUILD: Base image shared by all build images
FROM base as build
ARG PYTHON_VERSION
ARG DEBIAN_FRONTEND=noninteractive
# Install build-time dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3-dev \
python3-venv \
python3-pip \
python3-wheel \
libzmq5 \
musl-dev \
build-essential \
libzmq5 \
curl \
lm-sensors \
wireless-tools \
smartmontools \
net-tools \
tzdata \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
##############################################################################
# Install the dependencies beforehand to make them cacheable
RUN python${PYTHON_VERSION} -m venv --without-pip venv
FROM build as buildRequirements
ARG PYTHON_VERSION
ARG PIP_MIRROR
ARG PIP_MIRROR=https://mirrors.aliyun.com/pypi/simple/
COPY requirements.txt .
RUN python${PYTHON_VERSION} -m pip install --no-cache-dir --user -r requirements.txt -i ${PIP_MIRROR}
# Minimal means no webui, but it break what is done previously (see #2155)
# So install the webui requirements...
COPY webui-requirements.txt .
RUN python${PYTHON_VERSION} -m pip install --no-cache-dir --user -r webui-requirements.txt -i ${PIP_MIRROR}
# As minimal image we want to monitor others docker containers
RUN python${PYTHON_VERSION} -m pip install --no-cache-dir --user docker -i ${PIP_MIRROR}
# Force install otherwise it could be cached without rerun
ARG CHANGING_ARG
RUN python${PYTHON_VERSION} -m pip install --no-cache-dir --user glances -i ${PIP_MIRROR}
COPY requirements.txt docker-requirements.txt webui-requirements.txt optional-requirements.txt ./
##############################################################################
# BUILD: Install the minimal image deps
FROM build as buildMinimal
FROM build as buildOptionalRequirements
ARG PYTHON_VERSION
ARG PIP_MIRROR
COPY requirements.txt .
COPY optional-requirements.txt .
RUN CASS_DRIVER_NO_CYTHON=1 pip3 install --no-cache-dir --user -r optional-requirements.txt -i ${PIP_MIRROR}
RUN python${PYTHON_VERSION} -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \
# Note: requirements.txt is include by dep
-r docker-requirements.txt \
-r webui-requirements.txt
##############################################################################
# full image
# BUILD: Install all the deps
FROM build as buildFull
RUN python${PYTHON_VERSION} -m pip install --target="/venv/lib/python${PYTHON_VERSION}/site-packages" \
# Note: requirements.txt is include by dep
-r optional-requirements.txt
##############################################################################
# RELEASE Stages
##############################################################################
# Base image shared by all releases
FROM base as release
FROM build as full
ARG PYTHON_VERSION
COPY --from=buildRequirements /root/.local/bin /root/.local/bin/
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages/
COPY --from=buildOptionalRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages/
# Copy Glances source code and config file
COPY ./docker-compose/glances.conf /etc/glances.conf
COPY /glances /app/glances
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
# Define default command.
WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
WORKDIR /app
CMD /venv/bin/python3 -m glances -C /etc/glances.conf $GLANCES_OPT
##############################################################################
# minimal image
##############################################################################
################################################################################
# RELEASE: minimal
FROM release as minimal
# Create running images without any building dependency
FROM nvidia/cuda:${IMAGE_VERSION} as minimal
ARG PYTHON_VERSION
COPY --from=buildMinimal /venv /venv
ARG DEBIAN_FRONTEND=noninteractive
################################################################################
# RELEASE: full
FROM release as full
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3 \
python3-packaging \
python3-dateutil \
python3-requests \
curl \
lm-sensors \
wireless-tools \
smartmontools \
net-tools \
tzdata \
&& apt-get install -y --no-install-recommends libzmq5 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=buildRequirements /root/.local/bin /root/.local/bin/
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages/
COPY ./docker-compose/glances.conf /etc/glances.conf
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
# Define default command.
WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
##############################################################################
# dev image
##############################################################################
COPY --from=buildFull /venv /venv
################################################################################
# RELEASE: dev - to be compatible with CI
FROM full as dev
ARG PYTHON_VERSION
COPY --from=buildRequirements /root/.local/bin /root/.local/bin/
COPY --from=buildRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages/
COPY --from=buildOptionalRequirements /root/.local/lib/python${PYTHON_VERSION}/site-packages /root/.local/lib/python${PYTHON_VERSION}/site-packages/
COPY ./docker-compose/glances.conf /etc/glances.conf
# Copy the current Glances source code
COPY . /glances
# EXPOSE PORT (XMLRPC / WebUI)
EXPOSE 61209 61208
# Forward access and error logs to Docker's log collector
RUN ln -sf /dev/stdout /tmp/glances-root.log \
&& ln -sf /dev/stderr /var/log/error.log
# Define default command.
WORKDIR /glances
CMD python3 -m glances -C /etc/glances.conf $GLANCES_OPT
&& ln -sf /dev/stderr /var/log/error.log

9
docker-requirements.txt Normal file
View File

@ -0,0 +1,9 @@
# install with base requirements file
-r requirements.txt
docker>=6.1.1; python_version >= "3.7"
podman; python_version >= "3.6"
packaging; python_version >= "3.7"
python-dateutil
six
urllib3<2.0 # See issue https://github.com/nicolargo/glances/issues/2392

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 125 KiB

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 KiB

After

Width:  |  Height:  |  Size: 349 KiB

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
from glances import __version__
import sys
import os
from datetime import datetime
@ -26,6 +25,7 @@ from datetime import datetime
sys.path.insert(0, os.path.abspath('..'))
# WARNING: Do not move this import before the sys.path.insert() call.
from glances import __version__
# -- General configuration ------------------------------------------------

View File

@ -11,12 +11,16 @@ Get the Glances container:
docker pull nicolargo/glances:<version>
Available tags (all images are based on the Alpine Operating System):
Available tags (all images are based on both Alpine and Ubuntu Operating System):
- `latest` for a minimal Glances image (latest release) version with Console, WebUI and Docker dependencies (Recommended)
- `latest-full` for a full Glances image (latest release) with all dependencies
- `dev` for a full Glances image (development branch) with all dependencies (may be instable)
You can also specify a version (example: 3.3.0.4). All available versions can be found on `DockerHub`_.
- *latest-full* for a full Alpine Glances image (latest release) with all dependencies
- *latest* for a basic Alpine Glances (latest release) version with minimal dependencies (Bottle and Docker)
- *dev* for a basic Alpine Glances image (based on development branch) with all dependencies (Warning: may be instable)
- *ubuntu-latest-full* for a full Ubuntu Glances image (latest release) with all dependencies
- *ubuntu-latest* for a basic Ubuntu Glances (latest release) version with minimal dependencies (Bottle and Docker)
- *ubuntu-dev* for a basic Ubuntu Glances image (based on development branch) with all dependencies (Warning: may be instable)
You can also specify a version (example: 3.4.0). All available versions can be found on `DockerHub`_.
An Example to pull the `latest` tag:
@ -88,7 +92,7 @@ You can also include Glances container in you own `docker-compose.yml`. Here's a
- "traefik.frontend.rule=Host:glances.docker.localhost"
How to protect your Dockerized server (or Web server) with a login/password ?
------------------------------------------------------------------
-----------------------------------------------------------------------------
Below are two methods for setting up a login/password to protect Glances running inside a Docker container.
@ -166,5 +170,53 @@ You can add a ``[passwords]`` block to the Glances configuration file as mention
localhost=mylocalhostpassword
default=mydefaultpassword
Using GPU Plugin with Docker (Only Nvidia GPUs)
-----------------------------------------------
Complete the steps mentioned in the `docker docs <https://docs.docker.com/config/containers/resource_constraints/#gpu>`_
to make the GPU accessible by the docker engine.
With `docker run`
^^^^^^^^^^^^^^^^^
Include the `--gpus` flag with the `docker run` command.
**Note:** Make sure the `--gpus` is present before the image name in the command, otherwise it won't work.
.. code-block:: ini
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --gpus --pid host --network host -it docker.io/nicolargo/glances:latest-full
..
With `docker-compose`
^^^^^^^^^^^^^^^^^^^^^
Include the `deploy` section in compose file as specified below in the example service definition.
.. code-block:: ini
version: '3'
services:
monitoring:
image: nicolargo/glances:latest-full
pid: host
network_mode: host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- "GLANCES_OPT=-w"
# For nvidia GPUs
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
..
Reference: https://docs.docker.com/compose/gpu-support/
.. _DockerHub: https://hub.docker.com/r/nicolargo/glances/tags

View File

@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "GLANCES" "1" "Apr 16, 2023" "3.4.0_beta1" "Glances"
.TH "GLANCES" "1" "May 16, 2023" "3.4.0" "Glances"
.SH NAME
glances \- An eye on your system
.SH SYNOPSIS

View File

@ -2,7 +2,7 @@
#
# This file is part of Glances.
#
# SPDX-FileCopyrightText: 2022 Nicolas Hennion <nicolas@nicolargo.com>
# SPDX-FileCopyrightText: 2023 Nicolas Hennion <nicolas@nicolargo.com>
#
# SPDX-License-Identifier: LGPL-3.0-only
#

View File

@ -555,6 +555,9 @@ Examples of use:
# Plugins refresh rate
if self.config.has_section('global'):
global_refresh = self.config.get_float_value('global', 'refresh', default=self.DEFAULT_REFRESH_TIME)
else:
global_refresh = self.DEFAULT_REFRESH_TIME
# The configuration key can be overwrite from the command line
if args.time == self.DEFAULT_REFRESH_TIME:
args.time = global_refresh
logger.debug('Global refresh rate is set to {} seconds'.format(args.time))

View File

@ -26,7 +26,7 @@ try:
PACKAGING_IMPORT = True
except Exception as e:
logger.error("Unable to import 'packaging' module ({}). Glances cannot check for updates.".format(e))
logger.warning("Unable to import 'packaging' module ({}). Glances cannot check for updates.".format(e))
PACKAGING_IMPORT = False
PYPI_API_URL = 'https://pypi.python.org/pypi/Glances/json'

View File

@ -1,16 +1,44 @@
# How to contribute?
# Focus on the Glances Web User Interface
In order to build the assets of the Web UI, you'll need [npm](https://docs.npmjs.com/getting-started/what-is-npm).
In order to build the assets of the Web UI, you'll need [NPM](https://docs.npmjs.com/getting-started/what-is-npm).
NPM is a package manager for JavaScript related to [Node.js](https://nodejs.org/en/).
NodeJS should be installed/updated on your system.
## Pre-requisites
### Install NodeJS
Example on Ubuntu OS:
```bash
sudo apt install nodejs
```
### Upgrade NodeJS
Example on Ubuntu OS:
```bash
sudo apt update
sudo apt install nodejs
sudo npm install -g n
sudo n lts
hash -r
```
## Build Glances WebUI
You must run the following command from the `glances/outputs/static/` directory.
## Install dependencies
### Install dependencies
```bash
$ npm ci
```
## Build assets
### Build assets
Run the build command to build assets once :
@ -24,7 +52,7 @@ or use the watch command to rebuild only modified files :
$ npm run watch
```
# Anatomy
## Anatomy
```bash
static

File diff suppressed because it is too large Load Diff

View File

@ -3,28 +3,29 @@
"dependencies": {
"bootstrap": "^3.4.1",
"favico.js": "^0.3.10",
"hotkeys-js": "^3.10.1",
"hotkeys-js": "^3.10.2",
"lodash": "^4.17.21",
"sanitize-html": "^2.8.1",
"vue": "^3.2.45"
"sanitize-html": "^2.10.0",
"vue": "^3.3.2"
},
"devDependencies": {
"@vue/compiler-sfc": "^3.3.2",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
"del": "^7.0.0",
"eslint": "^8.32.0",
"eslint-plugin-vue": "^9.9.0",
"html-webpack-plugin": "^5.5.0",
"eslint": "^8.40.0",
"eslint-plugin-vue": "^9.12.0",
"html-webpack-plugin": "^5.5.1",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"sass": "^1.57.1",
"sass-loader": "^13.2.0",
"style-loader": "^3.3.1",
"sass": "^1.62.1",
"sass-loader": "^13.2.2",
"style-loader": "^3.3.2",
"url-loader": "^4.1.1",
"vue-loader": "^17.0.1",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1"
"vue-loader": "^17.1.1",
"webpack": "^5.82.1",
"webpack-cli": "^5.1.1",
"webpack-dev-server": "^4.15.0"
},
"scripts": {
"build": "webpack --progress --mode=production",

File diff suppressed because one or more lines are too long

View File

@ -91,7 +91,7 @@ class PodmanPodStatsFetcher:
# Threaded Streamer
# Temporary patch to get podman extension working
stats_iterable = (pod_manager.stats(decode=True) for _ in iter(int, 1))
self._streamer = StatsStreamer(stats_iterable, initial_stream_value={})
self._streamer = StatsStreamer(stats_iterable, initial_stream_value={}, sleep_duration=2)
def _log_debug(self, msg, exception=None):
logger.debug("containers (Podman): Pod Manager - {} ({})".format(msg, exception))
@ -230,6 +230,8 @@ class PodmanContainersExtension:
"""Connect to Podman."""
try:
self.client = PodmanClient(base_url=self.podman_sock)
# PodmanClient works lazily, so make a ping to determine if socket is open
self.client.ping()
except Exception as e:
logger.error("{} plugin - Can't connect to Podman ({})".format(self.ext_name, e))
self.client = None

View File

@ -19,7 +19,7 @@ class StatsStreamer:
Use `StatsStreamer.stats` to access the latest streamed results
"""
def __init__(self, iterable, initial_stream_value=None):
def __init__(self, iterable, initial_stream_value=None, sleep_duration=0.1):
"""
iterable: an Iterable instance that needs to be streamed
"""
@ -34,6 +34,8 @@ class StatsStreamer:
self.result_lock = threading.Lock()
# Last result streamed time (initial val 0)
self._last_update_time = 0
# Time to sleep before next iteration
self._sleep_duration = sleep_duration
self._thread.start()
@ -56,7 +58,7 @@ class StatsStreamer:
self._raw_result = res
self._post_update_hook()
time.sleep(0.1)
time.sleep(self._sleep_duration)
if self.stopped():
break

View File

@ -307,7 +307,7 @@ def get_device_name(device_handle):
"""Get GPU device name."""
try:
return nativestr(pynvml.nvmlDeviceGetName(device_handle))
except pynvml.NVMlError:
except pynvml.NVMLError:
return "NVIDIA"

View File

@ -15,7 +15,7 @@ influxdb>=1.0.0 # For InfluxDB < 1.8
influxdb-client; python_version >= "3.7" # For InfluxDB >= 1.8
kafka-python
netifaces
py3nvml; python_version >= "3.5"
packaging; python_version >= "3.7"
paho-mqtt
pika
podman; python_version >= "3.6"
@ -24,6 +24,7 @@ prometheus_client
pygal
pymdstat
pymongo; python_version >= "3.7"
py3nvml; python_version >= "3.5"
pysnmp
pySMART.smartx
python-dateutil

View File

@ -59,7 +59,7 @@ def get_install_extras_require():
'action': ['chevron'],
'browser': ['zeroconf>=0.19.1'],
'cloud': ['requests'],
'containers': ['docker>=6.1.1', 'python-dateutil', 'six', 'podman'],
'containers': ['docker>=6.1.1', 'python-dateutil', 'six', 'podman', 'packaging'],
'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch',
'graphitesender', 'influxdb>=1.0.0', 'influxdb-client', 'pymongo',
'kafka-python', 'pika', 'paho-mqtt', 'potsdb', 'prometheus_client',