mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-25 10:12:55 +03:00
Enable/disable for optionnal plugins
This commit is contained in:
parent
43885f8c3f
commit
c00f48d5d5
@ -50,11 +50,11 @@ critical=90
|
||||
|
||||
[network]
|
||||
# Define the list of hidden network interfaces (comma separeted)
|
||||
#hide=lo
|
||||
hide=lo
|
||||
|
||||
[diskio]
|
||||
# Define the list of hidden disks (comma separeted)
|
||||
#hide=sda2,sda5
|
||||
hide=sda2,sda5
|
||||
|
||||
[fs]
|
||||
# Default limits for free filesytem space in %
|
||||
|
@ -44,12 +44,12 @@ class GlancesMain(object):
|
||||
# Default network bitrate is display in bit per second
|
||||
network_bytepersec_tag = False
|
||||
# Display (or not) module
|
||||
diskio_tag = True
|
||||
fs_tag = True
|
||||
hddtemp_flag = True
|
||||
network_tag = True
|
||||
# diskio_tag = True
|
||||
# fs_tag = True
|
||||
# hddtemp_flag = True
|
||||
# network_tag = True
|
||||
# sensors_tag = True
|
||||
process_tag = True
|
||||
sensors_tag = True
|
||||
# Display property
|
||||
use_bold = True
|
||||
percpu_tag = False
|
||||
@ -120,27 +120,27 @@ class GlancesMain(object):
|
||||
# Disable DiskIO module
|
||||
self.parser.add_argument('--disable_diskio',
|
||||
help=_('disable disk I/O module'),
|
||||
action='store_false')
|
||||
# Disable HDD temperature module
|
||||
self.parser.add_argument('--disable_hddtemp',
|
||||
help=_('disable HDD temperature module'),
|
||||
action='store_false')
|
||||
action='store_true')
|
||||
# Disable mount module
|
||||
self.parser.add_argument('--disable_mount',
|
||||
help=_('disable mount module'),
|
||||
action='store_false')
|
||||
self.parser.add_argument('--disable_fs',
|
||||
help=_('disable file system (mount) module'),
|
||||
action='store_true')
|
||||
# Disable network module
|
||||
self.parser.add_argument('--disable_network',
|
||||
help=_('disable network module'),
|
||||
action='store_false')
|
||||
action='store_true')
|
||||
# Enable sensors module
|
||||
self.parser.add_argument('--disable_sensors',
|
||||
help=_('disable sensors module'),
|
||||
action='store_false')
|
||||
action='store_true')
|
||||
# Disable process module
|
||||
self.parser.add_argument('--disable_process',
|
||||
help=_('disable process module'),
|
||||
action='store_false')
|
||||
action='store_true')
|
||||
# Disable log module
|
||||
self.parser.add_argument('--disable_log',
|
||||
help=_('disable log module'),
|
||||
action='store_true')
|
||||
|
||||
# Bold attribute for Curse display (not supported by all terminal)
|
||||
self.parser.add_argument('-z', '--no_bold',
|
||||
@ -202,12 +202,12 @@ class GlancesMain(object):
|
||||
# !!! To be refactor to use directly the args list in the code
|
||||
if (args.time is not None): self.refresh_time = args.time
|
||||
self.network_bytepersec_tag = args.byte
|
||||
self.diskio_tag = args.disable_diskio
|
||||
self.fs_tag = args.disable_mount
|
||||
self.hddtemp_flag = args.disable_hddtemp
|
||||
self.network_tag = args.disable_network
|
||||
# self.diskio_tag = args.disable_diskio
|
||||
# self.fs_tag = args.disable_mount
|
||||
# self.hddtemp_flag = args.disable_hddtemp
|
||||
# self.network_tag = args.disable_network
|
||||
self.process_tag = args.disable_process
|
||||
self.sensors_tag = args.disable_sensors and is_Linux # and sensors_lib_tag
|
||||
# self.sensors_tag = args.disable_sensors and is_Linux # and sensors_lib_tag
|
||||
self.use_bold = args.no_bold
|
||||
self.percpu_tag = args.percpu
|
||||
if (args.config is not None):
|
||||
|
@ -189,35 +189,33 @@ class glancesCurses:
|
||||
elif self.pressedkey == ord('c'):
|
||||
# 'c' > Sort processes by CPU usage
|
||||
self.args.process_sorted_by = 'cpu_percent'
|
||||
elif self.pressedkey == ord('d') and diskio_tag:
|
||||
elif self.pressedkey == ord('d'):
|
||||
# 'd' > Show/hide disk I/O stats
|
||||
self.diskio_tag = not self.diskio_tag
|
||||
elif self.pressedkey == ord('f') and fs_tag:
|
||||
self.args.disable_diskio = not self.args.disable_diskio
|
||||
elif self.pressedkey == ord('f'):
|
||||
# 'f' > Show/hide fs stats
|
||||
self.fs_tag = not self.fs_tag
|
||||
self.args.disable_fs = not self.args.disable_fs
|
||||
elif self.pressedkey == ord('h'):
|
||||
# 'h' > Show/hide help
|
||||
self.args.help_tag = not self.args.help_tag
|
||||
elif self.pressedkey == ord('i'):
|
||||
# elif self.pressedkey == ord('i') and psutil_get_io_counter_tag:
|
||||
# !!! Manage IORate (non existing) on Mac OS
|
||||
# 'i' > Sort processes by IO rate (not available on OS X)
|
||||
self.args.process_sorted_by = 'io_counters'
|
||||
elif self.pressedkey == ord('l'):
|
||||
# 'l' > Show/hide log messages
|
||||
self.log_tag = not self.log_tag
|
||||
self.args.disable_log = not self.args.disable_log
|
||||
elif self.pressedkey == ord('m'):
|
||||
# 'm' > Sort processes by MEM usage
|
||||
self.args.process_sorted_by = 'memory_percent'
|
||||
elif self.pressedkey == ord('n') and network_tag:
|
||||
elif self.pressedkey == ord('n'):
|
||||
# 'n' > Show/hide network stats
|
||||
self.network_tag = not self.network_tag
|
||||
self.args.disable_network = not self.args.disable_network
|
||||
elif self.pressedkey == ord('p'):
|
||||
# 'p' > Sort processes by name
|
||||
self.args.process_sorted_by = 'name'
|
||||
elif self.pressedkey == ord('s'):
|
||||
# 's' > Show/hide sensors stats (Linux-only)
|
||||
self.sensors_tag = not self.sensors_tag
|
||||
self.args.disable_sensors = not self.args.disable_sensors
|
||||
elif self.pressedkey == ord('t'):
|
||||
# 't' > View network traffic as combination
|
||||
self.network_stats_combined = not self.network_stats_combined
|
||||
@ -230,9 +228,6 @@ class glancesCurses:
|
||||
elif self.pressedkey == ord('x'):
|
||||
# 'x' > Delete finished warning and critical logs
|
||||
glances_logs.clean(critical=True)
|
||||
elif self.pressedkey == ord('y'):
|
||||
# 'y' > Show/hide hddtemp stats
|
||||
self.hddtemp_tag = not self.hddtemp_tag
|
||||
|
||||
# Return the key code
|
||||
return self.pressedkey
|
||||
|
@ -60,6 +60,10 @@ class Plugin(GlancesPlugin):
|
||||
# Init the return message
|
||||
ret = []
|
||||
|
||||
# Only process if display plugin enable...
|
||||
if (args.disable_log):
|
||||
return ret
|
||||
|
||||
# Build the string message
|
||||
# Header
|
||||
if (self.stats == []):
|
||||
|
@ -108,14 +108,11 @@ class Plugin(GlancesPlugin):
|
||||
Return the dict to display in the curse interface
|
||||
"""
|
||||
|
||||
#!!! TODO: Add alert on disk IO
|
||||
#!!! TODO: manage the hide tag for disk IO list
|
||||
|
||||
# Init the return message
|
||||
ret = []
|
||||
|
||||
# Only process if stats exist...
|
||||
if (self.stats == []):
|
||||
# Only process if stats exist and display plugin enable...
|
||||
if ((self.stats == []) or (args.disable_diskio)):
|
||||
return ret
|
||||
|
||||
# Build the string message
|
||||
|
@ -111,13 +111,13 @@ class Plugin(GlancesPlugin):
|
||||
# Init the return message
|
||||
ret = []
|
||||
|
||||
# Only process if stats exist...
|
||||
if (self.stats == []):
|
||||
# Only process if stats exist and display plugin enable...
|
||||
if ((self.stats == []) or (args.disable_fs)):
|
||||
return ret
|
||||
|
||||
# Build the string message
|
||||
# Header
|
||||
msg = "{0:8}".format(_("MOUNT"))
|
||||
msg = "{0:8}".format(_("FILE SYS"))
|
||||
ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
msg = " {0:>6}".format(_("Used"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
|
@ -73,7 +73,7 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_new_line())
|
||||
msg = msg_col.format(_("a"), _("Sort processes automatically"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = msg_col2.format(_("l"), _("Show/hide logs"))
|
||||
msg = msg_col2.format(_("l"), _("Show/hide logs (alerts)"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
ret.append(self.curse_new_line())
|
||||
msg = msg_col.format(_("c"), _("Sort processes by CPU%"))
|
||||
@ -83,12 +83,12 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_new_line())
|
||||
msg = msg_col.format(_("m"), _("Sort processes by MEM%"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = msg_col2.format(_("w"), _("Delete warning logs"))
|
||||
msg = msg_col2.format(_("w"), _("Delete warning alerts"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
ret.append(self.curse_new_line())
|
||||
msg = msg_col.format(_("p"), _("Sort processes by name"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = msg_col2.format(_("x"), _("Delete warning and critical logs"))
|
||||
msg = msg_col2.format(_("x"), _("Delete warning and critical alerts"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
ret.append(self.curse_new_line())
|
||||
msg = msg_col.format(_("i"), _("Sort processes by I/O rate"))
|
||||
@ -113,12 +113,10 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_new_line())
|
||||
msg = msg_col.format(_("s"), _("Show/hide sensors stats"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = msg_col2.format(_("z"), _("Show/hide processes list"))
|
||||
msg = msg_col2.format(_("z"), _("Disable all processes stats"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
ret.append(self.curse_new_line())
|
||||
msg = msg_col.format(_("y"), _("Show/hide hddtemp stats"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = msg_col2.format(_("q"), _("Quit (Esc and Ctrl-C also work)"))
|
||||
msg = msg_col.format(_("q"), _("Quit (Esc and Ctrl-C also work)"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
|
||||
# Return the message with decoration
|
||||
|
@ -113,8 +113,8 @@ class Plugin(GlancesPlugin):
|
||||
# Init the return message
|
||||
ret = []
|
||||
|
||||
# Only process if stats exist...
|
||||
if (self.stats == []):
|
||||
# Only process if stats exist and display plugin enable...
|
||||
if ((self.stats == []) or (args.disable_network)):
|
||||
return ret
|
||||
|
||||
# Build the string message
|
||||
|
@ -118,8 +118,8 @@ class Plugin(GlancesPlugin):
|
||||
# Init the return message
|
||||
ret = []
|
||||
|
||||
# Only process if stats exist...
|
||||
if self.stats == []:
|
||||
# Only process if stats exist and display plugin enable...
|
||||
if ((self.stats == []) or (args.disable_sensors)):
|
||||
return ret
|
||||
|
||||
# Build the string message
|
||||
|
Loading…
Reference in New Issue
Block a user