nicolargo / glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
http://nicolargo.github.io/glances/
Other
26.38k stars 1.5k forks source link

unexpected behaviour while running glances in docker with --export influxdb2 #2904

Open DonatiFilippo opened 1 month ago

DonatiFilippo commented 1 month ago

Check the bug Similar to this cases https://github.com/nicolargo/glances/issues/2407 https://github.com/nicolargo/glances/issues/2532

Describe the bug Docker container with official glances image fails with

2024-08-03T12:32:00.234191317Z   File "<frozen runpy>", line 88, in _run_code
2024-08-03T12:32:00.234194745Z   File "/app/glances/__main__.py", line 17, in <module>
2024-08-03T12:32:00.234423595Z     glances.main()
2024-08-03T12:32:00.234524572Z   File "/app/glances/__init__.py", line 173, in main
2024-08-03T12:32:00.234838456Z     start(config=core.get_config(), args=core.get_args())
2024-08-03T12:32:00.234872981Z   File "/app/glances/__init__.py", line 121, in start
2024-08-03T12:32:00.234967614Z     mode.serve_forever()
2024-08-03T12:32:00.234993285Z   File "/app/glances/standalone.py", line 184, in serve_forever
2024-08-03T12:32:00.235093322Z     while self.__serve_once():
2024-08-03T12:32:00.235124643Z           ^^^^^^^^^^^^^^^^^^^
2024-08-03T12:32:00.235135949Z   File "/app/glances/standalone.py", line 156, in __serve_once
2024-08-03T12:32:00.235217764Z     ret = not self.screen.update(self.stats, duration=adapted_refresh)
2024-08-03T12:32:00.235264633Z               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-03T12:32:00.235272340Z   File "/app/glances/outputs/glances_curses.py", line 1062, in update
2024-08-03T12:32:00.235585858Z     self.flush(stats, cs_status=cs_status)
2024-08-03T12:32:00.235614430Z   File "/app/glances/outputs/glances_curses.py", line 1043, in flush
2024-08-03T12:32:00.235955742Z     self.display(stats, cs_status=cs_status)
2024-08-03T12:32:00.235994054Z   File "/app/glances/outputs/glances_curses.py", line 512, in display
2024-08-03T12:32:00.236204342Z     __stat_display = self.__get_stat_display(stats, layer=cs_status)
2024-08-03T12:32:00.236259108Z                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-03T12:32:00.236265457Z   File "/app/glances/outputs/glances_curses.py", line 488, in __get_stat_display
2024-08-03T12:32:00.236456155Z     ret[p] = stats.get_plugin(p).get_stats_display(args=self.args, max_width=plugin_max_width)
2024-08-03T12:32:00.236513465Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-03T12:32:00.236521089Z   File "/app/glances/plugins/plugin/model.py", line 916, in get_stats_display
2024-08-03T12:32:00.236819359Z     ret = {'display': display_curse, 'msgdict': self.msg_curse(args, max_width=max_width), 'align': align_curse}
2024-08-03T12:32:00.236878935Z                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-03T12:32:00.236888928Z   File "/app/glances/plugins/smart/__init__.py", line 186, in msg_curse
2024-08-03T12:32:00.237002829Z     for smart_stat in sorted([i for i in device_stat.keys() if i != 'DeviceName'], key=int):
2024-08-03T12:32:00.237079108Z                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-08-03T12:32:00.237086357Z ValueError: invalid literal for int() with base 10: 'history_size'

To Reproduce Steps to reproduce the behavior:

  1. Start Glances with the following options '-d -C /glances/conf/glances.conf --export influxdb2'

NOTE: my glances.conf file has only the [influxdb2] section configured

Expected behavior Glances starting and exporting to influxdb2

Screenshots Not really

Environement (please complete the following information)

nicolargo commented 1 month ago

Hi @DonatiFilippo

there is a bug in the Smart plugin. I will try to correct it in the latest version, for the moment please disable the smart plugin with --disable-plugin smart:

glances:
    image: nicolargo/glances:ubuntu-latest-full

    container_name: monitor_glances_test
    restart: always
    pid: host
    privileged: true
    stdin_open: true
    tty: true
    environment:
      - "GLANCES_OPT=-d -C /glances/conf/glances.conf --export influxdb2 --disable-plugin smart"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock
      - /etc/os-release:/etc/os-release:ro
      - /etc/user/monitoring/glances/config/:/glances/conf/