summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Cieszkowski <bartlomiej.cieszkowski@gmail.com>2020-03-05 22:49:47 +0100
committerBartlomiej Cieszkowski <bartlomiej.cieszkowski@gmail.com>2020-03-05 22:49:47 +0100
commit5d5973abecd7e9db9a2b966e2f9b5c74e63bdf85 (patch)
tree274a59b179c0c5824e477a801dd7b3f4371b5fd4
parentf9c13723c8968d38839c597d4367c87b6082736d (diff)
parent547062750b28a9f03700d956535eb38a55571281 (diff)
Merge branch 'develop' into timezone_too_long
# Conflicts: # glances/plugins/glances_now.py
-rw-r--r--conf/glances-grafana.json8
-rw-r--r--conf/glances.conf6
-rw-r--r--docs/aoa/fs.rst9
-rw-r--r--docs/glances.rst7
-rw-r--r--docs/gw/elastic.rst4
-rw-r--r--docs/gw/influxdb.rst5
-rw-r--r--docs/gw/kafka.rst6
-rw-r--r--docs/man/glances.111
-rw-r--r--glances/README.txt9
-rw-r--r--glances/exports/glances_influxdb.py2
-rw-r--r--glances/exports/glances_kafka.py13
-rw-r--r--glances/main.py4
-rw-r--r--glances/outputs/glances_curses.py66
-rw-r--r--glances/plugins/glances_diskio.py6
-rw-r--r--glances/plugins/glances_fs.py15
-rw-r--r--glances/plugins/glances_gpu.py3
-rw-r--r--glances/plugins/glances_load.py8
-rw-r--r--glances/plugins/glances_network.py1
-rw-r--r--glances/plugins/glances_now.py1
-rw-r--r--glances/processes.py28
20 files changed, 138 insertions, 74 deletions
diff --git a/conf/glances-grafana.json b/conf/glances-grafana.json
index 0156140f..4d6cda5b 100644
--- a/conf/glances-grafana.json
+++ b/conf/glances-grafana.json
@@ -1243,7 +1243,7 @@
"measurement": "localhost.diskio",
"orderByTime": "ASC",
"policy": "default",
- "query": "SELECT mean(\"$disk.read_bytes\") FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
+ "query": "SELECT mean(\"$disk.read_bytes\")/mean(\"$disk.time_since_update\") FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
@@ -1286,7 +1286,7 @@
"measurement": "localhost.diskio",
"orderByTime": "ASC",
"policy": "default",
- "query": "SELECT mean(\"$disk.write_bytes\") FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
+ "query": "SELECT mean(\"$disk.write_bytes\")/mean(\"$disk.time_since_update\") FROM \"localhost.diskio\" WHERE $timeFilter GROUP BY time($__interval) fill(none)",
"rawQuery": true,
"refId": "B",
"resultFormat": "time_series",
@@ -1335,7 +1335,7 @@
"show": true
},
{
- "format": "short",
+ "format": "bytes",
"logBase": 1,
"max": null,
"min": null,
@@ -3183,4 +3183,4 @@
"title": "Glances",
"uid": "000000002",
"version": 10
-} \ No newline at end of file
+}
diff --git a/conf/glances.conf b/conf/glances.conf
index 5a177068..d5cf291e 100644
--- a/conf/glances.conf
+++ b/conf/glances.conf
@@ -170,7 +170,7 @@ disable=False
#hide=sda2,sda5,loop.*
hide=loop.*,/dev/loop*
# Alias for sda1
-#sda1_alias=IntDisk
+#sda1_alias=InternalDisk
[fs]
disable=False
@@ -488,6 +488,10 @@ host=localhost
port=9092
topic=glances
#compression=gzip
+# Tags will be added for all events
+#tags=foo:bar,spam:eggs
+# You can also use dynamic values
+#tags=hostname:`hostname -f`
[zeromq]
# Configuration for the --export zeromq option
diff --git a/docs/aoa/fs.rst b/docs/aoa/fs.rst
index 923c97f3..38c56097 100644
--- a/docs/aoa/fs.rst
+++ b/docs/aoa/fs.rst
@@ -37,10 +37,17 @@ system:
Also, you can hide mount points as well (in the following ``/boot``):
+
+.. code-block:: ini
+
+[fs]
+hide=/boot.*
+Filtering can also be done on device name (Glances 3.1.4 or higher):
+
.. code-block:: ini
[fs]
- hide=/boot.*
+ hide=/dev/sdb2
RAID
----
diff --git a/docs/glances.rst b/docs/glances.rst
index 336088ec..0d1bde4e 100644
--- a/docs/glances.rst
+++ b/docs/glances.rst
@@ -38,13 +38,12 @@ Monitor local machine (standalone mode):
$ glances
-Note: The standalone mode is not available on Microsoft Windows (c).
-Glances will start in Web server mode on this operating system.
-
-Monitor local machine with the web interface (Web UI):
+Monitor local machine with the web interface (Web UI), run the following command line:
$ glances -w
+and open a Web browser with the returned URL
+
Monitor local machine and export stats to a CSV file:
$ glances --export csv --export-csv-file /tmp/glances.csv
diff --git a/docs/gw/elastic.rst b/docs/gw/elastic.rst
index f0897f02..2c247fa8 100644
--- a/docs/gw/elastic.rst
+++ b/docs/gw/elastic.rst
@@ -2,6 +2,8 @@
Elasticsearch
=============
+.. note::
+ You need to install the `elasticsearch`_ library on your system.
You can export statistics to an ``Elasticsearch`` server. The connection
should be defined in the Glances configuration file as following:
@@ -36,3 +38,5 @@ get the CPU system stats:
"value": "2.2"
}
}
+
+.. _elasticsearch: https://pypi.org/project/elasticsearch/
diff --git a/docs/gw/influxdb.rst b/docs/gw/influxdb.rst
index a14f75c8..43db9df9 100644
--- a/docs/gw/influxdb.rst
+++ b/docs/gw/influxdb.rst
@@ -16,7 +16,10 @@ following:
user=root
password=root
db=glances
- tags=foo:bar,spam:eggs
+ # Tags will be added for all measurements
+ #tags=foo:bar,spam:eggs
+ # You can also use dynamic values
+ #tags=system:`uname -s`
and run Glances with:
diff --git a/docs/gw/kafka.rst b/docs/gw/kafka.rst
index 2bfe532a..6e3dedf3 100644
--- a/docs/gw/kafka.rst
+++ b/docs/gw/kafka.rst
@@ -14,6 +14,10 @@ following:
port=9092
topic=glances
#compression=gzip
+ # Tags will be added for all events
+ #tags=foo:bar,spam:eggs
+ # You can also use dynamic values
+ #tags=hostname:`hostname -f`
Note: you can enable the compression but it consume CPU on your host.
@@ -43,4 +47,4 @@ Python code example to consume Kafka Glances plugin:
consumer = KafkaConsumer('glances', value_deserializer=json.loads)
for s in consumer:
- print s
+ print(s)
diff --git a/docs/man/glances.1 b/docs/man/glances.1
index a7539c3c..9e52de68 100644
--- a/docs/man/glances.1
+++ b/docs/man/glances.1
@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
-.TH "GLANCES" "1" "Dec 26, 2019" "3.1.4_BETA" "Glances"
+.TH "GLANCES" "1" "Mar 03, 2020" "3.1.4_BETA" "Glances"
.SH NAME
glances \- An eye on your system
.
@@ -775,16 +775,15 @@ $ glances
.UNINDENT
.UNINDENT
.sp
-Note: The standalone mode is not available on Microsoft Windows (c).
-Glances will start in Web server mode on this operating system.
-.sp
-Monitor local machine with the web interface (Web UI):
+Monitor local machine with the web interface (Web UI), run the following command line:
.INDENT 0.0
.INDENT 3.5
$ glances \-w
.UNINDENT
.UNINDENT
.sp
+and open a Web browser with the returned URL
+.sp
Monitor local machine and export stats to a CSV file:
.INDENT 0.0
.INDENT 3.5
@@ -839,6 +838,6 @@ $ glances –browser
.sp
Nicolas Hennion aka Nicolargo <\fI\%contact@nicolargo.com\fP>
.SH COPYRIGHT
-2019, Nicolas Hennion
+2020, Nicolas Hennion
.\" Generated by docutils manpage writer.
.
diff --git a/glances/README.txt b/glances/README.txt
index f7ba0575..fdfb2f12 100644
--- a/glances/README.txt
+++ b/glances/README.txt
@@ -1,7 +1,7 @@
You are in the main Glances source folder. This page is **ONLY** for developers.
If you are looking for the user manual, please follow this link:
-https://github.com/nicolargo/glances/blob/master/docs/glances-doc.rst
+https://glances.readthedocs.io/en/stable/
===
@@ -42,6 +42,7 @@ outputs
...
exports
=> Glances export interfaces
+ glances_export.py "Father class" for exports
glances_csv.py The CSV export module
glances_influxdb.py The InfluxDB export module
glances_mqtt.py The MQTT export module
@@ -49,3 +50,9 @@ exports
glances_rabbitmq.py The RabbitMQ export module
glances_statsd.py The StatsD export module
...
+amps
+ => Glances Application Monitoring Processes (AMP)
+ glances_amp.py "Father class" for AMPs
+ glances_default.py Default AMP
+ glances_nginx.py Nginx AMP
+ ...
diff --git a/glances/exports/glances_influxdb.py b/glances/exports/glances_influxdb.py
index 91cfddf3..5df70832 100644
--- a/glances/exports/glances_influxdb.py
+++ b/glances/exports/glances_influxdb.py
@@ -130,7 +130,7 @@ class Export(GlancesExport):
logger.debug("Cannot export empty {} stats to InfluxDB".format(name))
else:
try:
- self.client.write_points(self._normalize(name, columns, points))
+ self.client.write_points(self._normalize(name, columns, points), time_precision="s")
except Exception as e:
# Log level set to debug instead of error (see: issue #1561)
logger.debug("Cannot export {} stats to InfluxDB ({})".format(name, e))
diff --git a/glances/exports/glances_kafka.py b/glances/exports/glances_kafka.py
index c328d7f6..f5a6127e 100644
--- a/glances/exports/glances_kafka.py
+++ b/glances/exports/glances_kafka.py
@@ -27,6 +27,7 @@ from glances.exports.glances_export import GlancesExport
from kafka import KafkaProducer
import json
+import codecs
class Export(GlancesExport):
@@ -42,11 +43,14 @@ class Export(GlancesExport):
# Optionals configuration keys
self.compression = None
+ self.tags = None
# Load the Kafka configuration file section
self.export_enable = self.load_conf('kafka',
- mandatories=['host', 'port', 'topic'],
- options=['compression'])
+ mandatories=['host', 'port',
+ 'topic'],
+ options=['compression',
+ 'tags'])
if not self.export_enable:
sys.exit(2)
@@ -79,13 +83,16 @@ class Export(GlancesExport):
# Create DB input
data = dict(zip(columns, points))
+ if self.tags is not None:
+ data.update(self.parse_tags(self.tags))
# Send stats to the kafka topic
# key=<plugin name>
# value=JSON dict
try:
self.client.send(self.topic,
- key=name,
+ # Kafka key name needs to be bytes #1593
+ key=name.encode('utf-8'),
value=data)
except Exception as e:
logger.error("Cannot export {} stats to Kafka ({})".format(name, e))
diff --git a/glances/main.py b/glances/main.py
index dad17e6f..a869e3cb 100644
--- a/glances/main.py
+++ b/glances/main.py
@@ -305,10 +305,6 @@ Examples of use:
if args.disable_autodiscover:
logger.info("Auto discover mode is disabled")
- # By default Windows is started in Web mode
- if WINDOWS:
- args.webserver = True
-
# In web server mode
if args.webserver:
args.process_short_name = True
diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py
index 782a1a32..ff07a642 100644
--- a/glances/outputs/glances_curses.py
+++ b/glances/outputs/glances_curses.py
@@ -31,14 +31,15 @@ from glances.processes import glances_processes
from glances.timer import Timer
# Import curses library for "normal" operating system
-if not WINDOWS:
- try:
- import curses
- import curses.panel
- from curses.textpad import Textbox
- except ImportError:
- logger.critical("Curses module not found. Glances cannot start in standalone mode.")
- sys.exit(1)
+try:
+ import curses
+ import curses.panel
+ from curses.textpad import Textbox
+except ImportError:
+ logger.critical("Curses module not found. Glances cannot start in standalone mode.")
+ if WINDOWS:
+ logger.critical("For Windows you can try installing windows-curses with pip install.")
+ sys.exit(1)
class _GlancesCurses(object):
@@ -479,7 +480,7 @@ class _GlancesCurses(object):
plugin_max_width = None
if p in self._left_sidebar:
plugin_max_width = max(self._left_sidebar_min_width,
- self.screen.getmaxyx()[1] - 105)
+ self.term_window.getmaxyx()[1] - 105)
plugin_max_width = min(self._left_sidebar_max_width,
plugin_max_width)
@@ -515,7 +516,7 @@ class _GlancesCurses(object):
# Adapt number of processes to the available space
max_processes_displayed = (
- self.screen.getmaxyx()[0] - 11 -
+ self.term_window.getmaxyx()[0] - 11 -
(0 if 'docker' not in __stat_display else
self.get_stats_display_height(__stat_display["docker"])) -
(0 if 'processcount' not in __stat_display else
@@ -618,7 +619,7 @@ class _GlancesCurses(object):
l_uptime += self.get_stats_display_width(stat_display[i])
self.display_plugin(
stat_display["system"],
- display_optional=(self.screen.getmaxyx()[1] >= l_uptime))
+ display_optional=(self.term_window.getmaxyx()[1] >= l_uptime))
self.space_between_column = 3
if 'ip' in stat_display:
self.new_column()
@@ -657,9 +658,9 @@ class _GlancesCurses(object):
if not self.args.disable_quicklook:
# Quick look is in the place !
if self.args.full_quicklook:
- quicklook_width = self.screen.getmaxyx()[1] - (stats_width + 8 + stats_number * self.space_between_column)
+ quicklook_width = self.term_window.getmaxyx()[1] - (stats_width + 8 + stats_number * self.space_between_column)
else:
- quicklook_width = min(self.screen.getmaxyx()[1] - (stats_width + 8 + stats_number * self.space_between_column),
+ quicklook_width = min(self.term_window.getmaxyx()[1] - (stats_width + 8 + stats_number * self.space_between_column),
self._quicklook_max_width - 5)
try:
stat_display["quicklook"] = stats.get_plugin(
@@ -679,14 +680,14 @@ class _GlancesCurses(object):
for p in self._top:
plugin_display_optional[p] = True
if stats_number > 1:
- self.space_between_column = max(1, int((self.screen.getmaxyx()[1] - stats_width) / (stats_number - 1)))
+ self.space_between_column = max(1, int((self.term_window.getmaxyx()[1] - stats_width) / (stats_number - 1)))
for p in ['mem', 'cpu']:
# No space ? Remove optional stats
if self.space_between_column < 3:
plugin_display_optional[p] = False
plugin_widths[p] = self.get_stats_display_width(stat_display[p], without_option=True) if hasattr(self.args, 'disable_' + p) else 0
stats_width = sum(itervalues(plugin_widths)) + 1
- self.space_between_column = max(1, int((self.screen.getmaxyx()[1] - stats_width) / (stats_number - 1)))
+ self.space_between_column = max(1, int((self.term_window.getmaxyx()[1] - stats_width) / (stats_number - 1)))
else:
self.space_between_column = 0
@@ -726,7 +727,7 @@ class _GlancesCurses(object):
docker + processcount + amps + processlist + alert
"""
# Do not display anything if space is not available...
- if self.screen.getmaxyx()[1] < self._left_sidebar_min_width:
+ if self.term_window.getmaxyx()[1] < self._left_sidebar_min_width:
return
# Restore line position
@@ -743,9 +744,9 @@ class _GlancesCurses(object):
self.new_line()
if p == 'processlist':
self.display_plugin(stat_display['processlist'],
- display_optional=(self.screen.getmaxyx()[1] > 102),
+ display_optional=(self.term_window.getmaxyx()[1] > 102),
display_additional=(not MACOS),
- max_y=(self.screen.getmaxyx()[0] - self.get_stats_display_height(stat_display['alert']) - 2))
+ max_y=(self.term_window.getmaxyx()[0] - self.get_stats_display_height(stat_display['alert']) - 2))
else:
self.display_plugin(stat_display[p])
@@ -779,8 +780,8 @@ class _GlancesCurses(object):
size_x += input_size
if size_y is None:
size_y = len(sentence_list) + 4
- screen_x = self.screen.getmaxyx()[1]
- screen_y = self.screen.getmaxyx()[0]
+ screen_x = self.term_window.getmaxyx()[1]
+ screen_y = self.term_window.getmaxyx()[0]
if size_x > screen_x or size_y > screen_y:
# No size to display the popup => abord
return False
@@ -797,7 +798,7 @@ class _GlancesCurses(object):
for y, m in enumerate(message.split('\n')):
popup.addnstr(2 + y, 2, m, len(m))
- if is_input and not WINDOWS:
+ if is_input:
# Create a subwindow for the text field
subpop = popup.derwin(1, input_size, 2, 2 + len(m))
subpop.attron(self.colors_list['FILTER'])
@@ -847,8 +848,8 @@ class _GlancesCurses(object):
return 0
# Get the screen size
- screen_x = self.screen.getmaxyx()[1]
- screen_y = self.screen.getmaxyx()[0]
+ screen_x = self.term_window.getmaxyx()[1]
+ screen_y = self.term_window.getmaxyx()[0]
# Set the upper/left position of the message
if plugin_stats['align'] == 'right':
@@ -1033,15 +1034,14 @@ class GlancesCursesClient(_GlancesCurses):
pass
-if not WINDOWS:
- class GlancesTextbox(Textbox, object):
+class GlancesTextbox(Textbox, object):
- def __init__(self, *args, **kwargs):
- super(GlancesTextbox, self).__init__(*args, **kwargs)
+ def __init__(self, *args, **kwargs):
+ super(GlancesTextbox, self).__init__(*args, **kwargs)
- def do_command(self, ch):
- if ch == 10: # Enter
- return 0
- if ch == 127: # Back
- return 8
- return super(GlancesTextbox, self).do_command(ch)
+ def do_command(self, ch):
+ if ch == 10: # Enter
+ return 0
+ if ch == 127: # Back
+ return 8
+ return super(GlancesTextbox, self).do_command(ch)
diff --git a/glances/plugins/glances_diskio.py b/glances/plugins/glances_diskio.py
index eb339d2d..52ddfebc 100644
--- a/glances/plugins/glances_diskio.py
+++ b/glances/plugins/glances_diskio.py
@@ -162,7 +162,7 @@ class Plugin(GlancesPlugin):
return ret
# Max size for the interface name
- name_max_width = max_width - 12
+ name_max_width = max_width - 13
# Header
msg = '{:{width}}'.format('DISK I/O', width=name_max_width)
@@ -188,9 +188,9 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_new_line())
if len(disk_name) > name_max_width:
# Cut disk name if it is too long
- disk_name = '_' + disk_name[-name_max_width:]
+ disk_name = '_' + disk_name[-name_max_width+1:]
msg = '{:{width}}'.format(nativestr(disk_name),
- width=name_max_width)
+ width=name_max_width+1)
ret.append(self.curse_add_line(msg))
if args.diskio_iops:
# count
diff --git a/glances/plugins/glances_fs.py b/glances/plugins/glances_fs.py
index 37a125d6..bc0a981d 100644
--- a/glances/plugins/glances_fs.py
+++ b/glances/plugins/glances_fs.py
@@ -114,7 +114,8 @@ class Plugin(GlancesPlugin):
# Loop over fs
for fs in fs_stat:
# Do not take hidden file system into account
- if self.is_hide(fs.mountpoint):
+ # Also check device name (see issue #1606)
+ if self.is_hide(fs.mountpoint) or self.is_hide(fs.device):
continue
# Grab the disk usage
try:
@@ -163,7 +164,11 @@ class Plugin(GlancesPlugin):
'used': used,
'percent': percent,
'key': self.get_key()}
- stats.append(fs_current)
+ # Do not take hidden file system into account
+ if self.is_hide(fs_current['mnt_point']):
+ continue
+ else:
+ stats.append(fs_current)
else:
# Default behavior
for fs in fs_stat:
@@ -174,7 +179,11 @@ class Plugin(GlancesPlugin):
'used': int(fs_stat[fs]['used']) * 1024,
'percent': float(fs_stat[fs]['percent']),
'key': self.get_key()}
- stats.append(fs_current)
+ # Do not take hidden file system into account
+ if self.is_hide(fs_current['mnt_point']) or self.is_hide(fs_current['device_name']):
+ continue
+ else:
+ stats.append(fs_current)
# Update the stats
self.stats = stats
diff --git a/glances/plugins/glances_gpu.py b/glances/plugins/glances_gpu.py
index cf588216..9fd1c292 100644
--- a/glances/plugins/glances_gpu.py
+++ b/glances/plugins/glances_gpu.py
@@ -292,7 +292,8 @@ def get_device_name(device_handle):
def get_mem(device_handle):
"""Get GPU device memory consumption in percent."""
try:
- return pynvml.nvmlDeviceGetUtilizationRates(device_handle).memory
+ memory_info = pynvml.nvmlDeviceGetMemoryInfo(device_handle)
+ return memory_info.used * 100.0 / memory_info.total
except pynvml.NVMLError:
return None
diff --git a/glances/plugins/glances_load.py b/glances/plugins/glances_load.py
index 891a7eb9..e3e2cc13 100644
--- a/glances/plugins/glances_load.py
+++ b/glances/plugins/glances_load.py
@@ -25,6 +25,7 @@ import psutil
from glances.compat import iteritems
from glances.plugins.glances_core import Plugin as CorePlugin
from glances.plugins.glances_plugin import GlancesPlugin
+from glances.logger import logger
# SNMP OID
# 1 minute Load: .1.3.6.1.4.1.2021.10.1.3.1
@@ -62,7 +63,8 @@ class Plugin(GlancesPlugin):
# Call CorePlugin in order to display the core number
try:
self.nb_log_core = CorePlugin(args=self.args).update()["log"]
- except Exception:
+ except Exception as e:
+ logger.debug('Error: Can not retrieve the CPU core number (set it to 1) ({})'.format(e))
self.nb_log_core = 1
def _getloadavg(self):
@@ -142,11 +144,11 @@ class Plugin(GlancesPlugin):
# Build the string message
# Header
- msg = '{:8}'.format('LOAD%' if (args.disable_irix and self.nb_log_core != 0) else 'LOAD')
+ msg = '{:6}'.format('LOAD%' if (args.disable_irix and self.nb_log_core != 0) else 'LOAD')
ret.append(self.curse_add_line(msg, "TITLE"))
# Core number
if 'cpucore' in self.stats and self.stats['cpucore'] > 0:
- msg = '{}-core'.format(int(self.stats['cpucore']))
+ msg = '{:3}-core'.format(int(self.stats['cpucore']))
ret.append(self.curse_add_line(msg))
# Loop over 1min, 5min and 15min load
for load_time in ['1', '5', '15']:
diff --git a/glances/plugins/glances_network.py b/glances/plugins/glances_network.py
index 90b41090..00fc88b0 100644
--- a/glances/plugins/glances_network.py
+++ b/glances/plugins/glances_network.py
@@ -26,6 +26,7 @@ import operator
from glances.timer import getTimeSinceLastUpdate
from glances.plugins.glances_plugin import GlancesPlugin
from glances.compat import n, u, b, nativestr
+from glances.logger import logger
import psutil
diff --git a/glances/plugins/glances_now.py b/glances/plugins/glances_now.py
index b1a3fc82..59f62af8 100644
--- a/glances/plugins/glances_now.py
+++ b/glances/plugins/glances_now.py
@@ -21,6 +21,7 @@
from time import tzname, localtime, strftime
+from glances.globals import WINDOWS
from glances.plugins.glances_plugin import GlancesPlugin
diff --git a/glances/processes.py b/glances/processes.py
index 29024bf5..f1291d59 100644
--- a/glances/processes.py
+++ b/glances/processes.py
@@ -64,6 +64,28 @@ class GlancesProcesses(object):
# Extended stats for top process is enable by default
self.disable_extended_tag = False
+ # Test if the system can grab io_counters
+ try:
+ p = psutil.Process()
+ p.io_counters()
+ except Exception as e:
+ logger.warning('PsUtil can not grab processes io_counters ({})'.format(e))
+ self.disable_io_counters = True
+ else:
+ logger.debug('PsUtil can grab processes io_counters')
+ self.disable_io_counters = False
+
+ # Test if the system can grab gids
+ try:
+ p = psutil.Process()
+ p.gids()
+ except Exception as e:
+ logger.warning('PsUtil can not grab processes gids ({})'.format(e))
+ self.disable_gids = True
+ else:
+ logger.debug('PsUtil can grab processes gids')
+ self.disable_gids = False
+
# Maximum number of processes showed in the UI (None if no limit)
self._max_processes = None
@@ -237,11 +259,9 @@ class GlancesProcesses(object):
standard_attrs = ['cmdline', 'cpu_percent', 'cpu_times', 'memory_info',
'memory_percent', 'name', 'nice', 'pid', 'ppid',
'status', 'username', 'status', 'num_threads']
- # io_counters availability: Linux, BSD, Windows, AIX
- if not MACOS and not SUNOS and not WSL:
+ if not self.disable_io_counters:
standard_attrs += ['io_counters']
- # gids availability: Unix
- if not WINDOWS:
+ if not self.disable_gids:
standard_attrs += ['gids']
# and build the processes stats list (psutil>=5.3.0)