Add missing Python libraries for backend functionality
Update the Python dependency installation script to include `httpx` and `joblib`, and enhance verification checks for installed modules. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: f0a704c9-cac4-4144-8f26-c6066459f615 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/n4Q2eeE
This commit is contained in:
parent
8d4896df76
commit
e9e74f9944
@ -0,0 +1,124 @@
|
||||
|
||||
Status Servizi:
|
||||
● ids-ml-backend.service - IDS ML Backend (FastAPI)
|
||||
Loaded: loaded (/etc/systemd/system/ids-ml-backend.service; enabled; preset: disabled)
|
||||
Active: activating (auto-restart) (Result: exit-code) since Sat 2025-11-22 10:55:17 CET; 348ms ago
|
||||
Process: 15380 ExecStart=/opt/ids/python_ml/venv/bin/python3 main.py (code=exited, status=1/FAILURE)
|
||||
Main PID: 15380 (code=exited, status=1/FAILURE)
|
||||
CPU: 3.435s
|
||||
|
||||
● ids-syslog-parser.service - IDS Syslog Parser (Network Logs Processor)
|
||||
Loaded: loaded (/etc/systemd/system/ids-syslog-parser.service; enabled; preset: disabled)
|
||||
Active: active (running) since Sat 2025-11-22 10:55:15 CET; 2s ago
|
||||
Main PID: 15405 (python3)
|
||||
Tasks: 1 (limit: 100409)
|
||||
Memory: 10.7M (max: 1.0G available: 1013.2M)
|
||||
CPU: 324ms
|
||||
CGroup: /system.slice/ids-syslog-parser.service
|
||||
└─15405 /opt/ids/python_ml/venv/bin/python3 syslog_parser.py
|
||||
|
||||
|
||||
╔═══════════════════════════════════════════════╗
|
||||
║ ✅ SYSTEMD SERVICES CONFIGURATI ║
|
||||
╚═══════════════════════════════════════════════╝
|
||||
|
||||
COMANDI UTILI:
|
||||
systemctl status ids-ml-backend - Status ML Backend
|
||||
systemctl status ids-syslog-parser - Status Syslog Parser
|
||||
systemctl restart ids-ml-backend - Restart ML Backend
|
||||
systemctl restart ids-syslog-parser - Restart Syslog Parser
|
||||
journalctl -u ids-ml-backend -f - Log ML Backend
|
||||
journalctl -u ids-syslog-parser -f - Log Syslog Parser
|
||||
|
||||
[root@ids ids]# # Verifica status servizi
|
||||
systemctl status ids-ml-backend
|
||||
systemctl status ids-syslog-parser
|
||||
|
||||
# Entrambi dovrebbero mostrare "Active: active (running)"
|
||||
● ids-ml-backend.service - IDS ML Backend (FastAPI)
|
||||
Loaded: loaded (/etc/systemd/system/ids-ml-backend.service; enabled; preset: disabled)
|
||||
Active: activating (auto-restart) (Result: exit-code) since Sat 2025-11-22 10:55:17 CET; 4s ago
|
||||
Process: 15380 ExecStart=/opt/ids/python_ml/venv/bin/python3 main.py (code=exited, status=1/FAILURE)
|
||||
Main PID: 15380 (code=exited, status=1/FAILURE)
|
||||
CPU: 3.435s
|
||||
● ids-syslog-parser.service - IDS Syslog Parser (Network Logs Processor)
|
||||
Loaded: loaded (/etc/systemd/system/ids-syslog-parser.service; enabled; preset: disabled)
|
||||
Active: active (running) since Sat 2025-11-22 10:55:15 CET; 5s ago
|
||||
Main PID: 15405 (python3)
|
||||
Tasks: 1 (limit: 100409)
|
||||
Memory: 10.7M (max: 1.0G available: 1013.2M)
|
||||
CPU: 627ms
|
||||
CGroup: /system.slice/ids-syslog-parser.service
|
||||
└─15405 /opt/ids/python_ml/venv/bin/python3 syslog_parser.py
|
||||
|
||||
Nov 22 10:55:15 ids.alfacom.it systemd[1]: Started IDS Syslog Parser (Network Logs Processor).
|
||||
[root@ids ids]# systemctl status ids-syslog-parser
|
||||
● ids-syslog-parser.service - IDS Syslog Parser (Network Logs Processor)
|
||||
Loaded: loaded (/etc/systemd/system/ids-syslog-parser.service; enabled; preset: disabled)
|
||||
Active: active (running) since Sat 2025-11-22 10:55:15 CET; 14s ago
|
||||
Main PID: 15405 (python3)
|
||||
Tasks: 1 (limit: 100409)
|
||||
Memory: 10.8M (max: 1.0G available: 1013.1M)
|
||||
CPU: 1.268s
|
||||
CGroup: /system.slice/ids-syslog-parser.service
|
||||
└─15405 /opt/ids/python_ml/venv/bin/python3 syslog_parser.py
|
||||
|
||||
Nov 22 10:55:15 ids.alfacom.it systemd[1]: Started IDS Syslog Parser (Network Logs Processor).
|
||||
[root@ids ids]# systemctl status ids-ml-backend
|
||||
● ids-ml-backend.service - IDS ML Backend (FastAPI)
|
||||
Loaded: loaded (/etc/systemd/system/ids-ml-backend.service; enabled; preset: disabled)
|
||||
Active: activating (auto-restart) (Result: exit-code) since Sat 2025-11-22 10:55:29 CET; 7s ago
|
||||
Process: 15441 ExecStart=/opt/ids/python_ml/venv/bin/python3 main.py (code=exited, status=1/FAILURE)
|
||||
Main PID: 15441 (code=exited, status=1/FAILURE)
|
||||
CPU: 3.642s
|
||||
[root@ids ids]# systemctl restart ids-ml-backend
|
||||
[root@ids ids]# systemctl status ids-ml-backend
|
||||
● ids-ml-backend.service - IDS ML Backend (FastAPI)
|
||||
Loaded: loaded (/etc/systemd/system/ids-ml-backend.service; enabled; preset: disabled)
|
||||
Active: active (running) since Sat 2025-11-22 10:55:48 CET; 1s ago
|
||||
Main PID: 15482 (python3)
|
||||
Tasks: 15 (limit: 100409)
|
||||
Memory: 110.1M (max: 2.0G available: 1.8G)
|
||||
CPU: 3.357s
|
||||
CGroup: /system.slice/ids-ml-backend.service
|
||||
└─15482 /opt/ids/python_ml/venv/bin/python3 main.py
|
||||
|
||||
Nov 22 10:55:48 ids.alfacom.it systemd[1]: Started IDS ML Backend (FastAPI).
|
||||
[root@ids ids]# systemctl status ids-ml-backend
|
||||
● ids-ml-backend.service - IDS ML Backend (FastAPI)
|
||||
Loaded: loaded (/etc/systemd/system/ids-ml-backend.service; enabled; preset: disabled)
|
||||
Active: activating (auto-restart) (Result: exit-code) since Sat 2025-11-22 10:55:50 CET; 3s ago
|
||||
Process: 15482 ExecStart=/opt/ids/python_ml/venv/bin/python3 main.py (code=exited, status=1/FAILURE)
|
||||
Main PID: 15482 (code=exited, status=1/FAILURE)
|
||||
CPU: 3.607s
|
||||
[root@ids ids]# tail -30 /var/log/ids/ml_backend.log
|
||||
Traceback (most recent call last):
|
||||
File "/opt/ids/python_ml/main.py", line 21, in <module>
|
||||
from mikrotik_manager import MikroTikManager
|
||||
File "/opt/ids/python_ml/mikrotik_manager.py", line 6, in <module>
|
||||
import httpx
|
||||
ModuleNotFoundError: No module named 'httpx'
|
||||
Traceback (most recent call last):
|
||||
File "/opt/ids/python_ml/main.py", line 21, in <module>
|
||||
from mikrotik_manager import MikroTikManager
|
||||
File "/opt/ids/python_ml/mikrotik_manager.py", line 6, in <module>
|
||||
import httpx
|
||||
ModuleNotFoundError: No module named 'httpx'
|
||||
Traceback (most recent call last):
|
||||
File "/opt/ids/python_ml/main.py", line 21, in <module>
|
||||
from mikrotik_manager import MikroTikManager
|
||||
File "/opt/ids/python_ml/mikrotik_manager.py", line 6, in <module>
|
||||
import httpx
|
||||
ModuleNotFoundError: No module named 'httpx'
|
||||
Traceback (most recent call last):
|
||||
File "/opt/ids/python_ml/main.py", line 21, in <module>
|
||||
from mikrotik_manager import MikroTikManager
|
||||
File "/opt/ids/python_ml/mikrotik_manager.py", line 6, in <module>
|
||||
import httpx
|
||||
ModuleNotFoundError: No module named 'httpx'
|
||||
Traceback (most recent call last):
|
||||
File "/opt/ids/python_ml/main.py", line 21, in <module>
|
||||
from mikrotik_manager import MikroTikManager
|
||||
File "/opt/ids/python_ml/mikrotik_manager.py", line 6, in <module>
|
||||
import httpx
|
||||
ModuleNotFoundError: No module named 'httpx'
|
||||
@ -57,6 +57,8 @@ pip install psycopg2-binary==2.9.9
|
||||
pip install pandas==2.1.3
|
||||
pip install numpy==1.26.2
|
||||
pip install scikit-learn==1.3.2
|
||||
pip install httpx==0.25.1
|
||||
pip install joblib==1.3.2
|
||||
|
||||
echo -e "${GREEN}✅ Dipendenze Python installate${NC}"
|
||||
|
||||
@ -67,10 +69,12 @@ chown -R ids:ids "$VENV_DIR"
|
||||
# Verifica installazione
|
||||
echo -e "\n${BLUE}🔍 Verifica installazione:${NC}"
|
||||
source "${VENV_DIR}/bin/activate"
|
||||
python3 -c "import fastapi; print(f'FastAPI: {fastapi.__version__}')"
|
||||
python3 -c "import uvicorn; print(f'Uvicorn: {uvicorn.__version__}')"
|
||||
python3 -c "import sklearn; print(f'Scikit-learn: {sklearn.__version__}')"
|
||||
python3 -c "import pandas; print(f'Pandas: {pandas.__version__}')"
|
||||
python3 -c "import fastapi; print(f'✅ FastAPI: {fastapi.__version__}')"
|
||||
python3 -c "import uvicorn; print(f'✅ Uvicorn: {uvicorn.__version__}')"
|
||||
python3 -c "import sklearn; print(f'✅ Scikit-learn: {sklearn.__version__}')"
|
||||
python3 -c "import pandas; print(f'✅ Pandas: {pandas.__version__}')"
|
||||
python3 -c "import httpx; print(f'✅ HTTPX: {httpx.__version__}')"
|
||||
python3 -c "import joblib; print(f'✅ Joblib: {joblib.__version__}')"
|
||||
|
||||
echo -e "\n${GREEN}╔═══════════════════════════════════════════════╗${NC}"
|
||||
echo -e "${GREEN}║ ✅ DIPENDENZE PYTHON INSTALLATE ║${NC}"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user