Merge from develop

rich_migration
nicolargo 2022-04-17 10:32:45 +02:00
commit 22ea644778
16 changed files with 582 additions and 562 deletions

View File

@ -2,13 +2,42 @@
Glances changelog
==============================================================================
===============
Version 3.2.6
===============
Under development: see roadmap here https://github.com/nicolargo/glances/milestone/58
===============
Version 3.2.5
===============
Version under development, see roadmap here:
Enhancement requests:
https://github.com/nicolargo/glances/milestone/55
* Add a Accumulated per program function to the Glances process list needs test new feature plugin/ps #2015
* Including battery and AC adapter health in Glances enhancement new feature #1049
* Display uptime of a docker container enhancement plugin/docker #2004
* Add a code formatter enhancement #1964
Bugs corrected:
* Threading.Event.isSet is deprecated in Python 3.10 #2017
* Fix code scanning alert - Clear-text logging of sensitive information security #2006
* The gpu temperature unit are displayed incorrectly in web ui bug #2002
* Doc for 'alert' Restfull/JSON API response documentation #1994
* Show the spinning state of a disk documentation #1993
* Web server status check endpoint enhancement #1988
* --time parameter being ignored for client/server mode bug #1978
* Amp with pipe do not work documentation #1976
* glances_ip.py plugin relies on low rating / malicious site domain bug security #1975
* "N" command freezes/unfreezes the current time instead of show/hide bug #1974
* Missing commands in help "h" screen enhancement needs contributor #1973
* Grafana dashboards not displayed with influxdb2 enhancement needs contributor #1960
* Glances reports different amounts of used memory than free -m or top documentation #1924
* Missing: Help command doesn't have info on TCP Connections bug documentation enhancement needs contributor #1675
* Docstring convention documentation enhancement #940
Thanks for the bug report and the patch: @RazCrimson, @Karthikeyan Singaravelan, @Moldavite, @ledwards
===============
Version 3.2.4.1

View File

@ -54,6 +54,15 @@ Glances is written in Python and uses libraries to grab information from
your system. It is based on an open architecture where developers can
add new plugins or exports modules.
Social networks
===============
.. image:: https://raw.githubusercontent.com/nicolargo/glances/develop/docs/_static/twitter-icon.png
:target: https://twitter.com/nicolargo
.. image:: https://raw.githubusercontent.com/nicolargo/glances/develop/docs/_static/reddit.png
:target: https://www.reddit.com/r/glances/
Requirements
============

BIN
docs/_static/reddit.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
docs/_static/twitter-icon.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -50,7 +50,7 @@ less than countmin):
.. image:: ../_static/amp-python-warning.png
If the regex option is not defined, the AMP will be executed every refresh
time and the process count will not be displayed (countmin and countmax will
time and the process count will not be displayed (countmin and countmax will
be ignored).
For example:
@ -63,6 +63,26 @@ For example:
one_line=false
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
script with your command:
.. code-block:: ini
$ cat /usr/local/bin/mycommand.sh
#!/bin/sh
ps -aux | wc -l
and use it in the amps:
.. code-block:: ini
[amp_amptest]
enable=true
regex=.*
refresh=15
one_line=false
command=/usr/local/bin/mycommand.sh
User defined AMP
----------------

View File

@ -11,6 +11,18 @@ Additionally, on GNU/Linux, it also shows the kernel version.
In client mode, the server connection status is also displayed.
It is possible to disable or define time interval to be used for refreshing the
public IP address (default is 300 seconds) from the configuration
file under the ``[ip]`` section:
.. code-block:: ini
[ip]
public_refresh_interval=240
public_ip_disabled=True
**NOTE:** Setting low values for `public_refresh_interval` will result in frequent
HTTP requests to the IP detection servers. Recommended range: 120-600 seconds
**Connected**:
.. image:: ../_static/connected.png

View File

@ -18,6 +18,8 @@ Stats description:
- **total**: total physical memory available.
- **used**: memory used, calculated differently depending on the platform and
designed for informational purposes only.
It's compute as following:
used memory = total - free (with free = available + buffers + cached)
- **free**: memory not being used at all (zeroed) that is readily available;
note that this doesnt reflect the actual memory available (use available
instead).

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "GLANCES" "1" "Mar 13, 2022" "3.2.5_beta01" "Glances"
.TH "GLANCES" "1" "Apr 10, 2022" "3.2.5" "Glances"
.SH NAME
glances \- An eye on your system
.

View File

@ -29,7 +29,7 @@ import sys
# Global name
# Version should start and end with a numerical char
# See https://packaging.python.org/specifications/core-metadata/#version
__version__ = '3.2.5_beta01'
__version__ = '3.2.6_beta01'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPLv3'
@ -68,6 +68,7 @@ if psutil_version_info < psutil_min_version:
import tracemalloc
def __signal_handler(signal, frame):
"""Callback for CTRL-C."""
end()

View File

@ -2091,9 +2091,9 @@
}
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==",
"dev": true
},
"minimist-options": {

View File

@ -51,7 +51,6 @@ class GlancesPasswordList(GlancesPassword):
# Password list loaded
logger.info("%s password(s) loaded from the configuration file" % len(password_dict))
logger.debug("Password dictionary: %s" % password_dict)
return password_dict

View File

@ -83,6 +83,7 @@ class PluginModel(GlancesPluginModel):
self.view_data['show_hide_filesystem'] = msg_col.format('f', 'Show/hide filesystem stats')
self.view_data['view_cumulative_network'] = msg_col2.format('U', 'View cumulative network I/O')
self.view_data['show_hide_network'] = msg_col.format('n', 'Show/hide network stats')
self.view_data['show_hide_time'] = msg_col.format('N', 'Show/hide current time')
self.view_data['show_hide_filesytem_freespace'] = msg_col2.format('F', 'Show filesystem free space')
self.view_data['show_hide_sensors'] = msg_col.format('s', 'Show/hide sensors stats')
self.view_data['generate_graphs'] = msg_col2.format('g', 'Generate graphs for current history')

View File

@ -56,6 +56,9 @@ class PluginModel(GlancesPluginModel):
stats is a dict
"""
_default_public_refresh_interval = 300
_default_public_ip_disabled = ["False"]
def __init__(self, args=None, config=None):
"""Init the plugin."""
super(PluginModel, self).__init__(args=args, config=config)
@ -63,9 +66,14 @@ class PluginModel(GlancesPluginModel):
# We want to display the stat in the curse interface
self.display_curse = True
# Get the public IP address once (not for each refresh)
if not import_error_tag:
self.public_address = PublicIpAddress().get()
# For public IP address
self.public_address = ""
self.public_address_refresh_interval = self.get_conf_value(
"public_refresh_interval", default=self._default_public_refresh_interval
)
public_ip_disabled = self.get_conf_value("public_ip_disabled", default=self._default_public_ip_disabled)
self.public_ip_disabled = True if public_ip_disabled == ["True"] else False
@GlancesPluginModel._check_decorator
@GlancesPluginModel._log_result_decorator
@ -83,15 +91,26 @@ class PluginModel(GlancesPluginModel):
default_gw = netifaces.gateways()['default'][netifaces.AF_INET]
except (KeyError, AttributeError) as e:
logger.debug("Cannot grab the default gateway ({})".format(e))
return {}
try:
address = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['addr']
mask = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['netmask']
time_since_update = getTimeSinceLastUpdate('public-ip')
if not self.public_ip_disabled and (
self.stats.get('address') != address or time_since_update > self.public_address_refresh_interval
):
self.public_address = PublicIpAddress().get()
except (KeyError, AttributeError) as e:
logger.debug("Cannot grab IP information: {}".format(e))
else:
try:
stats['address'] = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['addr']
stats['mask'] = netifaces.ifaddresses(default_gw[1])[netifaces.AF_INET][0]['netmask']
stats['mask_cidr'] = self.ip_to_cidr(stats['mask'])
stats['gateway'] = netifaces.gateways()['default'][netifaces.AF_INET][0]
stats['public_address'] = self.public_address
except (KeyError, AttributeError) as e:
logger.debug("Cannot grab IP information: {}".format(e))
stats['address'] = address
stats['mask'] = mask
stats['mask_cidr'] = self.ip_to_cidr(stats['mask'])
stats['gateway'] = default_gw[0]
stats['public_address'] = self.public_address
elif self.input_method == 'snmp':
# Not implemented yet
pass
@ -138,7 +157,7 @@ class PluginModel(GlancesPluginModel):
# Add KeyError exception (see https://github.com/nicolargo/glances/issues/1469)
pass
else:
if self.stats['public_address'] is not None:
if self.stats['public_address']:
msg = ' Pub '
ret.append(self.curse_add_line(msg, 'TITLE'))
ret.append(self.curse_add_line(msg_pub))

View File

@ -69,6 +69,9 @@ class PluginModel(GlancesPluginModel):
# Init the return message
ret = []
if not self.stats or self.is_disabled():
return ret
# Build the string message
# 23 is the padding for the process list
msg = '{:23}'.format(self.stats)

View File

@ -425,6 +425,10 @@ class GlancesPluginModel(object):
"""Return the stats object in JSON format."""
return self._json_dumps(self.stats)
def get_json(self):
"""Return the stats object in JSON format."""
return self.get_stats()
def get_stats_item(self, item):
"""Return the stats object for a specific item in JSON format.