Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--stdout plugin.attr is not compliant with plugins returning list of dicts #2446

Closed
Rogersyangluo opened this issue Jun 9, 2023 · 2 comments
Labels
Milestone

Comments

@Rogersyangluo
Copy link

In the Linux system, how does the command glances --stdout processlist only take one or several attributes such as pid or name, such as glances --stdout processlist.pid

@nicolargo nicolargo added the bug label Jun 10, 2023
@nicolargo nicolargo added this to the Glances 4.0.0 milestone Jun 10, 2023
@nicolargo nicolargo changed the title glances --stdout processlist --stdout plugin.attr is not compliant with plugins returning list of dicts Jun 10, 2023
@nicolargo
Copy link
Owner

For the moment it is not possible:

./venv/bin/python -m glances -C ./conf/glances.conf --stdout processlist.username
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/nicolargo/dev/glances/glances/__main__.py", line 18, in <module>
    glances.main()
  File "/home/nicolargo/dev/glances/glances/__init__.py", line 184, in main
    start(config=core.get_config(), args=core.get_args())
  File "/home/nicolargo/dev/glances/glances/__init__.py", line 130, in start
    mode.serve_forever()
  File "/home/nicolargo/dev/glances/glances/standalone.py", line 181, in serve_forever
    while self.__serve_once():
  File "/home/nicolargo/dev/glances/glances/standalone.py", line 160, in __serve_once
    ret = not self.screen.update(self.stats, duration=adapted_refresh)
  File "/home/nicolargo/dev/glances/glances/outputs/glances_stdout.py", line 62, in update
    printandflush("{}.{}: {}".format(plugin, attribute, stat[attribute]))
TypeError: list indices must be integers or slices, not str
^CException ignored in: <module 'threading' from '/usr/lib/python3.10/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1567, in _shutdown
    lock.acquire()
  File "/home/nicolargo/dev/glances/glances/__init__.py", line 64, in __signal_handler
    end()
  File "/home/nicolargo/dev/glances/glances/__init__.py", line 79, in end
    sys.exit(0)
SystemExit: 0

Should have a look on what it is possible to do.

@nicolargo
Copy link
Owner

Corrected in the develop branch.

Will be release with Glances 4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants