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

Unable to monitor new version of podman #2844

Closed
jinlin-teck opened this issue Jun 19, 2024 · 2 comments
Closed

Unable to monitor new version of podman #2844

jinlin-teck opened this issue Jun 19, 2024 · 2 comments

Comments

@jinlin-teck
Copy link

After podman version is updated to 5.0+, glances cannot monitor and the following error will appear

root@OpenWrt:~# podman logs glances
Exception in thread Thread-16 (__update_plugin):
Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
  File "/app/glances/stats.py", line 258, in __update_plugin
    self._plugins[p].update()
  File "/app/glances/plugins/plugin/model.py", line 1151, in wrapper
    ret = fct(self, *args, **kw)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/app/glances/plugins/plugin/model.py", line 1168, in wrapper
    ret = fct(*args, **kw)
          ^^^^^^^^^^^^^^^^
  File "/app/glances/plugins/containers/__init__.py", line 223, in update
    stats_podman = self.update_podman() if self.podman_extension else {}
                   ^^^^^^^^^^^^^^^^^^^^
  File "/app/glances/plugins/containers/__init__.py", line 245, in update_podman
    version, containers = self.podman_extension.update(all_tag=self._all_tag())
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/glances/plugins/containers/engines/podman.py", line 290, in update
    container_stats = [self.generate_stats(container) for container in containers]
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/glances/plugins/containers/engines/podman.py", line 290, in <listcomp>
    container_stats = [self.generate_stats(container) for container in containers]
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/glances/plugins/containers/engines/podman.py", line 328, in generate_stats
    stats['cpu_percent'] = stats["cpu"]['total']
                           ~~~~~~~~~~~~^^^^^^^^^
KeyError: 'total'

My temporary solution is to modify the content between the stats['cpu_percent'] field and the stats ['network_tx'] field of the last generate_stats function in the file /app/glances/plugins/containers/engines/podman.py, so that glances does not display the corresponding monitoring values. Can you tell me how to modify it so that it can be displayed correctly without errors? Thank you very much!
glances version: latest-full
podman version: 5.1.1

@RazCrimson
Copy link
Collaborator

RazCrimson commented Jun 19, 2024

Probably same issue as mentioned in #2827

Could you try out the latest develop? It should have the fixes for this.

Will treat it as a newer bug if that does not solve this.

P.S. Thanks for the report! Would really appreciate filling the issue template next time as it helps.

@jinlin-teck
Copy link
Author

jinlin-teck commented Jun 20, 2024

Probably same issue as mentioned in #2827

Could you try out the latest develop? It should have the fixes for this.

Will treat it as a newer bug if that does not solve this.

P.S. Thanks for the report! Would really appreciate filling the issue template next time as it helps.

Yes, after using the latest code, it works fine!By the way, my podman is not running in rootless, thank you very much, I will close this issue.

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

No branches or pull requests

2 participants