summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolashennion@gmail.com>2024-06-08 10:25:45 +0200
committernicolargo <nicolashennion@gmail.com>2024-06-08 10:25:45 +0200
commitbf3bb6a7e86f4f6a21d9ca908031c4d135c29236 (patch)
treefef87fa030b055663806e4d00b36275046509cbb
parentb1b8ea6966149df694ea7831df70dc6cbe9b9b01 (diff)
parent8d3b3691e595592bd700b7ed64eca5b87c0a4f44 (diff)
Glances 4.0.8
-rw-r--r--.github/workflows/build.yml15
-rw-r--r--NEWS.rst56
-rw-r--r--README.rst3
-rw-r--r--conf/glances.conf27
-rw-r--r--doc-requirements.txt2
-rwxr-xr-xdocker-compose/glances.conf25
-rw-r--r--docker-requirements.txt5
-rw-r--r--docs/aoa/amps.rst6
-rw-r--r--docs/aoa/network.rst6
-rw-r--r--docs/api.rst226
-rw-r--r--docs/config.rst31
-rw-r--r--docs/man/glances.141
-rw-r--r--glances/__init__.py2
-rw-r--r--glances/amps/default/__init__.py11
-rw-r--r--glances/amps/systemv/__init__.py8
-rw-r--r--glances/client.py6
-rw-r--r--glances/client_browser.py10
-rw-r--r--glances/config.py30
-rw-r--r--glances/cpu_percent.py18
-rw-r--r--glances/globals.py6
-rw-r--r--glances/outputs/glances_curses_browser.py27
-rw-r--r--glances/outputs/glances_restful_api.py10
-rw-r--r--glances/outputs/static/css/style.scss30
-rw-r--r--glances/outputs/static/js/App.vue3
-rw-r--r--glances/outputs/static/public/1272f6e9e8f9d6bfd6de.pngbin50295 -> 0 bytes
-rw-r--r--glances/outputs/static/public/glances.js6
-rw-r--r--glances/plugins/ip/__init__.py2
-rw-r--r--glances/plugins/network/__init__.py16
-rw-r--r--glances/plugins/plugin/model.py2
-rw-r--r--glances/secure.py2
-rw-r--r--glances/server.py40
-rw-r--r--glances/stats.py16
-rw-r--r--optional-requirements.txt17
-rw-r--r--pyproject.toml5
-rw-r--r--requirements.txt2
-rw-r--r--snap/snapcraft.yaml6
-rw-r--r--tox.ini2
-rwxr-xr-xunittest-xmlrpc.py51
38 files changed, 508 insertions, 263 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 88385df1..024a37bc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -123,19 +123,12 @@ jobs:
- name: Retrieve Repository Docker metadata
id: docker_meta
- uses: crazy-max/ghaction-docker-meta@v5.0.0
+ uses: docker/metadata-action@v5
with:
images: ${{ env.DEFAULT_DOCKER_IMAGE }}
labels: |
org.opencontainers.image.url=https://nicolargo.github.io/glances/
- - name: Cache Docker layers
- uses: actions/cache@v4
- with:
- path: /tmp/.buildx-cache
- key: ${{ runner.os }}-buildx-${{ env.NODE_ENV }}-${{ matrix.os }}-${{ matrix.tag.tag }}
- restore-keys: ${{ runner.os }}-buildx-${{ env.NODE_ENV }}-${{ matrix.os }}
-
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
@@ -166,5 +159,7 @@ jobs:
platforms: ${{ matrix.os != 'ubuntu' && env.DOCKER_PLATFORMS || env.DOCKER_PLATFORMS_UBUNTU }}
target: ${{ matrix.tag.target }}
labels: ${{ steps.docker_meta.outputs.labels }}
- cache-from: type=local,src=/tmp/.buildx-cache
- cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
+ # GHA default behaviour overwrites last build cache. Causes alpine and ubuntu cache to overwrite each other.
+ # Use `scope` with the os name to prevent that
+ cache-from: 'type=gha,scope=${{ matrix.os }}'
+ cache-to: 'type=gha,mode=max,scope=${{ matrix.os }}'
diff --git a/NEWS.rst b/NEWS.rst
index e58a9c14..08f9519b 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -49,6 +49,62 @@ Version 4.0.2
Thanks to RazCrimson for the sensors patch !
===============
+Version 4.0.8
+===============
+
+* Make CORS option configurable security webui #2812
+* When Glances is installed via venv, default configuration file is not used documentation packaging #2803
+* GET /1272f6e9e8f9d6bfd6de.png results in 404 bug webui #2781 by Emporea was closed May 25, 2024
+* Screen frequently flickers when outputting to local display bug needs test #2490
+* Retire ujson for being in maintenance mode dependencies enhancement #2791
+
+===============
+Version 4.0.7
+===============
+
+* cpu_hz_current not available on NetBSD #2792
+* SensorType change in REST API breaks compatibility in 4.0.4 #2788
+
+===============
+Version 4.0.6
+===============
+
+* No GPU info on Web View #2796
+
+===============
+Version 4.0.5
+===============
+
+* SensorType change in REST API breaks compatibility in 4.0.4 #2788
+* Please make pydantic optional dependency, not required one #2777
+* Update the Grafana dashboard #2780
+* 4.0.4 - On Glances startup "ERROR -- Can not init battery class #2776
+* In codeSpace (with Python 3.8), an error occurs in ./unittest-restful.py #2773
+
+Use Ruff as default Linter.
+
+===============
+Version 4.0.4
+===============
+
+Hostfix release for support sensors plugin on python 3.8
+
+===============
+Version 4.0.3
+===============
+
+Additional fixes for Sensor plugin
+
+===============
+Version 4.0.2
+===============
+
+* hotfix: plugin(sensors) - race conditions btw fan_speed & temperature… #2766
+* fix: include requirements.txt and SECURITY.md for pypi dist #2761
+
+Thanks to RazCrimson for the sensors patch !
+
+===============
Version 4.0.1
===============
diff --git a/README.rst b/README.rst
index 5331994d..7bee0ed3 100644
--- a/README.rst
+++ b/README.rst
@@ -86,7 +86,7 @@ Requirements
- ``psutil`` (better with latest version)
- ``defusedxml`` (in order to monkey patch xmlrpc)
- ``packaging`` (for the version comparison)
-- ``ujson`` (an optimized alternative to the standard json module)
+- ``orjson`` (an optimized alternative to the standard json module)
*Note for Python 2 users*
@@ -115,7 +115,6 @@ Optional dependencies:
- ``podman`` (for the Containers Podman monitoring support)
- ``potsdb`` (for the OpenTSDB export module)
- ``prometheus_client`` (for the Prometheus export module)
-- ``py-cpuinfo`` (for the Quicklook CPU info module)
- ``pygal`` (for the graph export module)
- ``pymdstat`` (for RAID support) [Linux-only]
- ``pymongo`` (for the MongoDB export module)
diff --git a/conf/glances.conf b/conf/glances.conf
index 83f0dac3..4de3d3a9 100644
--- a/conf/glances.conf
+++ b/conf/glances.conf
@@ -23,12 +23,16 @@ history_size=1200
##############################################################################
[outputs]
+# Options for all UIs
+#--------------------
# Separator in the Curses and WebUI interface (between top and others plugins)
separator=True
# Set the the Curses and WebUI interface left menu plugin list (comma-separated)
#left_menu=network,wifi,connections,ports,diskio,fs,irq,folders,raid,smart,sensors,now
# Limit the number of processes to display (in the WebUI)
max_processes_display=25
+# Options for WebUI
+#------------------
# Set URL prefix for the WebUI and the API
# Example: url_prefix=/glances/ => http://localhost/glances/
# Note: The final / is mandatory
@@ -41,9 +45,22 @@ max_processes_display=25
# then configure this folder with the webui_root_path key
# Default is folder where glances_restfull_api.py is hosted
#webui_root_path=
+# CORS options
+# Comma separated list of origins that should be permitted to make cross-origin requests.
+# Default is *
+#cors_origins=*
+# Indicate that cookies should be supported for cross-origin requests.
+# Default is True
+#cors_credentials=True
+# Comma separated list of HTTP methods that should be allowed for cross-origin requests.
+# Default is *
+#cors_methods=*
+# Comma separated list of HTTP request headers that should be supported for cross-origin requests.
+# Default is *
+#cors_headers=*
##############################################################################
-# plugins
+# Plugins
##############################################################################
[quicklook]
@@ -199,6 +216,10 @@ tx_critical=90
hide=docker.*,lo
# Define the list of wireless network interfaces to be show (comma-separated)
#show=docker.*
+# Automatically hide interface not up (default is False)
+#hide_no_up=True
+# Automatically hide interface with no IP address (default is False)
+#hide_no_ip=True
# It is possible to overwrite the bitrate thresholds per interface
# WLAN 0 Default limits (in bits per second aka bps) for interface bitrate
#wlan0_rx_careful=4000000
@@ -765,13 +786,13 @@ refresh=3
countmax=20
[amp_conntrack]
-# Use comma separated for multiple commands (no space around the comma)
+# Use && separator for multiple commands
# If the regex key is not defined, the AMP will be executed every refresh second
# and the process count will not be displayed (countmin and countmax will be ignore)
enable=false
refresh=30
one_line=false
-command=sysctl net.netfilter.nf_conntrack_count;sysctl net.netfilter.nf_conntrack_max
+command=sysctl net.netfilter.nf_conntrack_count && sysctl net.netfilter.nf_conntrack_max
[amp_nginx]
# Use the NGinx AMP
diff --git a/doc-requirements.txt b/doc-requirements.txt
index 804d5398..74d6796a 100644
--- a/doc-requirements.txt
+++ b/doc-requirements.txt
@@ -1,5 +1,5 @@
+orjson
reuse
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
sphinx
sphinx_rtd_theme
-ujson
diff --git a/docker-compose/glances.conf b/docker-compose/glances.conf
index 0686b528..792a155d 100755
--- a/docker-compose/glances.conf
+++ b/docker-compose/glances.conf
@@ -23,12 +23,16 @@ history_size=1200
##############################################################################
[outputs]
+# Options for all UIs
+#--------------------
# Separator in the Curses and WebUI interface (between top and others plugins)
separator=True
# Set the the Curses and WebUI interface left menu plugin list (comma-separated)
#left_menu=network,wifi,connections,ports,diskio,fs,irq,folders,raid,smart,sensors,now
# Limit the number of processes to display (in the WebUI)
max_processes_display=25
+# Options for WebUI
+#------------------
# Set URL prefix for the WebUI and the API
# Example: url_prefix=/glances/ => http://localhost/glances/
# Note: The final / is mandatory
@@ -41,6 +45,19 @@ max_processes_display=25
# then configure this folder with the webui_root_path key
# Default is folder where glances_restfull_api.py is hosted
#webui_root_path=
+# CORS options
+# Comma separated list of origins that should be permitted to make cross-origin requests.
+# Default is *
+#cors_origins=*
+# Indicate that cookies should be supported for cross-origin requests.
+# Default is True
+#cors_credentials=True
+# Comma separated list of HTTP methods that should be allowed for cross-origin requests.
+# Default is *
+#cors_methods=*
+# Comma separated list of HTTP request headers that should be supported for cross-origin requests.
+# Default is *
+#cors_headers=*
##############################################################################
# plugins
@@ -199,6 +216,10 @@ tx_critical=90
#hide=docker.*,lo
# Define the list of wireless network interfaces to be show (comma-separated)
#show=docker.*
+# Automatically hide interface not up (default is False)
+hide_no_up=True
+# Automatically hide interface with no IP address (default is False)
+hide_no_ip=True
# It is possible to overwrite the bitrate thresholds per interface
# WLAN 0 Default limits (in bits per second aka bps) for interface bitrate
#wlan0_rx_careful=4000000
@@ -765,13 +786,13 @@ refresh=3
countmax=20
[amp_conntrack]
-# Use comma separated for multiple commands (no space around the comma)
+# Use && separator for multiple commands
# If the regex key is not defined, the AMP will be executed every refresh second
# and the process count will not be displayed (countmin and countmax will be ignore)
enable=false
refresh=30
one_line=false
-command=sysctl net.netfilter.nf_conntrack_count;sysctl net.netfilter.nf_conntrack_max
+command=sysctl net.netfilter.nf_conntrack_count && sysctl net.netfilter.nf_conntrack_max
[amp_nginx]
# Use the NGinx AMP
diff --git a/docker-requirements.txt b/docker-requirements.txt
index feac4040..d73baf4f 100644
--- a/docker-requirements.txt
+++ b/docker-requirements.txt
@@ -1,9 +1,8 @@
# install with base requirements file
-r requirements.txt
-docker>=6.1.1; python_version >= "3.7"
-packaging; python_version >= "3.7"
-podman; python_version >= "3.6"
+docker>=6.1.1
+podman
python-dateutil
requests
six
diff --git a/docs/aoa/amps.rst b/docs/aoa/amps.rst
index be1d2f02..83f03c65 100644
--- a/docs/aoa/amps.rst
+++ b/docs/aoa/amps.rst
@@ -61,9 +61,11 @@ For example:
enable=false
refresh=30
one_line=false
- command=sysctl net.netfilter.nf_conntrack_count;sysctl net.netfilter.nf_conntrack_max
+ command=sysctl net.netfilter.nf_conntrack_count && sysctl net.netfilter.nf_conntrack_max
-For security reason, pipe is not directly allowed in a AMP command but you create a sheel
+Note: for multiple command, please use the '&&'' separator.
+
+For security reason, pipe is not directly allowed in a AMP command but you create a shell
script with your command:
.. code-block:: ini
diff --git a/docs/aoa/network.rst b/docs/aoa/network.rst
index a1f116ac..d6b02d91 100644
--- a/docs/aoa/network.rst
+++ b/docs/aoa/network.rst
@@ -17,6 +17,8 @@ In this case thresholds values are define in bps.
Additionally, you can define:
- a list of network interfaces to hide
+- automatically hide interfaces not up
+- automatically hide interfaces without IP address
- per-interface limit values
- aliases for interface name
@@ -41,6 +43,10 @@ virtual docker interface (docker0, docker1, ...):
hide=docker.*,lo
# Define the list of network interfaces to show (comma-separated regexp)
#show=eth0,eth1
+ # Automatically hide interface not up (default is False)
+ hide_no_up=True
+ # Automatically hide interface with no IP address (default is False)
+ hide_no_ip=True
# WLAN 0 alias
wlan0_alias=Wireless IF
# It is possible to overwrite the bitrate thresholds per interface
diff --git a/docs/api.rst b/docs/api.rst
index b05afe3d..e6b058fa 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -141,7 +141,7 @@ Get plugin stats::
"refresh": 3.0,
"regex": True,
"result": None,
- "timer": 0.17942380905151367},
+ "timer": 0.24439311027526855},
{"count": 0,
"countmax": 20.0,
"countmin": None,
@@ -150,7 +150,7 @@ Get plugin stats::
"refresh": 3.0,
"regex": True,
"result": None,
- "timer": 0.17932724952697754}]
+ "timer": 0.2443389892578125}]
Fields descriptions:
@@ -178,7 +178,7 @@ Get a specific item when field matches the given value::
"refresh": 3.0,
"regex": True,
"result": None,
- "timer": 0.17942380905151367}]}
+ "timer": 0.24439311027526855}]}
GET cloud
---------
@@ -219,7 +219,21 @@ GET containers
Get plugin stats::
# curl http://localhost:61208/api/4/containers
- []
+ [{"command": "/bin/sh -c /venv/bin/python3 -m glances $GLANCES_OPT",
+ "cpu": {"total": 0.0},
+ "cpu_percent": 0.0,
+ "created": "2024-05-25T13:52:22.535373707Z",
+ "engine": "docker",
+ "id": "bb99d31288db8904ed4cd43db8255a926830936189bc180d77c3459cbaa7f490",
+ "image": ["nicolargo/glances:latest"],
+ "io": {},
+ "key": "name",
+ "memory": {},
+ "memory_usage": None,
+ "name": "wizardly_nightingale",
+ "network": {},
+ "status": "running",
+ "uptime": "14 mins"}]
Fields descriptions:
@@ -240,6 +254,31 @@ Fields descriptions:
* **pod_name**: Pod name (only with Podman) (unit is *None*)
* **pod_id**: Pod ID (only with Podman) (unit is *None*)
+Get a specific field::
+
+ # curl http://localhost:61208/api/4/containers/name
+ {"name": ["wizardly_nightingale"]}
+
+Get a specific item when field matches the given value::
+
+ # curl http://localhost:61208/api/4/containers/name/wizardly_nightingale
+ {"wizardly_nightingale": [{"command": "/bin/sh -c /venv/bin/python3 -m glances "
+ "$GLANCES_OPT",
+ "cpu": {"total": 0.0},
+ "cpu_percent": 0.0,
+ "created": "2024-05-25T13:52:22.535373707Z",
+ "engine": "docker",
+ "id": "bb99d31288db8904ed4cd43db8255a926830936189bc180d77c3459cbaa7f490",
+ "image": ["nicolargo/glances:latest"],
+ "io": {},
+ "key": "name",
+ "memory": {},
+ "memory_usage": None,
+ "name": "wizardly_nightingale",
+ "network": {},
+ "status": "running",
+ "uptime": "14 mins"}]}
+
GET core
--------
@@ -265,18 +304,18 @@ Get plugin stats::
# curl http://localhost:61208/api/4/cpu
{"cpucore": 16,
- "ctx_switches": 247960513,
+ "ctx_switches": 7772781,
"guest": 0.0,
- "idle": 0.0,
- "interrupts": 235154276,
+ "idle": 3.0,
+ "interrupts": 6643340,
"iowait": 0.0,
"irq": 0.0,
"nice": 0.0,
- "soft_interrupts": 79848589,
+ "soft_interrupts": 1761276,
"steal": 0.0,
"syscalls": 0,
"system": 0.0,
- "total": 0.0,
+ "total": 16.7,
"user": 1.0}
Fields descriptions:
@@ -310,7 +349,7 @@ Fields descriptions:
Get a specific field::
# curl http://localhost:61208/api/4/cpu/total
- {"total": 0.0}
+ {"total": 16.7}
GET diskio
----------
@@ -320,14 +359,14 @@ Get plugin stats::
# curl http://localhost:61208/api/4/diskio
[{"disk_name": "nvme0n1",
"key": "disk_name",
- "read_bytes": 4854106624,
- "read_count": 207109,
- "write_bytes": 15446680576,
- "write_count": 891078},
+ "read_bytes": 3983976960,
+ "read_count": 115648,
+ "write_bytes": 3073111040,
+ "write_count": 91409},
{"disk_name": "nvme0n1p1",
"key": "disk_name",
- "read_bytes": 7484416,
- "read_count": 592,
+ "read_bytes": 7476224,
+ "read_count": 576,
"write_bytes": 1024,
"write_count": 2}]
@@ -363,10 +402,10 @@ Get a specific item when field matches the given value::
# curl http://localhost:61208/api/4/diskio/disk_name/nvme0n1
{"nvme0n1": [{"disk_name": "nvme0n1",
"key": "disk_name",
- "read_bytes": 4854106624,
- "read_count": 207109,
- "write_bytes": 15446680576,
- "write_count": 891078}]}
+ "read_bytes": 3983976960,
+ "read_count": 115648,
+ "write_bytes": 3073111040,
+ "write_count": 91409}]}
GET folders
-----------
@@ -393,13 +432,13 @@ Get plugin stats::
# curl http://localhost:61208/api/4/fs
[{"device_name": "/dev/mapper/ubuntu--vg-ubuntu--lv",
- "free": 904231424000,
+ "free": 902284546048,
"fs_type": "ext4",
"key": "mnt_point",
"mnt_point": "/",
- "percent": 5.1,
+ "percent": 5.3,
"size": 1003736440832,
- "used": 48442511360}]
+ "used": 50389389312}]
Fields descriptions:
@@ -420,13 +459,13 @@ Get a specific item when field matches the given value::
# curl http://localhost:61208/api/4/fs/mnt_point//
{"/": [{"device_name": "/dev/mapper/ubuntu--vg-ubuntu--lv",
- "free": 904231424000,
+ "free": 902284546048,
"fs_type": "ext4",
"key": "mnt_point",
"mnt_point": "/",
- "percent": 5.1,
+ "percent": 5.3,
"size": 1003736440832,
- "used": 48442511360}]}
+ "used": 50389389312}]}
GET gpu
-------
@@ -500,9 +539,9 @@ Get plugin stats::
# curl http://localhost:61208/api/4/load
{"cpucore": 16,
- "min1": 0.2802734375,
- "min15": 0.6240234375,
- "min5": 0.61376953125}
+ "min1": 0.560546875,
+ "min15": 0.54833984375,
+ "min5": 0.70166015625}
Fields descriptions:
@@ -514,7 +553,7 @@ Fields descriptions:
Get a specific field::
# curl http://localhost:61208/api/4/load/min1
- {"min1": 0.2802734375}
+ {"min1": 0.560546875}
GET mem
-------
@@ -522,16 +561,16 @@ GET mem
Get plugin stats::
# curl http://localhost:61208/api/4/mem
- {"active": 8875126784,
- "available": 7975804928,
- "buffers": 463708160,
- "cached": 7862255616,
- "free": 7975804928,
- "inactive": 4694634496,
- "percent": 51.4,
- "shared": 849006592,
+ {"active": 5540470784,
+ "available": 11137699840,
+ "buffers": 226918400,
+ "cached": 6333566976,
+ "free": 11137699840,
+ "inactive": 3872489472,
+ "percent": 32.2,
+ "shared": 656637952,
"total": 16422486016,
- "used": 8446681088}
+ "used": 5284786176}
Fields descriptions:
@@ -558,13 +597,13 @@ GET memswap
Get plugin stats::
# curl http://localhost:61208/api/4/memswap
- {"free": 4293914624,
+ {"free": 4294963200,
"percent": 0.0,
"sin": 0,
- "sout": 114688,
+ "sout": 0,
"time_since_update": 1,
"total": 4294963200,
- "used": 1048576}
+ "used": 0}
Fields descriptions:
@@ -589,15 +628,26 @@ Get plugin stats::
# curl http://localhost:61208/api/4/network
[{"alias": None,
"bytes_all": 0,
- "bytes_all_gauge": 1608088786,
+ "bytes_all_gauge": 422462144,
"bytes_recv": 0,
- "bytes_recv_gauge": 1294928139,
+ "bytes_recv_gauge": 413272561,
"bytes_sent": 0,
- "bytes_sent_gauge": 313160647,
+ "bytes_sent_gauge": 9189583,
"interface_name": "wlp0s20f3",
"key": "interface_name",
"speed": 0,
- "time_since_update": 0.18457698822021484}]
+ "time_since_update": 0.24814295768737793},
+ {"alias": None,
+ "bytes_all": 0,
+ "bytes_all_gauge": 18987,
+ "bytes_recv": 0,
+ "bytes_recv_gauge": 528,
+ "bytes_sent": 0,
+ "bytes_sent_gauge": 18459,
+ "interface_name": "vethfc47299",
+ "key": "interface_name",
+ "speed": 10485760000,
+ "time_since_update": 0.24814295768737793}]
Fields descriptions:
@@ -619,22 +669,22 @@ Fields descriptions:
Get a specific field::
# curl http://localhost:61208/api/4/network/interface_name
- {"interface_name": ["wlp0s20f3"]}
+ {"interface_name": ["wlp0s20f3", "vethfc47299"]}
Get a specific item when field matches the given value::
# curl http://localhost:61208/api/4/network/interface_name/wlp0s20f3
{"wlp0s20f3": [{"alias": None,
"bytes_all": 0,
- "bytes_all_gauge": 1608088786,
+ "bytes_all_gauge": 422462144,
"bytes_recv": 0,
- "bytes_recv_gauge": 1294928139,
+ "bytes_recv_gauge": 413272561,
"bytes_sent": 0,
- "bytes_sent_gauge": 313160647,
+ "bytes_sent_gauge": 9189583,
"interface_name": "wlp0s20f3",
"key": "interface_name",
"speed": 0,
- "time_since_update": 0.18457698822021484}]}
+ "time_since_update": 0.24814295768737793}]}
GET now
-------