mirror of
https://github.com/nicolargo/glances.git
synced 2026-03-16 21:08:12 -04:00
Merge branch 'develop' into feature/issue480
This commit is contained in:
@@ -198,7 +198,7 @@ Command-Line Options
|
||||
-b, --byte display network rate in byte per second
|
||||
-1, --percpu start Glances in per CPU mode
|
||||
--fs-free-space display FS free space instead of used
|
||||
--theme-white optimize display for white background
|
||||
--theme-white optimize display colors for white background
|
||||
|
||||
Interactive Commands
|
||||
--------------------
|
||||
|
||||
@@ -402,7 +402,7 @@ class GlancesProcesses(object):
|
||||
# Get the process IO counters
|
||||
proc_io = proc.io_counters()
|
||||
io_new = [proc_io.read_bytes, proc_io.write_bytes]
|
||||
except (psutil.AccessDenied, psutil.NoSuchProcess):
|
||||
except (psutil.AccessDenied, psutil.NoSuchProcess, NotImplementedError):
|
||||
# Access denied to process IO (no root account)
|
||||
# NoSuchProcess (process die between first and second grab)
|
||||
# Put 0 in all values (for sort) and io_tag = 0 (for
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
"""Manage the Glances standalone session."""
|
||||
|
||||
from time import sleep
|
||||
|
||||
# Import Glances libs
|
||||
from glances.core.glances_globals import is_windows
|
||||
from glances.core.glances_logging import logger
|
||||
@@ -34,6 +36,7 @@ class GlancesStandalone(object):
|
||||
def __init__(self, config=None, args=None):
|
||||
# Quiet mode
|
||||
self._quiet = args.quiet
|
||||
self.refresh_time = args.time
|
||||
|
||||
# Init stats
|
||||
self.stats = GlancesStats(config=config, args=args)
|
||||
@@ -82,9 +85,12 @@ class GlancesStandalone(object):
|
||||
# Update system informations
|
||||
self.stats.update()
|
||||
|
||||
# Update the screen
|
||||
if not self.quiet:
|
||||
# Update the screen
|
||||
self.screen.update(self.stats)
|
||||
else:
|
||||
# Wait...
|
||||
sleep(self.refresh_time)
|
||||
|
||||
# Export stats using export modules
|
||||
self.stats.export(self.stats)
|
||||
|
||||
@@ -54,7 +54,18 @@ class GlancesExport(object):
|
||||
|
||||
def plugins_to_export(self):
|
||||
"""Return the list of plugins to export"""
|
||||
return ['cpu', 'load', 'mem', 'memswap', 'network', 'diskio', 'fs', 'processcount']
|
||||
return ['cpu',
|
||||
'percpu',
|
||||
'load',
|
||||
'mem',
|
||||
'memswap',
|
||||
'network',
|
||||
'diskio',
|
||||
'fs',
|
||||
'processcount',
|
||||
'ip',
|
||||
'system',
|
||||
'uptime']
|
||||
|
||||
def update(self, stats):
|
||||
"""Update stats to a server.
|
||||
|
||||
@@ -42,6 +42,10 @@ class Plugin(GlancesPlugin):
|
||||
# Init stats
|
||||
self.reset()
|
||||
|
||||
def get_key(self):
|
||||
"""Return the key of the list"""
|
||||
return 'cpu_number'
|
||||
|
||||
def reset(self):
|
||||
"""Reset/init the stats."""
|
||||
self.stats = []
|
||||
@@ -56,9 +60,12 @@ class Plugin(GlancesPlugin):
|
||||
if self.input_method == 'local':
|
||||
percpu_percent = psutil.cpu_percent(interval=0.0, percpu=True)
|
||||
percpu_times_percent = psutil.cpu_times_percent(interval=0.0, percpu=True)
|
||||
cpu_number = 0
|
||||
for cputimes in percpu_times_percent:
|
||||
for cpupercent in percpu_percent:
|
||||
cpu = {'total': cpupercent,
|
||||
cpu = {'key': self.get_key(),
|
||||
'cpu_number': str(cpu_number),
|
||||
'total': cpupercent,
|
||||
'user': cputimes.user,
|
||||
'system': cputimes.system,
|
||||
'idle': cputimes.idle}
|
||||
@@ -78,6 +85,7 @@ class Plugin(GlancesPlugin):
|
||||
if hasattr(cputimes, 'guest_nice'):
|
||||
cpu['guest_nice'] = cputimes.guest_nice
|
||||
self.stats.append(cpu)
|
||||
cpu_number += 1
|
||||
else:
|
||||
# Update stats using SNMP
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user