Skip to content

REST API doesnt start on MacOS #3242

Closed
Closed
@fosron

Description

@fosron

Describe the bug

REST API doesnt start on MacOS. Fresh install of glances.

To Reproduce
Steps to reproduce the behavior:

  1. Start Glances with the following options -w

Expected behavior

It should start REST API endpoint.

glances -w
Glances Web User Interface started on http://0.0.0.0:61208/
Glances RESTful API Server started on http://0.0.0.0:61208/api/4
Traceback (most recent call last):
  File "/opt/homebrew/bin/glances", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/glances/__init__.py", line 190, in main
    start(config=core.get_config(), args=core.get_args())
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/glances/__init__.py", line 149, in start
    mode = GlancesMode(config=config, args=args)
  File "/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/glances/webserver.py", line 35, in __init__
    self.web = GlancesRestfulApi(config=config, args=args)
               ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/glances/outputs/glances_restful_api.py", line 168, in __init__
    self.autodiscover_client = GlancesAutoDiscoverClient(socket.gethostname().split('.', 1)[0], self.args)
                               ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/glances/servers_list_dynamic.py", line 196, in __init__
    zeroconf_bind_address = self.find_active_ip_address()
  File "/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/glances/servers_list_dynamic.py", line 247, in find_active_ip_address
    gateway_itf = netifaces.gateways()[netifaces.AF_INET][0][1]
                  ~~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/netifaces/__init__.py", line 232, in gateways
    raise NotImplementedError("No implementation for `gateways()` yet")
NotImplementedError: No implementation for `gateways()` yet

Environment (please complete the following information)

  • Operating System (lsb_release -a or OS name/version): macOS 15.5 (24F74)
  • Glances & psutil versions: Glances version: 4.3.3 Glances API version: 4 PsUtil version: 7.0.0 Log file: /Users/fosron/.local/share/glances/glances.log
  • How do you install Glances (Pypi package, script, package manager, source): brew
  • Glances test:
===============================================================================
Glances 4.3.3 (/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/glances/__init__.py)
Python 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python)
PsUtil 7.0.0 (/opt/homebrew/Cellar/glances/4.3.3/libexec/lib/python3.13/site-packages/psutil/__init__.py)
===============================================================================
alert         [OK]    0.00006s
[{'avg': 82.40242004394531,
  'begin': 1752142158,
  'count': 1,
  'desc': '',
  'end': -1,
  'global_msg': 'High swap (paging) usage',
  'max': 82.40242004394531,
  'min': 82.40242004394531,
  'sort': 'memory_percent',
  'state': 'WARNING',
  'sum': 82.40242004394531,
  'top': [],
  'type': 'MEM'},
 {'avg': 92.7410888671875,
  'begin': 1752142158,
  'count': 1,
  'desc': '',
  'end': -1,
  'global_msg': 'EVENTS history',
  'max': 92.7410888671875,
  'min': 92.7410888671875,
  'sort': 'memory_percent',
  'state': 'CRITICAL',
  'sum': 92.7410888671875,
  'top': [],
  'type': 'MEMSWAP'}]
amps          [OK]    0.00016s key=name
[{'count': 0,
  'countmax': None,
  'countmin': 1.0,
  'key': 'name',
  'name': 'Dropbox',
  'refresh': 3.0,
  'regex': True,
  'result': None,
  'timer': 2.3977291584014893}, ...]
cloud         [NA]
connections   [NA]
containers    [OK]    0.02751s key=name
[{'command': 'start-container',
  'cpu_percent': 0.3007984031936128,
  'created': '2025-07-10T09:00:38.02442922Z',
  'engine': 'docker',
  'id': 'a08c3075240a141618204c93885410e4a8e4c4acfd35901b249604ebf16284c5',
  'image': ('sail-8.4/app:latest',),
  'io_rx': None,
  'io_wx': None,
  'key': 'name',
  'memory_inactive_file': 94601216,
  'memory_limit': 8384065536,
  'memory_percent': None,
  'memory_usage': 594636800,
  'name': 'document-ingestion-poc-laravel.test-1',
  'network_rx': None,
  'network_tx': None,
  'status': 'running',
  'uptime': 'an hour'}, ...]
core          [OK]    0.00003s
{'log': 10, 'phys': 10}
cpu           [OK]    0.00013s
{'cpucore': 10,
 'ctx_switches': 0,
 'ctx_switches_gauge': 7142,
 'ctx_switches_rate_per_sec': 0,
 'idle': 71.9,
 'interrupts': 0,
 'interrupts_gauge': 185005,
 'interrupts_rate_per_sec': 0,
 'nice': 0.0,
 'soft_interrupts': 0,
 'soft_interrupts_gauge': 2337808510,
 'soft_interrupts_rate_per_sec': 0,
 'syscalls': 0,
 'syscalls_gauge': 182756,
 'syscalls_rate_per_sec': 0,
 'system': 11.8,
 'time_since_update': 2.21358323097229,
 'total': 28.1,
 'user': 16.2}
diskio        [OK]    0.00057s key=disk_name
[{'disk_name': 'disk0',
  'key': 'disk_name',
  'read_bytes': 0,
  'read_bytes_gauge': 6460977995776,
  'read_bytes_rate_per_sec': 0,
  'read_count': 0,
  'read_count_gauge': 369222211,
  'read_count_rate_per_sec': 0,
  'time_since_update': 2.214796781539917,
  'write_bytes': 0,
  'write_bytes_gauge': 1670912311296,
  'write_bytes_rate_per_sec': 0,
  'write_count': 0,
  'write_count_gauge': 77034971,
  'write_count_rate_per_sec': 0}, ...]
folders       [OK]    0.00002s
[]
fs            [OK]    0.00034s key=mnt_point
[{'device_name': '/dev/disk3s1s1',
  'free': 148407607296,
  'fs_type': 'apfs',
  'key': 'mnt_point',
  'mnt_point': '/',
  'options': 'ro,local,rootfs,dovolfs,journaled,multilabel',
  'percent': 7.0,
  'size': 494384795648,
  'used': 11247730688}, ...]
gpu           [OK]    0.00002s
[]
help          [OK]    0.00000s
None
ip            [OK]    0.00001s
{}
irq           [NA]
load          [OK]    0.00002s
{'cpucore': 10, 'min1': 4.013671875, 'min15': 5.87451171875, 'min5': 4.6455078125}
mem           [OK]    0.00003s
{'active': 3061186560,
 'available': 3111665664,
 'free': 3111665664,
 'inactive': 2994323456,
 'percent': 81.9,
 'total': 17179869184,
 'used': 14068203520,
 'wired': 3031121920}
memswap       [OK]    0.00002s
{'free': 779419648,
 'percent': 92.7,
 'sin': 3009787658240,
 'sout': 140817088512,
 'time_since_update': 2.2189769744873047,
 'total': 10737418240,
 'used': 9957998592}
network       [OK]    0.00176s key=interface_name
[{'alias': None,
  'bytes_all': 32768,
  'bytes_all_gauge': 503095296,
  'bytes_all_rate_per_sec': 16047.0,
  'bytes_recv': 16384,
  'bytes_recv_gauge': 251547648,
  'bytes_recv_rate_per_sec': 8023.0,
  'bytes_sent': 16384,
  'bytes_sent_gauge': 251547648,
  'bytes_sent_rate_per_sec': 8023.0,
  'interface_name': 'lo0',
  'key': 'interface_name',
  'speed': 0,
  'time_since_update': 2.0420007705688477}, ...]
now           [OK]    0.00004s
{'custom': '2025-07-10 13:09:20 EEST', 'iso': '2025-07-10T13:09:20+03:00'}
percpu        [OK]    0.00015s key=cpu_number
[{'cpu_number': 0,
  'dpc': None,
  'guest': None,
  'guest_nice': None,
  'idle': 57.3,
  'interrupt': None,
  'iowait': None,
  'irq': None,
  'key': 'cpu_number',
  'nice': 0.0,
  'softirq': None,
  'steal': None,
  'system': 18.2,
  'total': 42.7,
  'user': 24.5}, ...]
ports         [OK]    0.00000s
[]
processcount  [OK]    0.05019s
{'pid_max': 0, 'running': 777, 'sleeping': 0, 'thread': 4669, 'total': 777}
processlist   [OK]    0.00019s
[]
programlist   [OK]    0.00215s
[]
psutilversion [OK]    0.00002s
'7.0.0'
quicklook     [OK]    0.00008s
{'cpu': 28.1,
 'cpu_hz': 3504000000.0,
 'cpu_hz_current': 3504000000.0,
 'cpu_log_core': 10,
 'cpu_name': 'CPU arm',
 'cpu_phys_core': 10,
 'load': 58.7,
 'mem': 81.9,
 'percpu': [{...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}],
 'swap': 92.7}
raid          [NA]
sensors       [OK]    0.00000s key=label
[{'key': 'label', 'label': 'Battery', 'status': 'Charging', 'type': 'battery', 'unit': '%', 'value': 100}, ...]
smart         [NA]
system        [OK]    0.00000s
{'hostname': 'Tautvydass-MacBook-Pro.local',
 'hr_name': 'Darwin 15.5 64bit',
 'os_name': 'Darwin',
 'os_version': '15.5',
 'platform': '64bit'}
uptime        [OK]    0.00002s
{'seconds': 1738320}
version       [OK]    0.00001s
'4.3.3'
vms           [NA]
wifi          [OK]    0.00001s
[]
===============================================================================
Total time to update all stats: 0.08663s
===============================================================================

Additional context

2025-07-10 13:04:38,421 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:04:38,422 -- INFO -- Start Glances 4.3.3
2025-07-10 13:04:38,422 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:04:38,426 -- INFO -- Read configuration file '/opt/homebrew/Cellar/glances/4.3.3/libexec/share/doc/glances/glances.conf'
2025-07-10 13:04:42,004 -- INFO -- Start GlancesWebServer mode
2025-07-10 13:04:42,458 -- WARNING -- Netifaces2 should be installed in your Python environment, IP plugin is disabled
2025-07-10 13:04:42,694 -- INFO -- The WebUI is disable (--disable-webui)
2025-07-10 13:04:42,694 -- INFO -- Glances RESTful API Server started on http://0.0.0.0:61208/api/4
2025-07-10 13:04:42,698 -- INFO -- Autodiscover is enabled with service name Tautvydass-MacBook-Pro
2025-07-10 13:04:51,440 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:04:51,441 -- INFO -- Start Glances 4.3.3
2025-07-10 13:04:51,441 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:04:51,445 -- INFO -- Read configuration file '/opt/homebrew/Cellar/glances/4.3.3/libexec/share/doc/glances/glances.conf'
2025-07-10 13:04:51,845 -- INFO -- Start GlancesWebServer mode
2025-07-10 13:04:51,950 -- WARNING -- Netifaces2 should be installed in your Python environment, IP plugin is disabled
2025-07-10 13:04:52,101 -- INFO -- The WebUI is disable (--disable-webui)
2025-07-10 13:04:52,101 -- INFO -- Glances RESTful API Server started on http://0.0.0.0:61208/api/4
2025-07-10 13:04:52,105 -- INFO -- Autodiscover is enabled with service name Tautvydass-MacBook-Pro
2025-07-10 13:05:23,927 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:05:23,928 -- INFO -- Start Glances 4.3.3
2025-07-10 13:05:23,928 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:05:23,932 -- INFO -- Read configuration file '/opt/homebrew/Cellar/glances/4.3.3/libexec/share/doc/glances/glances.conf'
2025-07-10 13:05:24,022 -- INFO -- Start GlancesStandalone mode
2025-07-10 13:05:24,180 -- WARNING -- Netifaces2 should be installed in your Python environment, IP plugin is disabled
2025-07-10 13:05:30,396 -- INFO -- Glances stopped gracefully
2025-07-10 13:05:32,869 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:05:32,869 -- INFO -- Start Glances 4.3.3
2025-07-10 13:05:32,869 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:05:32,873 -- INFO -- Read configuration file '/opt/homebrew/Cellar/glances/4.3.3/libexec/share/doc/glances/glances.conf'
2025-07-10 13:05:33,146 -- INFO -- Start GlancesWebServer mode
2025-07-10 13:05:33,210 -- WARNING -- Netifaces2 should be installed in your Python environment, IP plugin is disabled
2025-07-10 13:05:33,336 -- INFO -- Glances Web User Interface started on http://0.0.0.0:61208/
2025-07-10 13:05:33,336 -- INFO -- Glances RESTful API Server started on http://0.0.0.0:61208/api/4
2025-07-10 13:05:33,340 -- INFO -- Autodiscover is enabled with service name Tautvydass-MacBook-Pro
2025-07-10 13:05:44,647 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:05:44,648 -- INFO -- Start Glances 4.3.3
2025-07-10 13:05:44,648 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:05:44,654 -- INFO -- Read configuration file '/opt/homebrew/Cellar/glances/4.3.3/libexec/share/doc/glances/glances.conf'
2025-07-10 13:05:44,908 -- INFO -- Start GlancesWebServer mode
2025-07-10 13:05:45,036 -- WARNING -- Netifaces2 should be installed in your Python environment, IP plugin is disabled
2025-07-10 13:05:46,916 -- INFO -- Glances Web User Interface started on http://0.0.0.0:61208/
2025-07-10 13:05:46,916 -- INFO -- Glances RESTful API Server started on http://0.0.0.0:61208/api/4
2025-07-10 13:05:46,922 -- INFO -- Autodiscover is enabled with service name Tautvydass-MacBook-Pro
2025-07-10 13:06:50,985 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:06:50,986 -- INFO -- Start Glances 4.3.3
2025-07-10 13:06:50,986 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:06:50,990 -- INFO -- Read configuration file '/opt/homebrew/Cellar/glances/4.3.3/libexec/share/doc/glances/glances.conf'
2025-07-10 13:06:51,287 -- INFO -- Start GlancesWebServer mode
2025-07-10 13:06:51,474 -- WARNING -- Netifaces2 should be installed in your Python environment, IP plugin is disabled
2025-07-10 13:06:51,642 -- INFO -- Glances Web User Interface started on http://0.0.0.0:61208/
2025-07-10 13:06:51,642 -- INFO -- Glances RESTful API Server started on http://0.0.0.0:61208/api/4
2025-07-10 13:06:51,648 -- INFO -- Autodiscover is enabled with service name Tautvydass-MacBook-Pro
2025-07-10 13:07:06,588 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:07:06,589 -- INFO -- Start Glances 4.3.3
2025-07-10 13:07:06,589 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:07:10,116 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:07:10,116 -- INFO -- Start Glances 4.3.3
2025-07-10 13:07:10,117 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:09:18,353 -- WARNING -- PsUtil can not grab processes io_counters ('Process' object has no attribute 'io_counters')
2025-07-10 13:09:18,354 -- INFO -- Start Glances 4.3.3
2025-07-10 13:09:18,355 -- INFO -- CPython 3.13.5 (/opt/homebrew/Cellar/glances/4.3.3/libexec/bin/python) and psutil 7.0.0 detected
2025-07-10 13:09:18,359 -- INFO -- Read configuration file '/opt/homebrew/Cellar/glances/4.3.3/libexec/share/doc/glances/glances.conf'
2025-07-10 13:09:18,454 -- INFO -- Start GlancesStandalone mode
2025-07-10 13:09:18,666 -- WARNING -- Netifaces2 should be installed in your Python environment, IP plugin is disabled
2025-07-10 13:09:18,847 -- INFO -- Issue mode is ON

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions