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.97k stars 1.54k forks source link

Issue when display sensors with space in browser #2983

Closed nicolargo closed 2 weeks ago

nicolargo commented 1 month ago

Related to https://github.com/nicolargo/glances/issues/1289#issuecomment-2425084676

nicolargo commented 2 weeks ago

There is also an error if the sensor name contains a space.

Ex: columns=system:hr_name,load:min5,cpu:total,mem:percent,memswap:percent,sensors:value:Ambient 2

venv/bin/python -m glances -C conf/glances.conf --browser
Exception in thread Thread-4 (__update_stats):
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/home/nicolargo/dev/glances/glances/servers_list.py", line 149, in __update_stats
    self.__update_stats_rest(f'{server['uri']}/api/{__apiversion__}', server)
  File "/home/nicolargo/dev/glances/glances/servers_list.py", line 221, in __update_stats_rest
    server[server_key] = r.json()[column['field']]
                         ~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'value'
nicolargo commented 2 weeks ago

Corrected for both '_' and space chars in the develop branch.

Will be release in Glances 4.3.