summaryrefslogtreecommitdiffstats
path: root/glances/plugins
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2024-02-11 16:38:01 +0100
committernicolargo <nicolas@nicolargo.com>2024-02-11 16:38:01 +0100
commitac8c2613df6ea9dd38c5a72a2695cbfd97377f82 (patch)
treeb0f4aa98ed8d801d02e7c0bd136a11f506fecfd7 /glances/plugins
parentdc172d45d01d40c3990c1103efbf4debc985f5a0 (diff)
Processlist field description
Diffstat (limited to 'glances/plugins')
-rw-r--r--glances/plugins/processcount/__init__.py14
-rw-r--r--glances/plugins/processlist/__init__.py78
2 files changed, 75 insertions, 17 deletions
diff --git a/glances/plugins/processcount/__init__.py b/glances/plugins/processcount/__init__.py
index ab6df4ed..830dd863 100644
--- a/glances/plugins/processcount/__init__.py
+++ b/glances/plugins/processcount/__init__.py
@@ -16,7 +16,7 @@ from glances.plugins.plugin.model import GlancesPluginModel
# description: human readable description
# short_name: shortname to use un UI
# unit: unit type
-# rate: is it a rate ? If yes, // by time_since_update when displayed,
+# rate: if True then compute and add *_gauge and *_rate_per_is fields
# min_symbol: Auto unit should be used if value > than 1 'X' (K, M, G)...
fields_description = {
'total': {
@@ -81,20 +81,16 @@ class PluginModel(GlancesPluginModel):
@GlancesPluginModel._log_result_decorator
def update(self):
"""Update processes stats using the input method."""
- # Init new stats
- stats = self.get_init_value()
-
+ # Update the stats
if self.input_method == 'local':
# Update stats using the standard system lib
# Here, update is call for processcount AND processlist
glances_processes.update()
- # Return the processes count
+ # For the ProcessCount, only return the processes count
stats = glances_processes.get_count()
- elif self.input_method == 'snmp':
- # Update stats using SNMP
- # Not available
- pass
+ else:
+ stats = self.get_init_value()
# Update the stats
self.stats = stats
diff --git a/glances/plugins/processlist/__init__.py b/glances/plugins/processlist/__init__.py
index d0b90bff..d780af02 100644
--- a/glances/plugins/processlist/__init__.py
+++ b/glances/plugins/processlist/__init__.py
@@ -19,6 +19,67 @@ from glances.outputs.glances_unicode import unicode_message
from glances.plugins.core import PluginModel as CorePluginModel
from glances.plugins.plugin.model import GlancesPluginModel
+# Fields description
+# description: human readable description
+# short_name: shortname to use un UI
+# unit: unit type
+# rate: if True then compute and add *_gauge and *_rate_per_is fields
+# min_symbol: Auto unit should be used if value > than 1 'X' (K, M, G)...
+fields_description = {
+ 'pid': {
+ 'description': 'Process identifier (ID)',
+ 'unit': 'number',
+ },
+ 'name': {
+ 'description': 'Process name',
+ 'unit': 'string',
+ },
+ 'cmdline': {
+ 'description': 'Command line with arguments',
+ 'unit': 'list',
+ },
+ 'username': {
+ 'description': 'Process owner',
+ 'unit': 'string',
+ },
+ 'num_threads': {
+ 'description': 'Number of threads',
+ 'unit': 'number',
+ },
+ 'cpu_percent': {
+ 'description': 'Process CPU consumption',
+ 'unit': 'percent',
+ },
+ 'memory_percent': {
+ 'description': 'Process memory consumption',
+ 'unit': 'percent',
+ },
+ 'memory_info': {
+ 'description': 'Process memory information (dict with rss, vms, shared, text, lib, data, dirty keys)',
+ 'unit': 'byte',
+ },
+ 'status': {
+ 'description': 'Process status',
+ 'unit': 'string',
+ },
+ 'nice': {
+ 'description': 'Process nice value',
+ 'unit': 'number',
+ },
+ 'cpu_times': {
+ 'description': 'Process CPU times (dict with user, system, iowait keys)',
+ 'unit': 'second',
+ },
+ 'gids': {
+ 'description': 'Process group IDs (dict with real, effective, saved keys)',
+ 'unit': 'number',
+ },
+ 'io_counters': {
+ 'description': 'Process IO counters (list with read_count, write_count, read_bytes, write_bytes, io_tag keys)',
+ 'unit': 'byte',
+ },
+}
+
def seconds_to_hms(input_seconds):
"""Convert seconds to human-readable time."""
@@ -94,7 +155,9 @@ class PluginModel(GlancesPluginModel):
def __init__(self, args=None, config=None):
"""Init the plugin."""
- super(PluginModel, self).__init__(args=args, config=config, stats_init_value=[])
+ super(PluginModel, self).__init__(args=args, config=config,
+ fields_description=fields_description,
+ stats_init_value=[])
# We want to display the stat in the curse interface
self.display_curse = True
@@ -143,24 +206,23 @@ class PluginModel(GlancesPluginModel):
else:
stats = self.get_init_value()
- # Update the stats
- self.stats = stats
-
# Get the max values (dict)
# Use Deep copy to avoid change between update and display
self.max_values = copy.deepcopy(glances_processes.max_values())
+ # Update the stats
+ self.stats = stats
+
return self.stats
- # @GlancesPluginModel._manage_rate
def update_local(self):
# Update stats using the standard system lib
# Note: Update is done in the processcount plugin
- # Just return the processes list
+ # Just return the result
if self.args.programs:
- stats = glances_processes.getlist(as_programs=True)
+ stats = glances_processes.get_list(as_programs=True)
else:
- stats = glances_processes.getlist()
+ stats = glances_processes.get_list()
return stats