mirror of https://github.com/nicolargo/glances.git
Add the quiet mode (-q)
This commit is contained in:
parent
2ce28dfa18
commit
9d8219c265
1
NEWS
1
NEWS
|
|
@ -10,6 +10,7 @@ Enhancements and news features:
|
|||
* Grab FAN speed in the Glances sensors plugin (issue #501)
|
||||
* Allow logical mounts points in the FS plugin (issue #448)
|
||||
* Add a --disable-hddtemp to disable HDD temperature module at startup (issue #515)
|
||||
* Add a quiet mode (-q). Can be usefull if you need a Statsd or Influxdb provider only.
|
||||
|
||||
Bugs corrected:
|
||||
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@ Command-Line Options
|
|||
--snmp-force force SNMP mode
|
||||
-t TIME, --time TIME set refresh time in seconds [default: 3 sec]
|
||||
-w, --webserver run Glances in web server mode
|
||||
-q, --quiet run Glances in quiet mode (nothing is displayed)
|
||||
-f PROCESS_FILTER, --process-filter PROCESS_FILTER
|
||||
set the process filter patern (regular expression)
|
||||
--process-short-name force short name for processes name
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ Start the client browser (browser mode):\n\
|
|||
parser.add_argument('-w', '--webserver', action='store_true', default=False,
|
||||
dest='webserver', help=_('run Glances in web server mode (need Bootle lib)'))
|
||||
# Display options
|
||||
parser.add_argument('-q', '--quiet', default=False, action='store_true',
|
||||
dest='quiet', help=_('Do not display the Curse interface'))
|
||||
parser.add_argument('-f', '--process-filter', default=None, type=str,
|
||||
dest='process_filter', help=_('set the process filter pattern (regular expression)'))
|
||||
parser.add_argument('--process-short-name', action='store_true', default=False,
|
||||
|
|
@ -189,7 +191,7 @@ Start the client browser (browser mode):\n\
|
|||
parser.add_argument('--fs-free-space', action='store_false', default=False,
|
||||
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 for white background'))
|
||||
dest='theme_white', help=_('optimize display colors for white background'))
|
||||
|
||||
return parser
|
||||
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ class GlancesStandalone(object):
|
|||
"""This class creates and manages the Glances standalone session."""
|
||||
|
||||
def __init__(self, config=None, args=None):
|
||||
# Quiet mode
|
||||
self._quiet = args.quiet
|
||||
|
||||
# Init stats
|
||||
self.stats = GlancesStats(config=config, args=args)
|
||||
|
||||
# Default number of processes to displayed is set to 50
|
||||
glances_processes.max_processes = 50
|
||||
|
||||
# If process extended stats is disabled by user
|
||||
if not args.enable_process_extended:
|
||||
logger.debug("Extended stats for top process are disabled")
|
||||
|
|
@ -61,8 +61,20 @@ class GlancesStandalone(object):
|
|||
# Initial system informations update
|
||||
self.stats.update()
|
||||
|
||||
# Init screen
|
||||
self.screen = GlancesCursesStandalone(args=args)
|
||||
if self.quiet:
|
||||
logger.info("Quiet mode is ON: Nothing will be displayed")
|
||||
# In quiet mode, nothing is displayed
|
||||
glances_processes.max_processes = 0
|
||||
else:
|
||||
# Default number of processes to displayed is set to 50
|
||||
glances_processes.max_processes = 50
|
||||
|
||||
# Init screen
|
||||
self.screen = GlancesCursesStandalone(args=args)
|
||||
|
||||
@property
|
||||
def quiet(self):
|
||||
return self._quiet
|
||||
|
||||
def serve_forever(self):
|
||||
"""Main loop for the CLI."""
|
||||
|
|
@ -71,14 +83,16 @@ class GlancesStandalone(object):
|
|||
self.stats.update()
|
||||
|
||||
# Update the screen
|
||||
self.screen.update(self.stats)
|
||||
if not self.quiet:
|
||||
self.screen.update(self.stats)
|
||||
|
||||
# Export stats using export modules
|
||||
self.stats.export(self.stats)
|
||||
|
||||
def end(self):
|
||||
"""End of the standalone CLI."""
|
||||
self.screen.end()
|
||||
if not self.quiet:
|
||||
self.screen.end()
|
||||
|
||||
# Exit from export modules
|
||||
self.stats.end()
|
||||
|
|
|
|||
|
|
@ -84,11 +84,11 @@ class Export(GlancesExport):
|
|||
"""Init the connection to the InfluxDB server"""
|
||||
if not self.export_enable:
|
||||
return None
|
||||
db = InfluxDBClient(self.host,
|
||||
self.port,
|
||||
self.user,
|
||||
self.password,
|
||||
self.db)
|
||||
db = InfluxDBClient(host=self.host,
|
||||
port=self.port,
|
||||
username=self.user,
|
||||
password=self.password,
|
||||
database=self.db)
|
||||
try:
|
||||
get_all_db = db.get_list_database()[0].values()
|
||||
except client.InfluxDBClientError as e:
|
||||
|
|
|
|||
|
|
@ -125,6 +125,12 @@ set refresh time in seconds [default: 3 sec]
|
|||
.B \-w, \-\-webserver
|
||||
run Glances in Web server mode
|
||||
.TP
|
||||
.B \-q, \-\-quiet
|
||||
run Glances in quiet mode (nothing is displayed)
|
||||
.TP
|
||||
.B -\f PROCESS_FILTER, \-\-process\-filter PROCESS_FILTER
|
||||
set the process filter patern (regular expression)
|
||||
.TP
|
||||
.B \-1, \-\-percpu
|
||||
start Glances in per CPU mode
|
||||
.TP
|
||||
|
|
|
|||
Loading…
Reference in New Issue