glances icon indicating copy to clipboard operation
glances copied to clipboard

Apply alias to Duplicate sensor name

Open distributorofpain opened this issue 4 years ago • 2 comments

Description

For some reason, guessing cause the board is soo new, the sensor name for the system temp and CPU fan speed are the same when detected. I wanted to alias both with different names but if you put two entries in, you get an error ( this makes sense ). Would like to be able to alias a sensor type or add an option in the alias entry so that you can differentiate between a temp sensor and a fan speed.

For now, i just put a slash in the name....

image

Versions

  • Glances & psutil (glances -V): Glances v3.1.4.1 with PsUtil v5.7.0

  • Operating System (lsb_release -a): No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal

Logs

File "/usr/local/bin/glances", line 8, in <module> sys.exit(main()) File "/usr/local/lib/python3.8/dist-packages/glances/__init__.py", line 138, in main core = GlancesMain() File "/usr/local/lib/python3.8/dist-packages/glances/main.py", line 111, in __init__ self.args = self.parse_args() File "/usr/local/lib/python3.8/dist-packages/glances/main.py", line 264, in parse_args self.config = Config(args.conf_file) File "/usr/local/lib/python3.8/dist-packages/glances/config.py", line 111, in __init__ self.read() File "/usr/local/lib/python3.8/dist-packages/glances/config.py", line 146, in read self.parser.read_file(f) File "/usr/lib/python3.8/configparser.py", line 718, in read_file self._read(f, source) File "/usr/lib/python3.8/configparser.py", line 1093, in _read raise DuplicateOptionError(sectname, optname, configparser.DuplicateOptionError: While reading from '/etc/glances/glances.conf' [line 255]: option 'it8622 1_alias' in section 'sensors' already exists

distributorofpain avatar Jul 04 '20 02:07 distributorofpain

I think I'm having the same issue, I cannot alias fan1 and temp1 separately, which makes the list unreadable.

kattjevfel avatar Jul 26 '20 13:07 kattjevfel

Thanks for adding this as an enhancement!

distributorofpain avatar Jul 26 '20 20:07 distributorofpain

Done in the develop branch.

If a sensors has temperature and fan speed with the same name unit (example foo), it is possible to alias it using:

foo_temperature_core_alias=Alias for temp
foo_fan_speed_alias=Alias for fan speed

By default, the following configuration line will apply the alias name for all:

foo_core_alias=Alias for speed/temp

nicolargo avatar Sep 09 '22 10:09 nicolargo

Hi @nicolargo,

Sorry to comment on this closed ticket.

Is there a way to dissociate 2 sensors with exactly the same names ?

Example :

image

>>> psutil.sensors_temperatures()
{'acpitz': [shwtemp(label='', current=16.8, high=20.8, critical=20.8), shwtemp(label='', current=16.8, high=20.8, critical=20.8), shwtemp(label='', current=27.8, high=105.0, critical=105.0)], 'nvme': [shwtemp(label='Composite', current=36.85, high=81.85, critical=84.85), shwtemp(label='Sensor 1', current=36.85, high=65261.85, critical=65261.85), shwtemp(label='Sensor 2', current=40.85, high=65261.85, critical=65261.85), shwtemp(label='Composite', current=38.85, high=81.85, critical=84.85), shwtemp(label='Sensor 1', current=38.85, high=65261.85, critical=65261.85), shwtemp(label='Sensor 2', current=45.85, high=65261.85, critical=65261.85)], 'coretemp': [shwtemp(label='Package id 0', current=35.0, high=100.0, critical=100.0), shwtemp(label='Core 0', current=35.0, high=100.0, critical=100.0), shwtemp(label='Core 1', current=32.0, high=100.0, critical=100.0), shwtemp(label='Core 2', current=33.0, high=100.0, critical=100.0), shwtemp(label='Core 3', current=33.0, high=100.0, critical=100.0), shwtemp(label='Core 4', current=33.0, high=100.0, critical=100.0), shwtemp(label='Core 5', current=34.0, high=100.0, critical=100.0)]}

These are 2 strictly identical nvme ssd.

Herbs851 avatar Feb 10 '23 14:02 Herbs851

@Herbs851 See https://github.com/nicolargo/glances/issues/2280

nicolargo avatar Mar 05 '23 09:03 nicolargo

Thanks for the information !!!

Herbs851 avatar Mar 05 '23 10:03 Herbs851