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

FS module alias configuration do not taken into account everytime #3010

Open
abd3-13 opened this issue Nov 11, 2024 · 5 comments
Open

FS module alias configuration do not taken into account everytime #3010

abd3-13 opened this issue Nov 11, 2024 · 5 comments

Comments

@abd3-13
Copy link

abd3-13 commented Nov 11, 2024

Check the bug
Before filling this bug report, please search if a similar issue already exists.
In this case, just add a comment on this existing issue.

Describe the bug
I have tried to configure glances fs module to show only the alias, assign alias to other block but it seems to only work on root, tried the dev path, mount path, lvm path but its not assigning the alias, might be from the config as well, will put the tried paths and configs

[fs]
disable=False
show=*
alias=/:Root # tried them all using comma (/:Root,/mnt/My_Data:MyData) (/:Root,/dev/sdb:MyData)
sdb_alias=My_Data # tried this style as well
show_aliased_only=True # tried this, i don't think it knows this config

To Reproduce
Steps to reproduce the behavior:

  1. Start Glances with the following options '...'
  2. Press the key '....'
  3. See error

Expected behavior
to show the alias only for allowed block , like the pic below
fs_want

Screenshots
the below is the output i get with the configs i tried, can some show me the light
Screenshot 2024-11-11 151331

Environement (please complete the following information)

  • Operating System (lsb_release -a or OS name/version):
    this a debian lxc on proxmox 8.2.7
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
  • Glances & psutil versions:
Glances version:        4.2.1
Glances API version:    4
PsUtil version:         5.9.2
Log file:               /home/lab/.local/share/glances/glances.log
  • How do you install Glances (Pypi package, script, package manager, source): Pypi package
  • Glances test:
 ===============================================================================
Glances 4.2.1 (/usr/local/lib/python3.9/dist-packages/glances/__init__.py)
Python 3.9.2 (/usr/bin/python3)
PsUtil 5.9.2 (/home/lab/.local/lib/python3.9/site-packages/psutil/__init__.py)
===============================================================================
alert         [OK]    0.00003s 
[]
amps          [OK]    0.01171s key=name 
[{'count': 11,
  'countmax': 20.0,
  'countmin': None,
  'key': 'name',
  'name': 'Python',
  'refresh': 3.0,
  'regex': True,
  'result': 'CPU: 0.0% | MEM: 8.8%',
  'timer': 2.688173294067383}, ...]
cloud         [NA]
connections   [NA]
containers    [OK]    0.39112s key=name 
[{'command': '/usr/bin/supervisord -c /etc/supervisor/supervisord.conf',
  'cpu_percent': 1.4893548387096773,
  'created': '2024-06-22T10:19:00.103275076Z',
  'engine': 'docker',
  'id': '5c527004116ed51ef23580a021b78f03cb31c72b65faf13893d6af9a98087391',
  'image': ('delta.lab/jre_runner:latest',),
  'io_rx': 0,
  'io_wx': 0,
  'key': 'name',
  'memory_percent': None,
  'memory_usage': 146087936,
  'name': 'jre_runner',
  'network_rx': 212,
  'network_tx': 0,
  'status': 'running',
  'uptime': 'yesterday'}, ...]
core          [OK]    0.00447s 
{'log': 3, 'phys': 2}
cpu           [OK]    0.00314s 
{'cpucore': 3,
 'ctx_switches': 0,
 'ctx_switches_gauge': 808539588,
 'guest': 0.0,
 'idle': 78.5,
 'interrupts': 0,
 'interrupts_gauge': 303786982,
 'iowait': 0.1,
 'irq': 0.0,
 'nice': 0.0,
 'soft_interrupts': 0,
 'soft_interrupts_gauge': 131757838,
 'steal': 0.0,
 'syscalls': 0,
 'syscalls_gauge': 0,
 'system': 9.8,
 'time_since_update': 2.4562344551086426,
 'total': 21.3,
 'user': 11.5}
diskio        [OK]    0.00213s key=disk_name 
[{'alias': 'Root',
  'disk_name': 'loop0',
  'key': 'disk_name',
  'read_bytes': 0,
  'read_bytes_gauge': 22464631296,
  'read_count': 0,
  'read_count_gauge': 1168032,
  'time_since_update': 3.100336790084839,
  'write_bytes': 0,
  'write_bytes_gauge': 9101864960,
  'write_count': 0,
  'write_count_gauge': 1489292}, ...]
folders       [NA]
fs            [OK]    0.00154s key=mnt_point 
[{'alias': 'Root',
  'device_name': '/dev/loop0',
  'free': 12721614848,
  'fs_type': 'ext4',
  'key': 'mnt_point',
  'mnt_point': '/',
  'percent': 78.9,
  'size': 63224987648,
  'used': 47673434112}, ...]
gpu           [OK]    0.00007s 
[]
help          [OK]    0.00001s 
None
ip            [OK]    0.00100s 
{'address': '***',
 'gateway': '***',
 'mask': '***',
 'mask_cidr': '***',
 'public_address': '***',
 'public_info_human': '***'}
irq           [NA]
load          [OK]    0.00066s 
{'cpucore': 3, 'min1': 1.45, 'min15': 1.02, 'min5': 1.14}
mem           [OK]    0.00134s 
{'active': 1528397824,
 'available': 1516687360,
 'buffers': 0,
 'cached': 1332813824,
 'free': 1516687360,
 'inactive': 1278693376,
 'percent': 54.4,
 'shared': 91213824,
 'total': 3328180224,
 'used': 1811492864}
memswap       [OK]    0.00144s 
{'free': 1477169152,
 'percent': 65.6,
 'sin': 11573211136,
 'sout': 14894284800,
 'time_since_update': 3.1112518310546875,
 'total': 4294963200,
 'used': 2817794048}
network       [OK]    0.00323s key=interface_name 
[{'alias': None,
  'bytes_all': 27474,
  'bytes_all_gauge': 1103567144,
  'bytes_all_rate_per_sec': 11317.0,
  'bytes_recv': 4064,
  'bytes_recv_gauge': 583263409,
  'bytes_recv_rate_per_sec': 1674.0,
  'bytes_sent': 23410,
  'bytes_sent_gauge': 520303735,
  'bytes_sent_rate_per_sec': 9643.0,
  'interface_name': 'eth0',
  'key': 'interface_name',
  'speed': 10485760000,
  'time_since_update': 2.4274845123291016}, ...]
now           [OK]    0.00008s 
{'custom': '2024-11-11 15:40:53 EAT', 'iso': '2024-11-11T15:40:53+03:00'}
percpu        [OK]    0.00117s key=cpu_number 
[{'cpu_number': 0,
  'dpc': None,
  'guest': 0.0,
  'guest_nice': 0.0,
  'idle': 76.9,
  'interrupt': None,
  'iowait': 0.4,
  'irq': 0.0,
  'key': 'cpu_number',
  'nice': 0.0,
  'softirq': 0.0,
  'steal': 0.0,
  'system': 10.5,
  'total': 23.1,
  'user': 12.2}, ...]
ports         [NA]
processcount  [OK]    0.16571s 
{'pid_max': 0, 'running': 1, 'sleeping': 290, 'thread': 1736, 'total': 291}
processlist   [OK]    0.00063s 
[]
psutilversion [OK]    0.00007s 
'5.9.2'
quicklook     [OK]    0.00339s 
{'cpu': 21.3,
 'cpu_hz': 2266000000.0,
 'cpu_hz_current': 2212606250.0000005,
 'cpu_log_core': 3,
 'cpu_name': 'Intel(R) Core(TM) i3 CPU       M 350  @ 2.27GHz',
 'cpu_phys_core': 2,
 'load': 34.0,
 'mem': 54.5,
 'percpu': [{...}, {...}, {...}],
 'swap': 65.6}
raid          [NA]
sensors       [OK]    0.00002s key=label 
[{'critical': 90,
  'key': 'label',
  'label': 'Core 0',
  'type': <SensorType.CPU_TEMP: 'temperature_core'>,
  'unit': 'C',
  'value': 58,
  'warning': 80}, ...]
smart         [NA]
system        [OK]    0.00002s 
{'hostname': 'delta',
 'hr_name': 'Debian GNU/Linux 11 64bit / Linux 6.8.4-3-pve',
 'linux_distro': 'Debian GNU/Linux 11',
 'os_name': 'Linux',
 'os_version': '6.8.4-3-pve',
 'platform': '64bit'}
uptime        [OK]    0.00074s 
{'seconds': 100900}
version       [OK]    0.00006s 
'4.2.1'
vms           [NA]
wifi          [NA]
===============================================================================
Total time to update all stats: 0.59935s
===============================================================================

Additional context
i am new to issues postings, please do let me know if any mistake i made

@abd3-13
Copy link
Author

abd3-13 commented Nov 11, 2024

here some info on the file systems
lsblk
mount

@nicolargo nicolargo changed the title fs module alias configuration FS module alias configuration do not taken into account everytime Nov 11, 2024
@nicolargo
Copy link
Owner

Hi @abd3-13

Patch merged into the develop branch.

Can you test it ?

If it is ok, will be release in next version.

@abd3-13
Copy link
Author

abd3-13 commented Nov 15, 2024

Hi @nicolargo

sorry was busy, will check the branch and update you

@abd3-13
Copy link
Author

abd3-13 commented Nov 15, 2024

Hi @nicolargo

i have tried the change you made on the fs python file, added the alias on the config as well by still the same it only remove the path (/dev/sdb to sdb ), i can't still assign alias to the blocks, here is an asciinema,

should i remove the installed glances and install develop branch (actually how? do git clone?)?

@abd3-13
Copy link
Author

abd3-13 commented Nov 15, 2024

was fiddling around to see if something can be done, i tried to see if the alias was retrieved but only when "/:[name]" is used the alias is retrieved the others are discarded (if [/:Root,/mnt/My_Data:DataHDD] after , it is droped also if it's other then "/" like "/mnt..." drooped

        # Filesystem list (sorted by name)
        for i in sorted(self.stats, key=operator.itemgetter(self.get_key())):
            # New line
            ret.append(self.curse_new_line())
            mnt_point = i['alias'] if 'alias' in i else i['mnt_point']

#tempory glimpse on what is happing
            with open('out.txt', 'a') as f:
                print(i, file=f)

            if len(mnt_point) + len(i['device_name'].split('/')[-1]) <= name_max_width - 3:
                # If possible concatenate mode info... Glances touch inside :)
                #mnt_point = i['mnt_point'] + ' (' + i['device_name'].split('/')[-1] + ')'
                mnt_point += '' # don't show device_name, can also remove if
            elif len(mnt_point) > name_max_width:
                mnt_point = mnt_point[:name_max_width] + '_'
# set the name to the last array value until alias works
            mnt_point = mnt_point.split('/')[-1]
            msg = '{:{width}}'.format(nativestr(mnt_point), width=name_max_width + 1)

out.txt content

{'device_name': '/dev/loop0', 'fs_type': 'ext4', 'mnt_point': '/', 'size': 63224987648, 'used': 48191094784, 'free': 12203954176, 'percent': 79.8, 'key': 'mnt_point', 'alias': 'Root'}
{'device_name': '/dev/mapper/pve-root', 'fs_type': 'ext4', 'mnt_point': '/mnt/HDD_Port', 'size': 230401245184, 'used': 89341648896, 'free': 130944774144, 'percent': 40.6, 'key': 'mnt_point'}
{'device_name': '/dev/sdb', 'fs_type': 'ext4', 'mnt_point': '/mnt/My_Data', 'size': 983351140352, 'used': 539912679424, 'free': 393411440640, 'percent': 57.8, 'key': 'mnt_point'}

mnt_point with value "/" only has alias but config is
alias=/:Root,/mnt/My_Data:DataHDD

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