mirror of https://github.com/nicolargo/glances
Update doc / Finalyse for Python 2 but do not work for Python 3
parent
67fab37daf
commit
3f1b1356a5
1
NEWS
1
NEWS
|
@ -13,6 +13,7 @@ Enhancements and new features:
|
|||
* [Folders] Differentiate permission issue and non-existence of a directory (issue #828)
|
||||
* [Web UI] Add cpu name in quicklook plugin (issue #825)
|
||||
* Allow theme to be set in configuration file (issue #862)
|
||||
* Display a warning message when Glances is outdated (issue #865)
|
||||
|
||||
Bugs corrected:
|
||||
|
||||
|
|
|
@ -39,8 +39,18 @@ Syntax
|
|||
|
||||
Glances reads configuration files in the *ini* syntax.
|
||||
|
||||
Each plugin and export module can have a section. Below an example for
|
||||
the CPU plugin:
|
||||
A first section (called global) is available:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[global]
|
||||
# Does Glances should check if a newer version is available on Pypi ?
|
||||
check_update=true
|
||||
|
||||
|
||||
|
||||
Each plugin, export module and application monitoring process (AMP) can have a
|
||||
section. Below an example for the CPU plugin:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
|
@ -58,6 +68,33 @@ the CPU plugin:
|
|||
steal_warning=70
|
||||
steal_critical=90
|
||||
|
||||
an InfluxDB export module:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[influxdb]
|
||||
# Configuration for the --export-influxdb option
|
||||
# https://influxdb.com/
|
||||
host=localhost
|
||||
port=8086
|
||||
user=root
|
||||
password=root
|
||||
db=glances
|
||||
prefix=localhost
|
||||
#tags=foo:bar,spam:eggs
|
||||
|
||||
or a NGinx AMP:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[amp_nginx]
|
||||
# Nginx status page should be enable (https://easyengine.io/tutorials/nginx/status-page/)
|
||||
enable=true
|
||||
regex=\/usr\/sbin\/nginx
|
||||
refresh=60
|
||||
one_line=false
|
||||
status_url=http://localhost/nginx_status
|
||||
|
||||
Logging
|
||||
-------
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ Start the client browser (browser mode):\n\
|
|||
parser.add_argument('--process-short-name', action='store_true', default=False,
|
||||
dest='process_short_name', help='force short name for processes name')
|
||||
parser.add_argument('-0', '--disable-irix', action='store_true', default=False,
|
||||
dest='disable_irix', help='Task\'s cpu usage will be divided by the total number of CPUs')
|
||||
dest='disable_irix', help='task\'s cpu usage will be divided by the total number of CPUs')
|
||||
if not WINDOWS:
|
||||
parser.add_argument('--hide-kernel-threads', action='store_true', default=False,
|
||||
dest='no_kernel_threads', help='hide kernel threads in process list')
|
||||
|
@ -229,7 +229,9 @@ Start the client browser (browser mode):\n\
|
|||
dest='fs_free_space', help='display FS free space instead of used')
|
||||
parser.add_argument('--theme-white', action='store_true', default=False,
|
||||
dest='theme_white', help='optimize display colors for white background')
|
||||
|
||||
# Globals options
|
||||
parser.add_argument('--disable-check-update', action='store_true', default=False,
|
||||
dest='disable_check_update', help='disable online Glances version ckeck')
|
||||
return parser
|
||||
|
||||
def parse_args(self):
|
||||
|
|
|
@ -53,14 +53,14 @@ class Outdated(object):
|
|||
self.config = config
|
||||
|
||||
# Set default value...
|
||||
self.outdated_config_tag = True
|
||||
self.data = {
|
||||
'installed_version': __version__,
|
||||
'latest_version': '0.0',
|
||||
'refresh_date': datetime.now()
|
||||
u'installed_version': __version__,
|
||||
u'latest_version': '0.0',
|
||||
u'refresh_date': datetime.now()
|
||||
}
|
||||
# Read the configuration file
|
||||
self.load_config(config)
|
||||
logger.debug("Check Glances version up-to-date: {0}".format(not self.args.disable_check_update))
|
||||
|
||||
# And update !
|
||||
self.get_pypi_version()
|
||||
|
@ -71,8 +71,7 @@ class Outdated(object):
|
|||
global_section = 'global'
|
||||
if (hasattr(config, 'has_section') and
|
||||
config.has_section(global_section)):
|
||||
self.outdated_config_tag = config.get_value(global_section, 'check_update').lower() == 'true'
|
||||
logger.debug("Check Glances version up-to-date: {0}".format(self.outdated_config_tag))
|
||||
self.args.disable_check_update = config.get_value(global_section, 'check_update').lower() == 'false'
|
||||
else:
|
||||
logger.debug("Can not find section {0} in the configuration file".format(global_section))
|
||||
return False
|
||||
|
@ -93,7 +92,7 @@ class Outdated(object):
|
|||
The data are stored in a cached file
|
||||
Only update online once a week
|
||||
"""
|
||||
if not outdated_tag or not self.outdated_config_tag:
|
||||
if not outdated_tag or self.args.disable_check_update:
|
||||
return
|
||||
|
||||
# If the cached file exist, read-it
|
||||
|
@ -111,7 +110,7 @@ class Outdated(object):
|
|||
|
||||
def is_outdated(self):
|
||||
"""Return True if a new version is available"""
|
||||
if not self.self.outdated_config_tag:
|
||||
if self.args.disable_check_update:
|
||||
# Check is disabled by configuration
|
||||
return False
|
||||
|
||||
|
@ -169,7 +168,7 @@ class Outdated(object):
|
|||
logger.debug("Get latest Glances version from the Pypi Restfull API ({0})".format(self.PYPI_API_URL))
|
||||
|
||||
# Update the current time
|
||||
self.data['refresh_date'] = datetime.now()
|
||||
self.data[u'refresh_date'] = datetime.now()
|
||||
|
||||
try:
|
||||
res = requests.get(self.PYPI_API_URL)
|
||||
|
@ -178,7 +177,7 @@ class Outdated(object):
|
|||
else:
|
||||
if res.ok:
|
||||
# Update data
|
||||
self.data['latest_version'] = json.loads(res.text)['info']['version']
|
||||
self.data[u'latest_version'] = json.loads(res.text)['info']['version']
|
||||
logger.debug("Save Glances version to the cache file")
|
||||
else:
|
||||
logger.debug("Can not get the Glances version from the Pypi Restfull API ({0})".format(res.reason))
|
||||
|
|
Loading…
Reference in New Issue