Merge branch 'release/v2.1.1'

This commit is contained in:
Nicolargo 2014-10-02 21:24:26 +02:00
commit 287af37541
14 changed files with 78 additions and 54 deletions

15
NEWS
View File

@ -2,6 +2,21 @@
Glances Version 2.x
==============================================================================
Version 2.1.1
=============
Enhancement:
* Automaticaly compute top processes number for the current screen (issue #408)
* CPU and Memory footprint optimization (issue #401)
Bugs corrected:
* Mac OS X 10.9: Exception at start (issue #423)
* Process no longer exists (issue #421)
* Error with Glances Client with Python 3.4.1 (issue #419)
* TypeError: memory_maps() takes exactly 2 arguments (issue #413)
* No filesystem informations since Glances 2.0 bug enhancement (issue #381)
Version 2.1
===========

View File

@ -96,10 +96,6 @@ core 0_alias=CPU Core 0
core 1_alias=CPU Core 1
[processlist]
# Maximum number of processes to show in the UI
# Note: Only limit number of showed processes (not the one returned by the API)
# Default is 20 processes (Top 20)
max_processes=20
# Limit values for CPU/MEM per process in %
# Default values if not defined: 50/70/90
cpu_careful=50

View File

@ -96,10 +96,6 @@ battery_critical=95
#core 1_alias=CPU Core 1
[processlist]
# Maximum number of processes to show in the UI
# Note: Only limit number of showed processes (not the one returned by the API)
# Default is 20 processes (Top 20)
max_processes=20
# Limit values for CPU/MEM per process in %
# Default values if not defined: 50/70/90
cpu_careful=50

View File

@ -123,9 +123,9 @@ td.option-group {
<div class="document" id="glances">
<h1 class="title">Glances</h1>
<p>This manual describes <em>Glances</em> version 2.1.</p>
<p>This manual describes <em>Glances</em> version 2.1.1.</p>
<p>Copyright © 2012-2014 Nicolas Hennion &lt;<a class="reference external" href="mailto:nicolas&#64;nicolargo.com">nicolas&#64;nicolargo.com</a>&gt;</p>
<p>September 2014</p>
<p>October 2014</p>
<div class="contents topic" id="table-of-contents">
<p class="topic-title first">Table of Contents</p>
<ul class="simple">

View File

@ -2,11 +2,11 @@
Glances
=======
This manual describes *Glances* version 2.1.
This manual describes *Glances* version 2.1.1.
Copyright © 2012-2014 Nicolas Hennion <nicolas@nicolargo.com>
September 2014
October 2014
.. contents:: Table of Contents

View File

@ -20,7 +20,7 @@
"""Init the Glances software."""
__appname__ = 'glances'
__version__ = '2.1'
__version__ = '2.1.1'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPL'

View File

@ -25,9 +25,14 @@ import socket
import sys
try:
from xmlrpc.client import Transport, ServerProxy, ProtocolError, Fault
except ImportError: # Python 2
except ImportError:
# Python 2
from xmlrpclib import Transport, ServerProxy, ProtocolError, Fault
import httplib
try:
import http.client as httplib
except:
# Python 2
import httplib
# Import Glances libs
from glances.core.glances_globals import version, logger

View File

@ -66,9 +66,6 @@ class GlancesProcesses(object):
self.process_filter = None
self.process_filter_re = None
# !!! ONLY FOR TEST
# self.set_process_filter('.*python.*')
def enable(self):
"""Enable process stats."""
self.disable_tag = False
@ -158,7 +155,7 @@ class GlancesProcesses(object):
# Patch for issue #391
try:
self.cmdline_cache[procstat['pid']] = ' '.join(proc.cmdline())
except (AttributeError, psutil.AccessDenied, UnicodeDecodeError):
except (AttributeError, UnicodeDecodeError, psutil.AccessDenied, psutil.NoSuchProcess):
self.cmdline_cache[procstat['pid']] = ""
procstat['cmdline'] = self.cmdline_cache[procstat['pid']]
@ -276,6 +273,9 @@ class GlancesProcesses(object):
pass
except psutil.AccessDenied:
procstat['memory_swap'] = None
except:
# Add a dirty except to handle the PsUtil issue #413
procstat['memory_swap'] = None
# Process network connections (TCP and UDP)
try:
@ -318,7 +318,7 @@ class GlancesProcesses(object):
processdict = {}
for proc in psutil.process_iter():
# If self.get_max_processes() is None: Only retreive mandatory stats
# Else: retreive mandatoryadn standard stast
# Else: retreive mandatory and standard stats
s = self.__get_process_stats(proc,
mandatory_stats=True,
standard_stats=self.get_max_processes() is None)
@ -348,14 +348,28 @@ class GlancesProcesses(object):
except:
pass
# Process optimization
# Only retreive stats for visible processes (get_max_processes)
if self.get_max_processes() is not None:
# Sort the internal dict and cut the top N (Return a list of tuple)
# tuple=key (proc), dict (returned by __get_process_stats)
processiter = sorted(processdict.items(), key=lambda x: x[1][self.getsortkey()], reverse=True)
first = True
for i in processiter[0:self.get_max_processes()]:
# Already existing mandatory stats
procstat = i[1]
try:
processiter = sorted(processdict.items(), key=lambda x: x[1][self.getsortkey()], reverse=True)
except TypeError:
# Fallback to all process (issue #423)
processloop = processdict.items()
first = False
else:
processloop = processiter[0:self.get_max_processes()]
first = True
else:
# Get all processes stats
processloop = processdict.items()
first = False
for i in processloop:
# Already existing mandatory stats
procstat = i[1]
if self.get_max_processes() is not None:
# Update with standard stats
# and extended stats but only for TOP (first) process
s = self.__get_process_stats(i[0],
@ -365,21 +379,12 @@ class GlancesProcesses(object):
if s is None:
continue
procstat.update(s)
# Add a specific time_since_update stats for bitrate
procstat['time_since_update'] = time_since_update
# Update process list
self.processlist.append(procstat)
# Next...
first = False
else:
# Get all the processes
for i in processdict.items():
# Already existing mandatory and standard stats
procstat = i[1]
# Add a specific time_since_update stats for bitrate
procstat['time_since_update'] = time_since_update
# Update process list
self.processlist.append(procstat)
# Add a specific time_since_update stats for bitrate
procstat['time_since_update'] = time_since_update
# Update process list
self.processlist.append(procstat)
# Next...
first = False
# Clean internals caches if timeout is reached
if self.cache_timer.finished():

View File

@ -34,14 +34,8 @@ class GlancesStandalone(object):
# Init stats
self.stats = GlancesStats(config=config, args=args)
# If configured, set the maximum processes number to display
try:
max_processes = int(self.stats.get_plugin('processlist').get_conf_value('max_processes'))
logger.debug(_("Limit maximum displayed processes to %s") % max_processes)
except:
max_processes = None
logger.warning(_("Maximum displayed processes is not configured (high CPU consumption)"))
glances_processes.set_max_processes(max_processes)
# Default number of processes to displayed is set to 20
glances_processes.set_max_processes(20)
# If process extended stats is disabled by user
if args.disable_process_extended:

View File

@ -383,6 +383,7 @@ class GlancesCurses(object):
# Update the stats messages
###########################
# Update the client server status
self.args.cs_status = cs_status
stats_system = stats.get_plugin('system').get_stats_display(args=self.args)
@ -400,10 +401,22 @@ class GlancesCurses(object):
stats_sensors = stats.get_plugin('sensors').get_stats_display(args=self.args)
stats_now = stats.get_plugin('now').get_stats_display()
stats_processcount = stats.get_plugin('processcount').get_stats_display(args=self.args)
stats_processlist = stats.get_plugin('processlist').get_stats_display(args=self.args)
stats_monitor = stats.get_plugin('monitor').get_stats_display(args=self.args)
stats_alert = stats.get_plugin('alert').get_stats_display(args=self.args)
# Adapt number of processes to the available space
max_processes_displayed = screen_y - 11 - self.get_stats_display_height(stats_alert)
if not self.args.disable_process_extended:
max_processes_displayed -= 4
if max_processes_displayed < 0:
max_processes_displayed = 0
if glances_processes.get_max_processes() is None or \
glances_processes.get_max_processes() != max_processes_displayed:
logger.debug(_("Set number of displayed processes to %s") % max_processes_displayed)
glances_processes.set_max_processes(max_processes_displayed)
stats_processlist = stats.get_plugin('processlist').get_stats_display(args=self.args)
# Display the stats on the curses interface
###########################################

View File

@ -343,7 +343,7 @@ class Plugin(GlancesPlugin):
listsorted = sorted(self.stats,
key=lambda process: process[sortedby],
reverse=sortedreverse)
except KeyError:
except (KeyError, TypeError):
listsorted = sorted(self.stats,
key=lambda process: process['name'],
reverse=False)

View File

@ -1,4 +1,4 @@
.TH glances 1 "September, 2014" "version 2.1" "USER COMMANDS"
.TH glances 1 "October, 2014" "version 2.1.1" "USER COMMANDS"
.SH NAME
glances \- A cross-platform curses-based system monitoring tool
.SH SYNOPSIS

View File

@ -1 +1 @@
psutil==2.1.1
psutil==2.1.3

View File

@ -40,13 +40,13 @@ def get_requires():
setup(
name='Glances',
version='2.1',
version='2.1.1',
description="A cross-platform curses-based monitoring tool",
long_description=open('README.rst').read(),
author='Nicolas Hennion',
author_email='nicolas@nicolargo.com',
url='https://github.com/nicolargo/glances',
# download_url='https://s3.amazonaws.com/glances/glances-2.1.tar.gz',
# download_url='https://s3.amazonaws.com/glances/glances-2.1.1.tar.gz',
license="LGPL",
keywords="cli curses monitoring system",
install_requires=get_requires(),