netenglabs / suzieq

Using network observability to operate and design healthier networks
https://www.stardustsystems.net/
Apache License 2.0
775 stars 105 forks source link

[Bug]: sq-poller failed to run on MacOS in Docker #957

Open greenfox878 opened 1 month ago

greenfox878 commented 1 month ago

Suzieq version

0.23.0

Install Type

container

Python version

whatever is bundled with your container

Impacted component

sq-poller

Steps to Reproduce

docker run -it -v ./parquet-db:/home/suzieq/parquet -v ./suzieq-cfg.yml:/home/suzieq/.suzieq/suzieq-cfg.yml --name sq-poller netenglabs/suzieq:0.23.0
suzieq@40e46586b5f9:~$ sq-poller -I /home/suzieq/.suzieq/suzieq-cfg.yml

Expected Behavior

sq-poller run w/o crash

Observed Behavior

sq-poller crashed with the error:

2024-06-01 15:48:55,445 - suzieq.poller.controller - WARNING - log level INFO
2024-06-01 15:48:55,446 - suzieq.poller.controller - CRITICAL - 'NoneType' object has no attribute 'min'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/suzieq/poller/sq_poller.py", line 50, in start_controller
    log_suzieq_info('Poller Controller', logger, show_more=True)
  File "/usr/local/lib/python3.8/site-packages/suzieq/shared/utils.py", line 1213, in log_suzieq_info
    cpu_info += f'freq. {cpu_freq.min:.2f}Mhz - {cpu_freq.max:.2f}Mhz'
AttributeError: 'NoneType' object has no attribute 'min'

Screenshots

Additional Context

Actually, it is not an suzieq bug, but psutil bug [macOS] cpu_freq() fails on arm64 The issue appears inside docker container even on latest psutil version:

suzieq@5ac8068b56c0:~$ pip freeze | grep psu
psutil==5.9.8
suzieq@5ac8068b56c0:~$ ipython
Python 3.8.14 (default, Oct  5 2022, 11:57:30)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.12.2 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import psutil
In [2]: psutil.cpu_freq()
In [3]: exit
suzieq@5ac8068b56c0:~$ python -V
Python 3.8.14
suzieq@5ac8068b56c0:~$
greenfox878 commented 1 month ago

MacOS 12.7.4 (M1) Docker Desktop 4.30.0

ddutt commented 1 month ago

I don't believe this is the first of your problems running suzieq on a non-x86-64 architecture. we don't have a mac m1/m2/m3 box to test and make changes to, unfortunately.

ddutt commented 1 month ago

Can you find an x86_64 arch box to test suzieq with?

greenfox878 commented 1 month ago

I removed the psutil.cpu_freq() call and built suzieq docker image on my laptop and so far all works fine. It's enough for testing. Of course, production will run on x86_64. Sorry for bothering!