summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.bandit2
-rw-r--r--.ci/appveyor/download_exes.py2
-rw-r--r--.github/workflows/build.yml (renamed from .github/workflows/main.yml)40
-rw-r--r--.github/workflows/test.yml45
-rw-r--r--.travis.yml44
-rw-r--r--Makefile3
-rw-r--r--NEWS.rst32
-rw-r--r--README.rst120
-rw-r--r--appveyor.yml13
-rw-r--r--conf/glances.conf40
-rw-r--r--docs/_static/smart.pngbin0 -> 21500 bytes
-rw-r--r--docs/aoa/actions.rst20
-rw-r--r--docs/aoa/fs.rst25
-rw-r--r--docs/aoa/hddtemp.rst19
-rw-r--r--docs/aoa/index.rst1
-rw-r--r--docs/aoa/raid.rst2
-rw-r--r--docs/aoa/sensors.rst6
-rw-r--r--docs/aoa/smart.rst2
-rw-r--r--docs/cmds.rst6
-rw-r--r--docs/gw/elastic.rst18
-rw-r--r--docs/gw/mqtt.rst6
-rw-r--r--docs/man/glances.18
-rw-r--r--glances/__init__.py9
-rw-r--r--glances/actions.py29
-rw-r--r--glances/compat.py4
-rw-r--r--glances/config.py8
-rw-r--r--glances/exports/glances_elasticsearch.py77
-rw-r--r--glances/exports/glances_json.py10
-rw-r--r--glances/exports/glances_mqtt.py50
-rw-r--r--glances/main.py10
-rw-r--r--glances/outputs/glances_bottle.py14
-rw-r--r--glances/outputs/glances_stdout_issue.py123
-rw-r--r--glances/outputs/static/js/components/plugin-gpu/controller.js5
-rw-r--r--glances/outputs/static/js/components/plugin-gpu/view.html11
-rw-r--r--glances/outputs/static/package-lock.json1382
-rw-r--r--glances/outputs/static/public/glances.js67
-rw-r--r--glances/outputs/static/public/glances.map.js2
-rw-r--r--glances/plugins/glances_alert.py95
-rw-r--r--glances/plugins/glances_cpu.py58
-rw-r--r--glances/plugins/glances_diskio.py7
-rw-r--r--glances/plugins/glances_fs.py2
-rw-r--r--glances/plugins/glances_gpu.py32
-rw-r--r--glances/plugins/glances_mem.py6
-rw-r--r--glances/plugins/glances_memswap.py7
-rw-r--r--glances/plugins/glances_network.py7
-rw-r--r--glances/plugins/glances_processcount.py1
-rw-r--r--glances/plugins/glances_sensors.py12
-rw-r--r--glances/plugins/glances_smart.py13
-rw-r--r--glances/secure.py87
-rw-r--r--glances/standalone.py17
-rw-r--r--optional-requirements.txt5
-rwxr-xr-xsetup.py2
-rw-r--r--snap/snapcraft.yaml6
-rw-r--r--tox.ini2
-rwxr-xr-xunitest.py27
55 files changed, 1522 insertions, 1119 deletions
diff --git a/.bandit b/.bandit
new file mode 100644
index 00000000..eb7ce63c
--- /dev/null
+++ b/.bandit
@@ -0,0 +1,2 @@
+[bandit]
+exclude: ./docs,./glances/outputs/static/node_modules
diff --git a/.ci/appveyor/download_exes.py b/.ci/appveyor/download_exes.py
index 7db3848b..cb8cb0b2 100644
--- a/.ci/appveyor/download_exes.py
+++ b/.ci/appveyor/download_exes.py
@@ -25,7 +25,7 @@ from concurrent.futures import ThreadPoolExecutor
BASE_URL = 'https://ci.appveyor.com/api'
-PY_VERSIONS = ['2.7', '3.4', '3.5', '3.6', '3.7', '3.8']
+PY_VERSIONS = ['2.7', '3.4', '3.5', '3.6', '3.7', '3.8', '3.9']
def term_supports_colors(file=sys.stdout):
diff --git a/.github/workflows/main.yml b/.github/workflows/build.yml
index d58e3e41..97c60e8e 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/build.yml
@@ -1,3 +1,7 @@
+# This pipeline aims at building Glances for the following targets:
+# - Docker Hub
+# - Pypi
+
name: CI
env:
@@ -83,3 +87,39 @@ jobs:
platforms: ${{env.DOCKER_PLATFORMS}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
+
+ pypi:
+ runs-on: ubuntu-latest
+ steps:
+
+ - uses: actions/checkout@v2
+
+ - name: Install pip install build tools
+ run: >-
+ python -m
+ pip install
+ build
+ --user
+
+ - name: Build a binary wheel and a source tarball
+ run: >-
+ python -m
+ build
+ --sdist
+ --wheel
+ --outdir dist/
+
+ - name: Publish distribution package to Test PyPI
+ uses: pypa/gh-action-pypi-publish@master
+ with:
+ user: __token__
+ password: ${{ secrets.TEST_PYPI_API_TOKEN }}
+ repository_url: https://test.pypi.org/legacy/
+ skip_existing: true
+
+ - name: Publish distribution package to PyPI
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
+ uses: pypa/gh-action-pypi-publish@master
+ with:
+ user: __token__
+ password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00000000..a0cd40dc
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,45 @@
+# Run unitary test + flake8
+
+name: test
+
+on: [push]
+
+jobs:
+ test:
+
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
+
+ steps:
+
+ - uses: actions/checkout@v2
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install flake8
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+
+ - name: Lint with flake8
+ run: |
+ # Stop the build if there are Python syntax errors or undefined names
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,./docs,./glances/outputs/static
+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=.git,./docs,./glances/outputs/static
+
+ - name: Unitary tests
+ run: |
+ python ./unitest.py
+
+ - name: Security issues with Bandit
+ uses: jpetrucciani/bandit-check@master
+ with:
+ #path: '-r --exit-zero --skip B104 ./glances/'
+ path: '-r --exit-zero --skip B104 ./glances/' \ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 7ec03af1..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-language: python
-
-cache: pip
-
-python:
- - '2.7'
- - '3.4'
- - '3.5'
- - '3.6'
- - '3.7'
- - '3.8'
- - pypy3
-
-install:
- - pip install -r requirements.txt
- - pip install coveralls
-
-script:
- - pip install .
- - coverage run --source=glances unitest.py
-
-after_success:
- - coveralls
-
-deploy:
- - provider: pypi
- user: nicolargo
- password:
- secure: Fms23jiiKKq6qJMsZYrmBz5mC753VGrjCxzVrsioENfH3KaFf6kUc9fTYntaLvjLPTNBkU3R2IORfVOikJKmNWqWVZOdJ/nq8zPl6o9MgdNcX7qWTvY8Fi9MW7tIZHrehhm0LvWFVq8ZSc8iYzw3/741lvBh8vpJZSQs3sq/1QI=
- on:
- tags: true
- branch: master
- distributions: sdist bdist_wheel
- repo: nicolargo/glances
- - provider: pypi
- server: https://test.pypi.org/legacy/
- user: nicolargo
- password:
- secure: kxchYP3VJWe74jun0rJjuEFFpnO2sF3WHsK5Axlz4flJ6dtX0OPeZd9SlqgMX7cv9FHcXxyukVKrw4PHVqUNcWoaKM8TNeddKkGeSjcVY5C7NIExXh5es4SguozdT4cckoJUyN2xXc7cUAM68CHWfxijR6NiDMXIuMJrZumye6c=
- on:
- tags: false
- branch: develop
- distributions: sdist bdist_wheel
- repo: nicolargo/glances
diff --git a/Makefile b/Makefile
index 6f378e65..3f3524bc 100644
--- a/Makefile
+++ b/Makefile
@@ -13,4 +13,7 @@ docs-server: docs
(sleep 2 && sensible-browser "http://localhost:$(PORT)") &
cd docs/_build/html/ && python -m SimpleHTTPServer $(PORT)
+webui:
+ cd glances/outputs/static/ && npm install && npm audit fix && npm run build
+
.PHONY: test docs docs-server
diff --git a/NEWS.rst b/NEWS.rst
index bb83c431..386a35b2 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -2,6 +2,36 @@
Glances Version 3
==============================================================================
+===============
+Version 3.1.7
+===============
+
+Enhancements and bug corrected:
+
+ * Security audit - B411 #1025 (by nicolargo)
+ * GPU temperature not shown in webview #1849 (by nicolargo)
+ * Remove shell=True for actions (following Bandit issue report) #1851 (by nicolargo)
+ * Replace Travis by Github action #1850 (by nicolargo)
+ * '/api/3/processlist/pid/3936'use this api can't get right info,all messy code #1828 (by nicolargo)
+ * Refactor the way importants stats are displayed #1826 (by nicolargo)
+ * Re-apply the Add hide option to sensors plugin #1596 PR (by nicolargo)
+ * Smart plugin error while start glances as root #1806 (by nicolargo)
+ * Plugin quicklook takes more than one seconds to update #1820 (by nicolargo)
+ * Replace Pystache by Chevron 2/2 See #1817 (by nicolargo)
+ * Doc. No SMART screenshot. #1799 (by nicolargo)
+ * Update docs following PR #1798 (by nicolargo)
+
+Contributors for this version:
+
+ - Nicolargo
+ - Deosrc
+ - dependabot[bot]
+ - Michael J. Cohen
+ - Rui Chen
+ - Stefan Eßer
+ - Tuux
+
+===============
Version 3.1.6.2
===============
@@ -14,7 +44,7 @@ Version 3.1.6.1
Bugs corrected:
- * Glances crash after installing module for shown GPU informations on Windows 10 #1800
+ * Glances crash after installing module for shown GPU informations on Windows 10 #1800
Version 3.1.6
=============
diff --git a/README.rst b/README.rst
index b66d4184..e518768e 100644
--- a/README.rst
+++ b/README.rst
@@ -57,14 +57,21 @@ add new plugins or exports modules.
Requirements
============
-- ``python 2.7,>=3.4``
+- ``python>=2.7`` or ``python>=3.4``
- ``psutil>=5.3.0`` (better with latest version)
+*Note for Python 2.6 users*
+
+Glances no longer supports Python 2.6. Please upgrade
+to a minimum Python version of 2.7/3.4+ or downgrade to Glances 2.6.2 (last version
+with Python 2.6 support).
+
Optional dependencies:
- ``bernhard`` (for the Riemann export module)
- ``bottle`` (for Web server mode)
- ``cassandra-driver`` (for the Cassandra export module)
+- ``chevron`` (for the action script feature)
- ``couchdb`` (for the CouchDB export module)
- ``docker`` (for the Docker monitoring support) [Linux/macOS-only]
- ``elasticsearch`` (for the Elastic Search export module)
@@ -73,74 +80,44 @@ Optional dependencies:
- ``influxdb-client`` (for the InfluxDB version 2 export module) [Only for Python >= 3.6]
- ``kafka-python`` (for the Kafka export module)
- ``netifaces`` (for the IP plugin)
-- ``nvidia-ml-py3`` (for the GPU plugin)
+- ``py3nvml`` (for the GPU plugin) [Only for Python 3]
- ``pika`` (for the RabbitMQ/ActiveMQ export module)
- ``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]
-- ``pySMART.smartx`` (for HDD Smart support) [Linux-only]
- ``pysnmp`` (for SNMP support)
-- ``pystache`` (for the action script feature)
+- ``pySMART.smartx`` (for HDD Smart support) [Linux-only]
- ``pyzmq`` (for the ZeroMQ export module)
- ``requests`` (for the Ports, Cloud plugins and RESTful export module)
- ``scandir`` (for the Folders plugin) [Only for Python < 3.5]
+- ``sparklines`` (for the Quick Plugin sparklines option)
- ``statsd`` (for the StatsD export module)
- ``wifi`` (for the wifi plugin) [Linux-only]
- ``zeroconf`` (for the autodiscover mode)
-*Note for Python 2.6 users*
-
-Glances no longer supports Python 2.6. Please upgrade
-to a minimum Python version of 2.7/3.4+ or downgrade to Glances 2.6.2 (last version
-with Python 2.6 support).
-
-*Note for CentOS Linux 6 and 7 users*
-
-Python 2.7 and 3.4 are now available via SCL repositories. See:
-https://lists.centos.org/pipermail/centos-announce/2015-December/021555.html.
-
Installation
============
There are several methods to test/install Glances on your system. Choose your weapon!
-Glances Auto Install script: the total way
-------------------------------------------
-
-To install both dependencies and the latest Glances production ready version
-(aka *master* branch), just enter the following command line:
-
-.. code-block:: console
-
- curl -L https://bit.ly/glances | /bin/bash
-
-or
-
-.. code-block:: console
-
- wget -O- https://bit.ly/glances | /bin/bash
-
-*Note*: This is only supported on some GNU/Linux distributions and Mac OS X.
-If you want to support other distributions, please contribute to `glancesautoinstall`_.
-
PyPI: The simple way
--------------------
Glances is on ``PyPI``. By using PyPI, you will be using the latest
stable version.
-To install, simply use ``pip``:
+To install Glances, simply use ``pip``:
.. code-block:: console
- pip install glances
+ pip install --user glances
-*Note*: Python headers are required to install `psutil`_. For example,
-on Debian/Ubuntu you need to install first the *python-dev* package.
-For Fedora/CentOS/RHEL install first *python-devel* package. For Windows,
-just install psutil from the binary installation file.
+*Note*: Python headers are required to install `psutil`_, a Glances
+dependencie. For example, on Debian/Ubuntu you need to install first
+the *python-dev* package (*python-devel* on Fedora/CentOS/RHEL).
+For Windows, just install psutil from the binary installation file.
*Note 2 (for the Wifi plugin)*: If you want to use the Wifi plugin, you need
to install the *wireless-tools* package on your system.
@@ -150,14 +127,14 @@ features (like the Web interface, exports modules...):
.. code-block:: console
- pip install 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]'
+ pip install --user 'glances[action,browser,cloud,cpuinfo,docker,export,folders,gpu,graph,ip,raid,snmp,web,wifi]'
To upgrade Glances to the latest version:
.. code-block:: console
- pip install --upgrade glances
- pip install --upgrade glances[...]
+ pip install --user --upgrade glances
+ pip install --user --upgrade glances[...]
If you need to install Glances in a specific user location, use:
@@ -166,25 +143,50 @@ If you need to install Glances in a specific user location, use:
export PYTHONUSERBASE=~/mylocalpath
pip install --user glances
+If you are administrator and want to install Glances for all users:
+
+.. code-block:: console
+
+ sudo pip install glances
+
The current develop branch is also published to the test.pypi.org package index.
If you want to test the develop version, enter:
.. code-block:: console
- pip install -i https://test.pypi.org/simple/ Glances
+ pip install --user -i https://test.pypi.org/simple/ Glances
+
+
+Glances Auto Install script: the total way
+------------------------------------------
+
+To install both dependencies and the latest Glances production ready version
+(aka *master* branch), just enter the following command line:
+
+.. code-block:: console
+
+ curl -L https://bit.ly/glances | /bin/bash
+
+or
+
+.. code-block:: console
+
+ wget -O- https://bit.ly/glances | /bin/bash
+
+*Note*: This is only supported on some GNU/Linux distributions and Mac OS X.
+If you want to support other distributions, please contribute to `glancesautoinstall`_.
Docker: the funny way
---------------------
-A Glances container is available. It includes the latest development
-HEAD version. You can use it to monitor your server and all your other
-containers!
+Glances containers are availables. You can use it to monitor your
+server and all your other containers!
-Get the Glances container (latest develop branch):
+Get the Glances container:
.. code-block:: console
- docker pull nicolargo/glances:dev
+ docker pull nicolargo/glances:latest
Note, you can choose another branch with :
@@ -196,14 +198,14 @@ Run the container in *console mode*:
.. code-block:: console
- docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it nicolargo/glances:dev
+ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it nicolargo/glances:latest
Additionally, if you want to use your own glances.conf file, you can
create your own Dockerfile:
.. code-block:: console
- FROM nicolargo/glances:dev
+ FROM nicolargo/glances:latest
COPY glances.conf /glances/conf/glances.conf
CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT
@@ -212,7 +214,7 @@ docker run options:
.. code-block:: console
- docker run -v `pwd`/glances.conf:/glances/conf/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it nicolargo/glances:dev
+ docker run -v `pwd`/glances.conf:/glances/conf/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it nicolargo/glances:latest
Where \`pwd\`/glances.conf is a local directory containing your glances.conf file.
@@ -221,7 +223,7 @@ variable setting parameters for the glances startup command):
.. code-block:: console
- 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
+ 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
GNU/Linux
---------
@@ -231,7 +233,6 @@ able to install it using your favorite package manager. Be aware that
when you use this method the operating system `package`_ for `Glances`
may not be the latest version.
-
FreeBSD
-------
@@ -239,7 +240,7 @@ To install the binary package:
.. code-block:: console
- # pkg install py27-glances
+ # pkg install py37-glances
To install Glances from ports:
@@ -279,15 +280,6 @@ then run the following command:
$ pip install glances
-Alternatively, you could clone the repository and install with the following command.
-
-.. code-block:: console
-
- $ git clone https://github.com/nicolargo/glances.git
- $ cd glances
- $ python setup.py install
-
-
Android
-------
diff --git a/appveyor.yml b/appveyor.yml
index 6920d3f6..5b8be86a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -28,6 +28,10 @@ environment:
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "32"
+ - PYTHON: "C:\\Python39"
+ PYTHON_VERSION: "3.9.x"
+ PYTHON_ARCH: "32"
+
# 64 bits
- PYTHON: "C:\\Python27-x64"
@@ -62,6 +66,13 @@ environment:
VS_VER: "2015"
INSTANCENAME: "SQL2012SP1"
+ - PYTHON: "C:\\Python39-x64"
+ PYTHON_VERSION: "3.9.x"
+ PYTHON_ARCH: "64"
+ ARCH: x86_64
+ VS_VER: "2015"
+ INSTANCENAME: "SQL2012SP1"
+
# Also build on a Python version not pre-installed by Appveyor.
# See: https://github.com/ogrisel/python-appveyor-demo/issues/10
@@ -76,7 +87,7 @@ install:
- "powershell .ci\\appveyor\\install.ps1"
# - ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
- "%WITH_COMPILER% %PYTHON%/python.exe -m pip --version"
- - "%WITH_COMPILER% %PYTHON%/python.exe -m pip install --upgrade --user psutil bottle requests netifaces pystache py-cpuinfo scandir"
+ - "%WITH_COMPILER% %PYTHON%/python.exe -m pip install --upgrade --user psutil bottle requests netifaces chevron py-cpuinfo scandir"
- "%WITH_COMPILER% %PYTHON%/python.exe -m pip freeze"
- "%WITH_COMPILER% %PYTHON%/python.exe setup.py install"
diff --git a/conf/glances.conf b/conf/glances.conf
index 2df9783d..0ed47419 100644
--- a/conf/glances.conf
+++ b/conf/glances.conf
@@ -42,24 +42,38 @@ swap_critical=90
[cpu]
disable=False
+# See https://scoutapm.com/blog/slow_server_flow_chart
+#
+# I/O wait percentage should be lower than 1/# (# = Logical CPU cores)
+# Leave commented to just use the default config:
+# Careful=1/#*100-20% / Warning=1/#*100-10% / Critical=1/#*100
+#iowait_careful=30
+#iowait_warning=40
+#iowait_critical=50
+#
+# Total % is 100 - idle
+total_careful=65
+total_warning=75
+total_critical=85
+total_log=True
+#
# Default values if not defined: 50/70/90 (except for iowait)
user_careful=50
user_warning=70
user