proxtop icon indicating copy to clipboard operation
proxtop copied to clipboard

proxtop crashes if two containers have the same hostname

Open lechercheur123 opened this issue 3 years ago • 4 comments

Hello,

proxtop crashes if my cluster have 2 containers with the same hostname (but different domain name). i get this error:

Traceback (most recent call last):
  File "/usr/local/bin/proxtop", line 487, in <module>
    main()
  File "/usr/local/bin/proxtop", line 478, in __call__
    vms, crap = d.fetch()
  File "/usr/local/bin/proxtop", line 153, in fetch
    self._process(vm)
  File "/usr/local/bin/proxtop", line 202, in _process
    self._add_vm(vm)
  File "/usr/local/bin/proxtop", line 214, in _add_vm
    assert vm['name'] not in self._uuid_map, (vm['name'], self._uuid_map)
AssertionError: ('mail', {'librenms': None, 'bird': None, 'lg': None, 'as-stat': None, 'mail': None, 'powerdns': None, 'web': None, 'mariadb': None, 'gogs': None, 'deluge': None, 'mumble': None, 'urbackup': None, 'raduis1-pomme': None, 'powerdns-authoritaire': None, 'cageot': None, 'apt-cache': None, 'dhcp1-pomme': None, 'powerdns2': None})

(In my case, I have two containers withe "mail" as hostname).

If I rename one of the two container hostname with "mail2", it works.

lechercheur123 avatar Feb 17 '22 11:02 lechercheur123

proxtop indeed assumes that VM names are unique.

I do not recall ever having seen a separate option for the domain name. We use fully qualified (or at least unique) hostnames everywhere.

Do you get a separate field in vm that holds a domain name? Is that for (LXC) containers only?

wdoekes avatar Feb 17 '22 11:02 wdoekes

Hi,

I only use LXC, so I don't know.

Here is where I set the domain name:

Capture

lechercheur123 avatar Feb 17 '22 11:02 lechercheur123

Okay, and if you adjust this line in the python script:

assert vm['name'] not in self._uuid_map, (vm['name'], self._uuid_map)

Change it to:

assert vm['name'] not in self._uuid_map, (vm['name'], vm, self._uuid_map)

The new error output would help in creating a fix.

wdoekes avatar Feb 17 '22 11:02 wdoekes

Done

Traceback (most recent call last):
  File "/usr/local/bin/proxtop", line 488, in <module>
    main()
  File "/usr/local/bin/proxtop", line 479, in __call__
    vms, crap = d.fetch()
  File "/usr/local/bin/proxtop", line 153, in fetch
    self._process(vm)
  File "/usr/local/bin/proxtop", line 202, in _process
    self._add_vm(vm)
  File "/usr/local/bin/proxtop", line 215, in _add_vm
    assert vm['name'] not in self._uuid_map, (vm['name'], vm, self._uuid_map)
AssertionError: ('mail', {'diskwrite': 5761458176, 'vmid': 118, 'hastate': 'started', 'maxmem': 4294967296, 'id': 'lxc/118', 'cpu': 0.00129016455403691, 'disk': 7977697280, 'netout': 27774775283, 'status': 'running', 'uptime': 5150536, 'maxcpu': 2, 'maxdisk': 17179869184, 'diskread': 1063043072, 'name': 'mail', 'netin': 2845471173, 'mem': 2019786752, 'pool': 'Test', 'type': 'lxc', 'node': 'ml350p-2-proxmox-1', 'template': 0}, {'librenms': None, 'bird': None, 'lg': None, 'as-stat': None, 'mail': None, 'powerdns': None, 'web': None, 'mariadb': None, 'gogs': None, 'deluge': None, 'mumble': None, 'urbackup': None, 'raduis1-pomme': None, 'powerdns-authoritaire': None, 'cageot': None, 'apt-cache': None, 'dhcp1-pomme': None, 'powerdns2': None})
sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('127.0.0.1', 56880), raddr=('127.0.0.1', 8006)>

lechercheur123 avatar Feb 17 '22 11:02 lechercheur123