summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2022-07-26 10:37:44 +0200
committernicolargo <nicolas@nicolargo.com>2022-07-26 10:37:44 +0200
commitdfe0f642ea0a890d65c3078ee7c17621b6c6f7d5 (patch)
tree763e2b2b105392892499093adf5fef1962c0b21c
parent708046476607f4b89bb7bd11703ec60bbc6c1206 (diff)
parentca0aaed56c9e99bc4c9482d5de56e042f0f79ad2 (diff)
Resolv first conflict
-rw-r--r--.github/workflows/test.yml12
-rw-r--r--Makefile1
-rw-r--r--README.rst12
-rw-r--r--conf/glances.conf3
-rw-r--r--dev-requirements.txt3
-rw-r--r--docker-compose/docker-compose.yml4
-rw-r--r--docs/api.rst825
-rw-r--r--docs/cmds.rst8
-rw-r--r--docs/gw/prometheus.rst8
-rw-r--r--docs/man/glances.110
-rw-r--r--glances/exports/elasticsearch/__init__.py18
-rw-r--r--glances/exports/glances_influxdb/__init__.py2
-rw-r--r--glances/exports/graphite/__init__.py1
-rw-r--r--glances/exports/influxdb2/__init__.py2
-rw-r--r--glances/exports/kafka/__init__.py2
-rw-r--r--glances/exports/mqtt/__init__.py8
-rw-r--r--glances/exports/opentsdb/__init__.py2
-rw-r--r--glances/exports/prometheus/__init__.py2
-rw-r--r--glances/exports/rabbitmq/__init__.py6
-rw-r--r--glances/exports/restful/__init__.py2
-rw-r--r--glances/exports/riemann/__init__.py2
-rw-r--r--glances/exports/statsd/__init__.py2
-rw-r--r--glances/exports/zeromq/__init__.py2
-rw-r--r--glances/main.py24
-rw-r--r--glances/outputs/glances_curses.py33
-rw-r--r--glances/outputs/static/js/components/help/view.html12
-rw-r--r--glances/outputs/static/js/components/plugin-diskio/view.html10
-rw-r--r--glances/outputs/static/js/components/plugin-fs/controller.js4
-rw-r--r--glances/outputs/static/js/components/plugin-fs/view.html4
-rw-r--r--glances/outputs/static/public/glances.js10
-rw-r--r--glances/outputs/static/public/glances.map.js2
-rw-r--r--glances/plugins/diskio/model.py5
-rw-r--r--glances/plugins/help/model.py7
-rw-r--r--glances/plugins/plugin/model.py14
-rw-r--r--glances/plugins/sensors/model.py36
-rw-r--r--glances/plugins/uptime/model.py11
-rw-r--r--glances/processes.py24
-rw-r--r--glances/stats.py11
38 files changed, 638 insertions, 506 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 92cc9269..c1e6c46e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -34,6 +34,18 @@ jobs:
# 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: Static type check
+ run: |
+ if [ "${{ matrix.python-version }}" == "2.7" ];
+ then
+ echo "Skipping static type check for Python 2.7";
+ else
+ echo "Skipping static type check for the moment, too much error...";
+ # pip install pyright
+ # pyright glances
+ fi
+
- name: Unitary tests
run: |
python ./unitest.py
diff --git a/Makefile b/Makefile
index 8dd5e8a9..78fb38da 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,7 @@ test: venv ## Run unit tests
./venv/bin/python ./unitest-restful.py
./venv/bin/python ./unitest-xmlrpc.py
./venv/bin/python -m black ./glances --check --exclude outputs/static
+ ./venv/bin/pyright glances
format: venv ## Format the code
./venv/bin/python -m black ./glances --exclude outputs/static
diff --git a/README.rst b/README.rst
index 6f33ffe7..6631013c 100644
--- a/README.rst
+++ b/README.rst
@@ -223,16 +223,16 @@ create your own Dockerfile:
CMD python -m glances -C /etc/glances.conf $GLANCES_OPT
Alternatively, you can specify something along the same lines with
-docker run options:
+docker run options (notice the `GLANCES_OPT` environment
+variable setting parameters for the glances startup command):
.. code-block:: console
- docker run -v `pwd`/glances.conf:/etc/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -it nicolargo/glances:latest-full
+ docker run -v `pwd`/glances.conf:/etc/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host -e GLANCES_OPT="-C /etc/glances.conf" -it nicolargo/glances:latest-full
Where \`pwd\`/glances.conf is a local directory containing your glances.conf file.
-Run the container in *Web server mode* (notice the `GLANCES_OPT` environment
-variable setting parameters for the glances startup command):
+Run the container in *Web server mode*:
.. code-block:: console
@@ -446,9 +446,9 @@ There is also a chat dedicated to the Glances developers:
Donation
========
-If this project help you, you can give me a tip ;)
+If you like this open-source project, you can become a sponsor.
-See the sponsors_ page.
+See the sponsors_ page (one-time or monthly tier available).
Author
======
diff --git a/conf/glances.conf b/conf/glances.conf
index 1d9ce3e0..09cb5c68 100644
--- a/conf/glances.conf
+++ b/conf/glances.conf
@@ -524,6 +524,7 @@ port=8125
# Configuration for the --export elasticsearch option
# Data are available via the ES RESTful API. ex: URL/<index>/cpu
# https://www.elastic.co
+scheme=http
host=localhost
port=9200
index=glances
@@ -547,7 +548,7 @@ queue=glances_queue
# Configuration for the --export mqtt option
host=localhost
port=8883
-tls=true
+tls=false
user=guest
password=guest
topic=glances
diff --git a/dev-requirements.txt b/dev-requirements.txt
index a0e534a7..07b20e3e 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,2 +1,3 @@
py-spy
-black \ No newline at end of file
+black
+pyright \ No newline at end of file
diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml
index de5efee7..522a8b09 100644
--- a/docker-compose/docker-compose.yml
+++ b/docker-compose/docker-compose.yml
@@ -7,10 +7,8 @@ services:
restart: always
ports:
- "61208:61208"
- # - "61209:61209"
environment:
- # - GLANCES_OPT="-w"
- GLANCES_OPT: "-w"
+ GLANCES_OPT: "-C /glances/conf/glances.conf -w"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./glances.conf:/glances/conf/glances.conf"
diff --git a/docs/api.rst b/docs/api.rst
index 3316e6c6..5f2a32c7 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -74,7 +74,7 @@ Get plugin stats::
"refresh": 3.0,
"regex": True,
"result": None,
- "timer": 0.8607451915740967},
+ "timer": 0.8538804054260254},
{"count": 0,
"countmax": 20.0,
"countmin": None,
@@ -83,7 +83,7 @@ Get plugin stats::
"refresh": 3.0,
"regex": True,
"result": None,
- "timer": 0.8606467247009277}]
+ "timer": 0.8537874221801758}]
Get a specific field::
@@ -101,7 +101,7 @@ Get a specific item when field matchs the given value::
"refresh": 3.0,
"regex": True,
"result": None,
- "timer": 0.8607451915740967}]}
+ "timer": 0.8538804054260254}]}
GET core
--------
@@ -131,7 +131,7 @@ Get plugin stats::
"ctx_switches": 0,
"guest": 0.0,
"guest_nice": 0.0,
- "idle": 70.0,
+ "idle": 73.3,
"interrupts": 0,
"iowait": 0.0,
"irq": 0.0,
@@ -140,10 +140,10 @@ Get plugin stats::
"softirq": 0.0,
"steal": 0.0,
"syscalls": 0,
- "system": 5.1,
+ "system": 3.0,
"time_since_update": 1,
- "total": 28.8,
- "user": 24.8}
+ "total": 27.2,
+ "user": 23.7}
Fields descriptions:
@@ -165,7 +165,7 @@ Fields descriptions:
Get a specific field::
# curl http://localhost:61208/api/3/cpu/total
- {"total": 28.8}
+ {"total": 27.2}
GET diskio
----------
@@ -211,13 +211,13 @@ Get plugin stats::
# curl http://localhost:61208/api/3/fs
[{"device_name": "/dev/mapper/ubuntu--gnome--vg-root",
- "free": 111673323520,
+ "free": 110062321664,
"fs_type": "ext4",
"key": "mnt_point",
"mnt_point": "/",
- "percent": 51.7,
+ "percent": 52.4,
"size": 243396149248,
- "used": 119335370752}]
+ "used": 120946372608}]
Get a specific field::
@@ -228,13 +228,13 @@ Get a specific item when field matchs the given value::
# curl http://localhost:61208/api/3/fs/mnt_point//
{"/": [{"device_name": "/dev/mapper/ubuntu--gnome--vg-root",
- "free": 111673323520,
+ "free": 110062321664,
"fs_type": "ext4",
"key": "mnt_point",
"mnt_point": "/",
- "percent": 51.7,
+ "percent": 52.4,
"size": 243396149248,
- "used": 119335370752}]}
+ "used": 120946372608}]}
GET ip
------
@@ -242,16 +242,16 @@ GET ip
Get plugin stats::
# curl http://localhost:61208/api/3/ip
- {"address": "192.168.236.139",
- "gateway": "192.168.236.115",
+ {"address": "192.168.0.48",
+ "gateway": "192.168.0.254",
"mask": "255.255.255.0",
"mask_cidr": 24,
- "public_address": "92.184.102.125"}
+ "public_address": "82.66.169.82"}
Get a specific field::
# curl http://localhost:61208/api/3/ip/address
- {"address": "192.168.236.139"}
+ {"address": "192.168.0.48"}
GET load
--------
@@ -259,10 +259,7 @@ GET load
Get plugin stats::
# curl http://localhost:61208/api/3/load
- {"cpucore": 4,
- "min1": 1.7197265625,
- "min15": 1.78662109375,
- "min5": 2.0615234375}
+ {"cpucore": 4, "min1": 1.40771484375, "min15": 1.4169921875, "min5": 1.484375}
Fields descriptions:
@@ -274,7 +271,7 @@ Fields descriptions:
Get a specific field::
# curl http://localhost:61208/api/3/load/min1
- {"min1": 1.7197265625}
+ {"min1": 1.40771484375}
GET mem
-------
@@ -282,16 +279,16 @@ GET mem
Get plugin stats::
# curl http://localhost:61208/api/3/mem
- {"active": 2873008128,
- "available": 2645495808,
- "buffers": 297783296,
- "cached": 3003232256,
- "free": 2645495808,
- "inactive": 3569516544,
- "percent": 66.2,
- "shared": 569716736,
- "total": 7837949952,
- "used": 5192454144}
+ {"active": 2461896704,
+ "available": 3079487488,
+ "buffers": 486854656,
+ "cached": 3247910912,
+ "free": 3079487488,
+ "inactive": 4266680320,
+ "percent": 60.7,
+ "shared": 539095040,
+ "total": 7837974528,
+ "used": 4758487040}
Fields descriptions:
@@ -310,7 +307,7 @@ Fields descriptions:
Get a specific field::
# curl http://localhost:61208/api/3/mem/total
- {"total": 7837949952}
+ {"total": 7837974528}
GET memswap
-----------
@@ -318,13 +315,13 @@ GET memswap
Get plugin stats::
# curl http://localhost:61208/api/3/memswap
- {"free": 6768394240,
- "percent": 16.3,
- "sin": 1020620800,
- "sout": 4096729088,
+ {"free": 7600726016,
+ "percent": 6.0,
+ "sin": 48836608,
+ "sout": 519880704,
"time_since_update": 1,
"total": 8082419712,
- "used": 1314025472}
+ "used": 481693696}
Fields descriptions:
@@ -348,29 +345,29 @@ Get plugin stats::
# curl http://localhost:61208/api/3/network
[{"alias": None,
- "cumulative_cx": 564727594,
- "cumulative_rx": 282363797,
- "cumulative_tx": 282363797,
- "cx": 2748,
+ "cumulative_cx": 47984606,
+ "cumulative_rx": 23992303,
+ "cumulative_tx": 23992303,
+ "cx": 2492,
"interface_name": "lo",
"is_up": True,
"key": "interface_name",
- "rx": 1374,
+ "rx": 1246,
"speed": 0,
"time_since_update": 1,
- "tx": 1374},
+ "tx": 1246},
{"alias": None,
- "cumulative_cx": 21192206162,
- "cumulative_rx": 20379290300,
- "cumulative_tx": 812915862,
- "cx": 27493,
+ "cumulative_cx": 1734453000,
+ "cumulative_rx": 1610954683,
+ "cumulative_tx": 123498317,
+ "cx": 31305,
"interface_name": "wlp2s0",
"is_up": True,
"key": "interface_name",
- "rx": 20584,
+ "rx": 25086,
"speed": 0,
"time_since_update": 1,
- "tx": 6909}]
+ "tx": 6219}]
Fields descriptions:
@@ -389,27 +386,27 @@ Get a specific field::
# curl http://localhost:61208/api/3/network/interface_name
{"interface_name": ["lo",
"wlp2s0",
- "br-87386b77b676",
- "br_grafana",
"br-119e6ee04e05",
"docker0",
+ "br-87386b77b676",
+ "br_grafana",
"mpqemubr0"]}
Get a specific item when field matchs the given value::
# curl http://localhost:61208/api/3/network/interface_name/lo
{"lo": [{"alias": None,
- "cumulative_cx": 564727594,
- "cumulative_rx": 282363797,
- "cumulative_tx": 282363797,
- "cx": 2748,
+ "cumulative_cx": 47984606,
+ "cumulative_rx": 23992303,
+ "cumulative_tx": 23992303,
+ "cx": 2492,
"interface_name": "lo",
"is_up": True,
"key": "interface_name",
- "rx": 1374,
+ "rx": 1246,
"speed": 0,
"time_since_update": 1,
- "tx": 1374}]}
+ "tx": 1246}]}
GET now
-------
@@ -417,7 +414,7 @@ GET now
Get plugin stats::
# curl http://localhost:61208/api/3/now
- "2022-07-05 10:35:41 CEST"
+ "2022-07-24 10:33:51 CEST"
GET percpu
----------
@@ -428,29 +425,29 @@ Get plugin stats::
[{"cpu_number": 0,
"guest": 0.0,
"guest_nice": 0.0,
- "idle": 73.0,
+ "idle": 90.0,
"iowait": 0.0,
"irq": 0.0,
"key": "cpu_number",
"nice": 0.0,
- "softirq": 0.0,
+ "softirq": 1.0,
"steal": 0.0,
- "system": 3.0,
- "total": 27.0,
- "user": 20.0},
+ "system": 0.0,
+ "total": 10.0,
+ "user": 4.0},
{"cpu_number": 1,
"guest": 0.0,
"guest_nice": 0.0,
- "idle": 20.0,
+ "idle": 90.0,
"iowait": 0.0,
"irq": 0.0,
"key": "cpu_number",
"nice": 0.0,
- "softirq": 0.0,
+ "softirq": 1.0,
"steal": 0.0,
"system": 3.0,
- "total": 80.0,
- "user": 75.0}]
+ "total": 10.0,
+ "user": 3.0}]
Get a specific field::
@@ -464,30 +461,30 @@ Get plugin stats::
# curl http://localhost:61208/api/3/ports
[{"description": "DefaultGateway",
- "host": "192.168.236.115",
+ "host": "192.168.0.254",
"indice": "port_0",
"port": 0,
"refresh": 30,
"rtt_warning": None,
- "status": 0.005442,
+ "status": 0.003645,
"timeout": 3}]
Get a specific field::
# curl http://localhost:61208/api/3/ports/host
- {"host": ["192.168.236.115"]}
+ {"host": ["192.168.0.254"]}
Get a specific item when field matchs the given value::
- # curl http://localhost:61208/api/3/ports/host/192.168.236.115
- {"192.168.236.115": [{"description": "DefaultGateway",
- "host": "192.168.236.115",
- "indice": "port_0",
- "port": 0,
- "refresh": 30,
- "rtt_warning": None,
- "status": 0.005442,
- "timeout": 3}]}
+ # curl http://localhost:61208/api/3/ports/host/192.168.0.254
+ {"192.168.0.254": [{"description": "DefaultGateway",
+ "host": "192.168.0.254",
+ "indice": "port_0",
+ "port": 0,
+ "refresh": 30,
+ "rtt_warning": None,
+ "status": 0.003645,
+ "timeout": 3}]}
GET processcount
----------------
@@ -495,12 +492,12 @@ GET processcount
Get plugin stats::
# curl http://localhost:61208/api/3/processcount
- {"pid_max": 0, "running": 2, "sleeping": 243, "thread": 1348, "total": 317}
+ {"pid_max": 0, "running": 1, "sleeping": 233, "thread": 1256, "total": 299}
Get a specific field::
# curl http://localhost:61208/api/3/processcount/total
- {"total": 317}
+ {"total": 299}
GET processlist
---------------
@@ -510,48 +507,48 @@ Get plugin stats::
# curl http://localhost:61208/api/3/processlist
[{"cmdline": ["/snap/firefox/1443/usr/lib/firefox/firefox"],
"cpu_percent": 0.0,
- "cpu_times": pcputimes(user=3601.37, system=1368.64, children_user=3363.17, children_system=618.54, iowait=0.0),
+ "cpu_times": pcputimes(user=2687.47, system=1037.45, children_user=2125.3, children_system=344.64, iowait=0.0),
"gids": pgids(real=1000, effective=1000, saved=1000),
- "io_counters": [1154282496, 4287729664, 0, 0, 0],
+ "io_counters": [982852608, 2811539456, 0, 0, 0],
"key": "pid",
- "memory_info": pmem(rss=485158912, vms=13364842496, shared=154886144, text=741376, lib=0, data=1287581696, dirty=0),
- "memory_percent": 6.1898699911473996,
+ "memory_info": pmem(rss=521953280, vms=13237006336, shared=174477312, text=741376, lib=0, data=1154760704, dirty=0),
+ "memory_percent": 6.659287780732119,
"name": "firefox",
"nice": 0,
- "num_threads": 159,
- "pid": 398305,
+ "num_threads": 164,
+ "pid": 4236,
"status": "S",
"time_since_update": 1,
"username": "nicolargo"},
{"cmdline": ["/snap/firefox/1443/usr/lib/firefox/firefox",
"-contentproc",
"-childID",
- "1",
+ "3",
"-isForBrowser",
"-prefsLen",
- "7823",
+ "13098",
"-prefMapSize",
- "255124",
+ "255747",
"-jsInitLen",
"277128",
"-parentBuildID",
"20220609070438",
"-appDir",
"/snap/firefox/1443/usr/lib/firefox/browser",
- "398305",
+ "4236",
"true",
"tab"],
"cpu_percent": 0.0,
- "cpu_times": pcputimes(user=477.73, system=97.79, children_user=0.0, children_system=0.0, iowait=0.0),
+ "cpu_times": pcputimes(user=421.23, system=83.44, children_user=0.0, children_system=0.0, iowait=0.0),
"gids": pgids(real=1000, effective=1000, saved=1000),
- "io_counters": [13744128, 0, 0, 0, 0],
+ "io_counters": [11130880, 0, 0, 0, 0],
"key": "pid",
- "memory_info": pmem(rss=425275392, vms=3373973504, shared=86298624, text=741376, lib=0, data=796299264, dirty=0),
- "memory_percent": 5.425849802619409,
+ "memory_info": pmem(rss=459653120, vms=3240546304, shared=89395200, text=741376, lib=0, data=649822208, dirty=0),
+ "memory_percent": 5.864437532400207,
"name": "WebExtensions",
"nice": 0,
"num_threads": 20,
- "pid": 398638,
+ "pid": 5262,
"status": "S",
"time_since_update": 1,
"username": "nicolargo"}]
@@ -559,192 +556,180 @@ Get plugin stats::
Get a specific field::
# curl http://localhost:61208/api/3/processlist/pid
- {"pid": [398305,
- 398638,
- 445580,
- 398694,
- 2788,
- 445619,
- 445874,
- 401135,
- 497945,
- 491472,
- 491243,
- 495124,
- 494960,
- 445516,
- 445618,
- 398661,
- 495123,
- 495201,
- 516874,
- 495151,
- 501199,
- 517695,
- 400862,
- 7518,
- 518245,
- 517969,
- 518405,
- 445551,
- 1754,
- 2699,
- 518434,
- 492651,
- 3303,
- 445644,
- 3151,
- 509962,
- 445851,
- 445560,
- 374164,
- 402027,
- 340,
- 380430,
- 398554,
- 3100,
- 99748,
- 2890,
- 445521,
- 2657,
- 2347,
- 1924,
- 445520,
- 5908,
- 380217,
- 99747,
- 489344,
- 2971,
- 2964,
- 2867,
- 2970,
- 374835,
- 3310,
- 1360,
- 3071,
- 2983,
- 489356,
- 2969,
- 2899,
+ {"pid": [4236,
+ 5262,
+ 9730,
+ 9861,
+ 4450,
+ 9695,
+ 3561,
+ 42242,
+ 52578,
+ 75296,
+ 50530,
+ 73809,
+ 76244,
+ 4417,
+ 9729,
+ 9628,
+ 5492,
+ 4088,
+ 76136,
+ 76002,
+ 76285,
+ 9663,
+ 1980,
+ 2040,
+ 76402,
+ 9796,
+ 3457,
+ 2243,
+ 9761,
+ 3870,
+ 9955,
+ 41978,
+ 3680,
+ 73036,
+ 4095,
+ 5779,
+ 1284,
+ 41980,
+ 3962,
+ 1450,
+ 4391,
+ 3651,
+ 3370,
+ 1433,
+ 9682,
+ 3768,
+ 3844,
+ 3690,
+ 3759,
+ 3766,
+ 4465,
+ 347,
+ 5870,
+ 58878,
+ 4126,
+ 50975,
+ 1246,
+ 1264,
+ 3782,
+ 58882,
+ 3765,
+ 3607,
+ 1784,
+ 3643,
+ 9632,
+ 3538,
+ 3033,
1,
- 1562,
- 2858,
- 1190,
- 3335,
- 1851,
- 3134,
- 2756,
- 2814,
- 2743,
- 1712,
- 1189,
- 1218,
- 489382,
- 1351,
- 2517,
- 1897,
- 374526,
- 988,
- 2965,
- 62819,
- 2627,
- 2876,
- 2979,
- 3008,
- 2771,
- 2972,
- 3044,
- 99618,
- 1215,
- 2700,
- 2982,
- 1358,
- 2909,
- 99600,
- 2824,
- 22451,
- 1173,
- 2808,
- 3143,
- 2804,
- 2956,
- 2662,
- 2980,
- 3136,
- 2978,
- 2668,
- 1210,
- 1179,
- 2963,
- 2973,
- 3094,
- 1305,
- 2837,
- 1544,
- 2665,
- 2799,
- 1890,
- 1205,
- 3051,
- 6457,
- 1195,
- 2967,
- 7540,
- 2785,
- 2856,
- 1201,
- 989,
- 1891,
- 375,
- 2745,
- 1168,
- 445715,
- 2653,
- 2873,
- 2695,
- 3042,
- 2656,
- 7784,
- 3064,
- 1198,
- 1182,
- 445523,
- 2797,
- 2350,
- 510174,
- 99787,
- 1164,
- 2674,
- 986,
- 1221,
- 1172,
-