提交 b19b1f54 编写于 作者: N nicolargo

Add --disable-<option> for all plugins. Should be refactor...

上级 9104f439
......@@ -68,6 +68,8 @@ class Plugin(GlancesPlugin):
"""Init the CPU plugin."""
super(Plugin, self).__init__(args=args, items_history_list=items_history_list)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -88,9 +90,13 @@ class Plugin(GlancesPlugin):
@GlancesPlugin._log_result_decorator
def update(self):
"""Update CPU stats using the input method."""
# Reset stats
self.reset()
if self.args is not None and self.args.disable_cpu:
return self.stats
# Grab stats into self.stats
if self.input_method == 'local':
self.update_local()
......
......@@ -51,6 +51,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args, items_history_list=items_history_list)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -72,6 +74,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self.reset()
if self.args is not None and self.args.disable_diskio:
return self.stats
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab the stat using the PsUtil disk_io_counters method
......
......@@ -33,6 +33,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -59,6 +61,9 @@ class Plugin(GlancesPlugin):
# Reset the list
self.reset()
if self.args is not None and self.args.disable_folder:
return self.stats
if self.input_method == 'local':
# Folder list only available in a full Glances environment
# Check if the glances_folder instance is init
......
......@@ -75,6 +75,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args, items_history_list=items_history_list)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -96,6 +98,9 @@ class Plugin(GlancesPlugin):
# Reset the list
self.reset()
if self.args is not None and self.args.disable_fs:
return self.stats
if self.input_method == 'local':
# Update stats using the standard system lib
......
......@@ -62,6 +62,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -85,6 +87,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self.reset()
if self.args.disable_ip:
return self.stats
if self.input_method == 'local' and netifaces_tag:
# Update stats using the netifaces lib
try:
......
......@@ -36,6 +36,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -60,7 +62,8 @@ class Plugin(GlancesPlugin):
# Reset the list
self.reset()
if not LINUX: # only available on GNU/Linux
# IRQ plugin only available on GNU/Linux
if not LINUX or self.args.disable_irq:
return self.stats
if self.input_method == 'local':
......
......@@ -58,6 +58,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args, items_history_list=items_history_list)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -81,6 +83,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self.reset()
if self.args is not None and self.args.disable_load:
return self.stats
if self.input_method == 'local':
# Update stats using the standard system lib
......
......@@ -66,6 +66,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args, items_history_list=items_history_list)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -83,6 +85,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self.reset()
if self.args is not None and self.args.disable_mem:
return self.stats
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab MEM using the PSUtil virtual_memory method
......
......@@ -54,6 +54,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args, items_history_list=items_history_list)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -71,6 +73,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self.reset()
if self.args.disable_swap:
return self.stats
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab SWAP using the PSUtil swap_memory method
......
......@@ -59,6 +59,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args, items_history_list=items_history_list)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -83,6 +85,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self.reset()
if self.args is not None and self.args.disable_network:
return self.stats
if self.input_method == 'local':
# Update stats using the standard system lib
......
......@@ -35,6 +35,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -56,6 +58,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self.reset()
if self.args is not None and self.args.disable_cpu:
return self.stats
# Grab per-CPU stats using psutil's cpu_percent(percpu=True) and
# cpu_times_percent(percpu=True) methods
if self.input_method == 'local':
......
......@@ -66,6 +66,9 @@ class Plugin(GlancesPlugin):
def update(self):
"""Update the ports list."""
if self.args.disable_ports:
return self.stats
if self.input_method == 'local':
# Only refresh:
# * if there is not other scanning thread
......
......@@ -41,6 +41,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -58,6 +60,9 @@ class Plugin(GlancesPlugin):
# Reset stats
self.reset()
if self.args.disable_raid:
return self.stats
if self.input_method == 'local':
# Update stats using the PyMDstat lib (https://github.com/nicolargo/pymdstat)
try:
......
......@@ -53,6 +53,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
self.args = args
# Init the sensor class
self.glancesgrabsensors = GlancesGrabSensors()
......@@ -85,6 +87,9 @@ class Plugin(GlancesPlugin):
# Reset the stats
self.reset()
if self.args.disable_sensors:
return self.stats
if self.input_method == 'local':
# Update stats using the dedicated lib
self.stats = []
......
......@@ -49,6 +49,8 @@ class Plugin(GlancesPlugin):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
self.args = args
# We want to display the stat in the curse interface
self.display_curse = True
......@@ -82,7 +84,7 @@ class Plugin(GlancesPlugin):
self.reset()
# Exist if we can not grab the stats
if not wifi_tag:
if not wifi_tag or self.args.disable_wifi:
return self.stats
if self.input_method == 'local':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册