Compare commits

..

7 Commits

Author SHA1 Message Date
e64b880c97 feat: Improve daily recap functionality
- Changed the daily recap time to 22:00.
- Modified the `send_daily_recap` function to split the recap message into multiple messages if it exceeds 2000 characters to avoid hitting the Discord message length limit.
- Added a 1-second delay between each message chunk to avoid rate limiting.
2025-09-15 13:27:40 -05:00
e559e16e35 refactor: Change UFW block anomaly severity to medium
Changed the severity of the UFW block anomaly from "high" to "medium".
A high number of blocked connections is not a critical issue as long as the firewall is working correctly.
2025-09-15 13:24:43 -05:00
12e6ba0135 feat: Add UFW log monitoring
- Added a new function `get_ufw_logs` to monitor `/var/log/ufw.log`.
- Added a new table `ufw_logs` to the database to store UFW log data.
- Updated `analyze_data_locally` to detect anomalies in UFW logs (high number of blocked connections).
- Integrated the new functionality into the main monitoring loop.
2025-09-15 13:22:37 -05:00
0f0bdd2da7 chore: Clean up project structure
- Removed `monitoring_data.json` as it has been replaced by `monitoring.db`.
- Updated `.gitignore` to ignore log files.
2025-09-15 13:14:29 -05:00
07c768a4cf feat: Implement data retention policy
- Replaced `data_storage.py` with `database.py` to use SQLite instead of a JSON file for data storage.
- Added an `enforce_retention_policy` function to `database.py` to delete data older than 7 days.
- Called this function in the main monitoring loop in `monitor_agent.py`.
- Added Docker container monitoring.
- Updated `.gitignore` to ignore `monitoring.db`.
2025-09-15 13:12:05 -05:00
0b64f2ed03 Switched to SQLlite database 2025-09-14 22:01:00 -05:00
d102dc30f4 Offloaded data detection from the LLM and hardcoded it 2025-08-24 13:30:21 -05:00
20 changed files with 926 additions and 89 deletions

9
.gitignore vendored Normal file → Executable file
View File

@@ -1,6 +1,5 @@
__pycache__/*
*.pyc
__pycache__/
monitoring_data.json
log_position.txt
auth_log_position.txt
monitoring_agent.log*
.DS_Store
monitoring.db
*.log

0
AGENTS.md Normal file → Executable file
View File

0
CONSTRAINTS.md Normal file → Executable file
View File

4
PROGRESS.md Normal file → Executable file
View File

@@ -76,8 +76,6 @@
- [x] When calculating averages, please round up to the nearest integer. We only want to deliver whole integers to the LLM to process, and nothing with decimal points. It gets confused with decimal points.
- [x] In the discord message, please include the exact specific details and the log of the problem that prompted the alert
## TODO
## Phase 7: Offloading Analysis from LLM
39. [x] Create a new function `analyze_data_locally` in `monitor_agent.py`.
@@ -94,3 +92,5 @@
41.2. [x] If anomalies are found, call `generate_llm_report` to create the report.
41.3. [x] Use the output of `generate_llm_report` for alerting.
42. [x] Remove the detailed analytical instructions from `build_llm_prompt` as they will be handled by `analyze_data_locally`.
## TODO

0
PROMPT.md Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

26
SPEC.md Normal file → Executable file
View File

@@ -108,3 +108,29 @@ The project will be composed of the following files:
## 7. Testing and Debugging
The script is equipped with a test mode, that only runs the script once, and not continuously. To enable, change the `TEST_MODE` variable in `config.py` to `True`. Once finished testing, change the variable back to `False`.
## 8. Future Enhancements
### 8.1. Process Monitoring
**Description:** The agent will be able to monitor a list of critical processes to ensure they are running. If a process is not running, an anomaly will be generated.
**Implementation Plan:**
1. **Configuration:** Add a new list variable to `config.py` named `PROCESSES_TO_MONITOR` which will contain the names of the processes to be monitored.
2. **Data Ingestion:** Create a new function in `monitor_agent.py` called `get_running_processes()` that uses the `psutil` library to get a list of all running processes.
3. **Data Analysis:** In `analyze_data_locally()`, compare the list of running processes with the `PROCESSES_TO_MONITOR` list from the configuration. If a process from the configured list is not found in the running processes, generate a "high" severity anomaly.
4. **LLM Integration:** The existing `generate_llm_report()` function will be used to generate a report for the new anomaly type.
5. **Alerting:** The existing alerting system will be used to send alerts for the new anomaly type.
### 8.2. Docker Container Monitoring
**Description:** The agent will be able to monitor a list of critical Docker containers to ensure they are running and healthy. If a container is not running or is in an unhealthy state, an anomaly will be generated.
**Implementation Plan:**
1. **Configuration:** Add a new list variable to `config.py` named `DOCKER_CONTAINERS_TO_MONITOR` which will contain the names of the Docker containers to be monitored.
2. **Data Ingestion:** Create a new function in `monitor_agent.py` called `get_docker_container_status()` that uses the `docker` Python library to get the status of all running containers.
3. **Data Analysis:** In `analyze_data_locally()`, iterate through the `DOCKER_CONTAINERS_TO_MONITOR` list. For each container, check its status. If a container is not running or its status is not "running", generate a "high" severity anomaly.
4. **LLM Integration:** The existing `generate_llm_report()` function will be used to generate a report for the new anomaly type.
5. **Alerting:** The existing alerting system will be used to send alerts for the new anomaly type.

1
auth_log_position.txt Executable file
View File

@@ -0,0 +1 @@
449823

5
config.py Normal file → Executable file
View File

@@ -9,11 +9,14 @@ HOME_ASSISTANT_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjOGRmZjI
GOOGLE_HOME_SPEAKER_ID = "media_player.spencer_room_speaker"
# Daily Recap Time (in 24-hour format, e.g., "20:00")
DAILY_RECAP_TIME = "18:28"
DAILY_RECAP_TIME = "22:00"
# Nmap Configuration
NMAP_TARGETS = "192.168.2.0/24"
NMAP_SCAN_OPTIONS = "-sS -T4 -R"
# Docker Configuration
DOCKER_CONTAINERS_TO_MONITOR = ["gitea","portainer","gluetun","mealie","n8n","minecraft"]
# Test Mode (True to run once and exit, False to run continuously)
TEST_MODE = False

View File

@@ -1,62 +0,0 @@
import json
import os
from datetime import datetime, timedelta, timezone
import math
DATA_FILE = 'monitoring_data.json'
def load_data():
if os.path.exists(DATA_FILE):
with open(DATA_FILE, 'r') as f:
return json.load(f)
return []
def store_data(new_data):
data = load_data()
data.append(new_data)
with open(DATA_FILE, 'w') as f:
json.dump(data, f, indent=4)
def _calculate_average(data, key1, key2):
"""Helper function to calculate the average of a nested key in a list of dicts."""
values = [d[key1][key2] for d in data if key1 in d and key2 in d[key1] and d[key1][key2] != "N/A"]
return math.ceil(sum(values) / len(values)) if values else 0
def calculate_baselines():
data = load_data()
if not data:
return {}
# For simplicity, we'll average the last 24 hours of data
# More complex logic can be added here
recent_data = [d for d in data if 'timestamp' in d and datetime.fromisoformat(d['timestamp'].replace('Z', '')).replace(tzinfo=timezone.utc) > datetime.now(timezone.utc) - timedelta(hours=24)]
if not recent_data:
return {}
baseline_metrics = {
'avg_rtt': _calculate_average(recent_data, 'network_metrics', 'rtt_avg'),
'packet_loss': _calculate_average(recent_data, 'network_metrics', 'packet_loss_rate'),
'avg_cpu_temp': _calculate_average(recent_data, 'cpu_temperature', 'cpu_temperature'),
'avg_gpu_temp': _calculate_average(recent_data, 'gpu_temperature', 'gpu_temperature'),
}
# Baseline for open ports from nmap scans
host_ports = {}
for d in recent_data:
if 'nmap_results' in d and 'hosts' in d.get('nmap_results', {}):
for host_info in d['nmap_results']['hosts']:
host_ip = host_info['ip']
if host_ip not in host_ports:
host_ports[host_ip] = set()
for port_info in host_info.get('open_ports', []):
host_ports[host_ip].add(port_info['port'])
# Convert sets to sorted lists for JSON serialization
for host, ports in host_ports.items():
host_ports[host] = sorted(list(ports))
baseline_metrics['host_ports'] = host_ports
return baseline_metrics

262
database.py Executable file
View File

@@ -0,0 +1,262 @@
import sqlite3
import json
from datetime import datetime, timedelta, timezone
import logging
logger = logging.getLogger(__name__)
DATABASE_FILE = 'monitoring.db'
def initialize_database():
"""Initializes the database and creates tables if they don't exist."""
try:
conn = sqlite3.connect(DATABASE_FILE)
cursor = conn.cursor()
# Main table for monitoring data
cursor.execute("""
CREATE TABLE IF NOT EXISTS monitoring_data (
id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp TEXT NOT NULL
)
""")
# Table for network metrics
cursor.execute("""
CREATE TABLE IF NOT EXISTS network_metrics (
id INTEGER PRIMARY KEY AUTOINCREMENT,
monitoring_data_id INTEGER,
rtt_avg REAL,
packet_loss_rate REAL,
FOREIGN KEY (monitoring_data_id) REFERENCES monitoring_data (id)
)
""")
# Table for temperatures
cursor.execute("""
CREATE TABLE IF NOT EXISTS temperatures (
id INTEGER PRIMARY KEY AUTOINCREMENT,
monitoring_data_id INTEGER,
cpu_temp REAL,
gpu_temp REAL,
FOREIGN KEY (monitoring_data_id) REFERENCES monitoring_data (id)
)
""")
# Table for login attempts
cursor.execute("""
CREATE TABLE IF NOT EXISTS login_attempts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
monitoring_data_id INTEGER,
log_line TEXT,
FOREIGN KEY (monitoring_data_id) REFERENCES monitoring_data (id)
)
""")
# Table for Nmap scans
cursor.execute("""
CREATE TABLE IF NOT EXISTS nmap_scans (
id INTEGER PRIMARY KEY AUTOINCREMENT,
monitoring_data_id INTEGER,
scan_data TEXT,
FOREIGN KEY (monitoring_data_id) REFERENCES monitoring_data (id)
)
""")
# Table for Docker status
cursor.execute("""
CREATE TABLE IF NOT EXISTS docker_status (
id INTEGER PRIMARY KEY AUTOINCREMENT,
monitoring_data_id INTEGER,
container_name TEXT,
status TEXT,
FOREIGN KEY (monitoring_data_id) REFERENCES monitoring_data (id)
)
""")
# Table for syslog
cursor.execute("""
CREATE TABLE IF NOT EXISTS syslog (
id INTEGER PRIMARY KEY AUTOINCREMENT,
monitoring_data_id INTEGER,
log_data TEXT,
FOREIGN KEY (monitoring_data_id) REFERENCES monitoring_data (id)
)
""")
# Table for ufw logs
cursor.execute("""
CREATE TABLE IF NOT EXISTS ufw_logs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
monitoring_data_id INTEGER,
log_line TEXT,
FOREIGN KEY (monitoring_data_id) REFERENCES monitoring_data (id)
)
""")
conn.commit()
conn.close()
logger.info("Database initialized successfully.")
except sqlite3.Error as e:
logger.error(f"Error initializing database: {e}")
def store_data(new_data):
"""Stores new monitoring data in the database."""
try:
conn = sqlite3.connect(DATABASE_FILE)
cursor = conn.cursor()
# Insert into main table
cursor.execute("INSERT INTO monitoring_data (timestamp) VALUES (?)", (new_data['timestamp'],))
monitoring_data_id = cursor.lastrowid
# Insert into network_metrics
if 'network_metrics' in new_data:
nm = new_data['network_metrics']
cursor.execute("INSERT INTO network_metrics (monitoring_data_id, rtt_avg, packet_loss_rate) VALUES (?, ?, ?)",
(monitoring_data_id, nm.get('rtt_avg'), nm.get('packet_loss_rate')))
# Insert into temperatures
if 'cpu_temperature' in new_data or 'gpu_temperature' in new_data:
cpu_temp = new_data.get('cpu_temperature', {}).get('cpu_temperature')
gpu_temp = new_data.get('gpu_temperature', {}).get('gpu_temperature')
cursor.execute("INSERT INTO temperatures (monitoring_data_id, cpu_temp, gpu_temp) VALUES (?, ?, ?)",
(monitoring_data_id, cpu_temp, gpu_temp))
# Insert into login_attempts
if 'login_attempts' in new_data and new_data['login_attempts'].get('failed_login_attempts'):
for line in new_data['login_attempts']['failed_login_attempts']:
cursor.execute("INSERT INTO login_attempts (monitoring_data_id, log_line) VALUES (?, ?)",
(monitoring_data_id, line))
# Insert into nmap_scans
if 'nmap_results' in new_data:
cursor.execute("INSERT INTO nmap_scans (monitoring_data_id, scan_data) VALUES (?, ?)",
(monitoring_data_id, json.dumps(new_data['nmap_results'])))
# Insert into docker_status
if 'docker_container_status' in new_data:
for name, status in new_data['docker_container_status'].get('docker_container_status', {}).items():
cursor.execute("INSERT INTO docker_status (monitoring_data_id, container_name, status) VALUES (?, ?, ?)",
(monitoring_data_id, name, status))
# Insert into syslog
if 'system_logs' in new_data:
for log in new_data['system_logs'].get('syslog', []):
cursor.execute("INSERT INTO syslog (monitoring_data_id, log_data) VALUES (?, ?)",
(monitoring_data_id, json.dumps(log)))
# Insert into ufw_logs
if 'ufw_logs' in new_data:
for line in new_data['ufw_logs']:
cursor.execute("INSERT INTO ufw_logs (monitoring_data_id, log_line) VALUES (?, ?)",
(monitoring_data_id, line))
conn.commit()
conn.close()
except sqlite3.Error as e:
logger.error(f"Error storing data: {e}")
def calculate_baselines():
"""Calculates baseline metrics from data in the last 24 hours."""
try:
conn = sqlite3.connect(DATABASE_FILE)
cursor = conn.cursor()
twenty_four_hours_ago = (datetime.now(timezone.utc) - timedelta(hours=24)).isoformat()
# Calculate average RTT and packet loss
cursor.execute("""
SELECT AVG(nm.rtt_avg), AVG(nm.packet_loss_rate)
FROM network_metrics nm
JOIN monitoring_data md ON nm.monitoring_data_id = md.id
WHERE md.timestamp > ?
""", (twenty_four_hours_ago,))
avg_rtt, avg_packet_loss = cursor.fetchone()
# Calculate average temperatures
cursor.execute("""
SELECT AVG(t.cpu_temp), AVG(t.gpu_temp)
FROM temperatures t
JOIN monitoring_data md ON t.monitoring_data_id = md.id
WHERE md.timestamp > ?
""", (twenty_four_hours_ago,))
avg_cpu_temp, avg_gpu_temp = cursor.fetchone()
# Get baseline open ports
cursor.execute("""
SELECT ns.scan_data
FROM nmap_scans ns
JOIN monitoring_data md ON ns.monitoring_data_id = md.id
WHERE md.timestamp > ?
ORDER BY md.timestamp DESC
LIMIT 1
""", (twenty_four_hours_ago,))
latest_nmap_scan = cursor.fetchone()
host_ports = {}
if latest_nmap_scan:
scan_data = json.loads(latest_nmap_scan[0])
if 'hosts' in scan_data:
for host_info in scan_data['hosts']:
host_ip = host_info['ip']
if host_ip not in host_ports:
host_ports[host_ip] = set()
for port_info in host_info.get('open_ports', []):
host_ports[host_ip].add(port_info['port'])
for host, ports in host_ports.items():
host_ports[host] = sorted(list(ports))
conn.close()
return {
'avg_rtt': avg_rtt or 0,
'packet_loss': avg_packet_loss or 0,
'avg_cpu_temp': avg_cpu_temp or 0,
'avg_gpu_temp': avg_gpu_temp or 0,
'host_ports': host_ports
}
except sqlite3.Error as e:
logger.error(f"Error calculating baselines: {e}")
return {}
def enforce_retention_policy(retention_days=7):
"""Enforces the data retention policy by deleting old data."""
try:
conn = sqlite3.connect(DATABASE_FILE)
cursor = conn.cursor()
retention_cutoff = (datetime.now(timezone.utc) - timedelta(days=retention_days)).isoformat()
# Find old monitoring_data IDs
cursor.execute("SELECT id FROM monitoring_data WHERE timestamp < ?", (retention_cutoff,))
old_ids = [row[0] for row in cursor.fetchall()]
if not old_ids:
logger.info("No old data to delete.")
conn.close()
return
# Create a placeholder string for the IN clause
placeholders = ','.join('?' for _ in old_ids)
# Delete from child tables
cursor.execute(f"DELETE FROM network_metrics WHERE monitoring_data_id IN ({placeholders})", old_ids)
cursor.execute(f"DELETE FROM temperatures WHERE monitoring_data_id IN ({placeholders})", old_ids)
cursor.execute(f"DELETE FROM login_attempts WHERE monitoring_data_id IN ({placeholders})", old_ids)
cursor.execute(f"DELETE FROM nmap_scans WHERE monitoring_data_id IN ({placeholders})", old_ids)
cursor.execute(f"DELETE FROM docker_status WHERE monitoring_data_id IN ({placeholders})", old_ids)
cursor.execute(f"DELETE FROM syslog WHERE monitoring_data_id IN ({placeholders})", old_ids)
cursor.execute(f"DELETE FROM ufw_logs WHERE monitoring_data_id IN ({placeholders})", old_ids)
# Delete from the main table
cursor.execute(f"DELETE FROM monitoring_data WHERE id IN ({placeholders})", old_ids)
conn.commit()
conn.close()
logger.info(f"Deleted {len(old_ids)} old records.")
except sqlite3.Error as e:
logger.error(f"Error enforcing retention policy: {e}")

0
known_issues.json Normal file → Executable file
View File

1
log_position.txt Executable file
View File

@@ -0,0 +1 @@
82868478

116
monitor_agent.py Normal file → Executable file
View File

@@ -6,7 +6,7 @@ import subprocess
import ollama
from discord_webhook import DiscordWebhook
import requests
import data_storage
import database as data_storage
import re
import os
from datetime import datetime, timezone
@@ -14,6 +14,7 @@ import pingparsing
import nmap
import logging
from logging.handlers import TimedRotatingFileHandler
import docker
import schedule
@@ -23,7 +24,7 @@ import config
from syslog_rfc5424_parser import parser
# --- Logging Configuration ---
LOG_FILE = "monitoring_agent.log"
LOG_FILE = "./tmp/monitoring_agent.log"
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
@@ -41,9 +42,35 @@ logger.addHandler(console_handler)
LOG_POSITION_FILE = 'log_position.txt'
AUTH_LOG_POSITION_FILE = 'auth_log_position.txt'
UFW_LOG_POSITION_FILE = 'ufw_log_position.txt'
# --- Data Ingestion & Parsing Functions ---
def get_ufw_logs():
"""Gets new lines from /var/log/ufw.log since the last check."""
try:
last_position = 0
if os.path.exists(UFW_LOG_POSITION_FILE):
with open(UFW_LOG_POSITION_FILE, 'r') as f:
last_position = int(f.read())
with open("/var/log/ufw.log", "r") as f:
f.seek(last_position)
log_lines = f.readlines()
current_position = f.tell()
with open(UFW_LOG_POSITION_FILE, 'w') as f:
f.write(str(current_position))
return log_lines
except FileNotFoundError:
logger.error("/var/log/ufw.log not found.")
return []
except Exception as e:
logger.error(f"Error reading ufw.log: {e}")
return []
def get_system_logs():
"""Gets new lines from /var/log/syslog since the last check."""
try:
@@ -192,6 +219,23 @@ def get_nmap_scan_results():
logger.error(f"Error performing Nmap scan: {e}")
return {"error": "Nmap scan failed"}
def get_docker_container_status():
"""Gets the status of configured Docker containers."""
if not config.DOCKER_CONTAINERS_TO_MONITOR:
return {"docker_container_status": {}}
try:
client = docker.from_env()
containers = client.containers.list(all=True)
status = {}
for container in containers:
if container.name in config.DOCKER_CONTAINERS_TO_MONITOR:
status[container.name] = container.status
return {"docker_container_status": status}
except Exception as e:
logger.error(f"Error getting Docker container status: {e}")
return {"docker_container_status": {}}
# --- Data Analysis ---
def analyze_data_locally(data, baselines, known_issues, port_applications):
@@ -265,6 +309,34 @@ def analyze_data_locally(data, baselines, known_issues, port_applications):
"reason": f"New port opened on {host_ip}: {port} ({port_info})"
})
# Docker container status check
docker_status = data.get("docker_container_status", {}).get("docker_container_status")
if docker_status:
for container_name, status in docker_status.items():
if status != "running":
anomalies.append({
"severity": "high",
"reason": f"Docker container '{container_name}' is not running. Current status: {status}"
})
# UFW log analysis
ufw_logs = data.get("ufw_logs", [])
if ufw_logs:
blocked_ips = {}
for log_line in ufw_logs:
if "[UFW BLOCK]" in log_line:
match = re.search(r"SRC=([\d\.]+)", log_line)
if match:
ip = match.group(1)
blocked_ips[ip] = blocked_ips.get(ip, 0) + 1
for ip, count in blocked_ips.items():
if count > 10:
anomalies.append({
"severity": "medium",
"reason": f"High number of blocked connections ({count}) from IP address: {ip}"
})
return anomalies
# --- LLM Interaction Function ---
@@ -284,13 +356,14 @@ def build_llm_prompt(anomalies):
def generate_llm_report(anomalies):
"""Generates a report from a list of anomalies using the local LLM."""
logger.info("Generating LLM report...")
if not anomalies:
return {"severity": "none", "reason": ""}
prompt = build_llm_prompt(anomalies)
try:
response = ollama.generate(model="llama3.1:8b", prompt=prompt)
response = ollama.generate(model="phi4-mini", prompt=prompt)
sanitized_response = response['response'].strip()
# Extract JSON from the response
@@ -322,7 +395,13 @@ def generate_llm_report(anomalies):
def send_discord_alert(llm_response, combined_data):
"""Sends an alert to Discord."""
reason = llm_response.get('reason', 'No reason provided.')
message = f"**High Severity Alert:**\n> {reason}\n\n**Relevant Data:**\n```json\n{json.dumps(combined_data, indent=2)}\n```"
message = f"""**High Severity Alert:**
> {reason}
**Relevant Data:**
```json
{json.dumps(combined_data, indent=2)}
```"""
webhook = DiscordWebhook(url=config.DISCORD_WEBHOOK_URL, content=message)
try:
response = webhook.execute()
@@ -351,7 +430,7 @@ def send_google_home_alert(message):
data = {
"entity_id": "all",
"media_player_entity_id": config.GOOGLE_HOME_SPEAKER_ID,
"message": simplified_message,
"message": simplified_message, # type: ignore
}
try:
response = requests.post(url, headers=headers, json=data)
@@ -376,18 +455,26 @@ def send_daily_recap():
"""Sends a daily recap of events to Discord."""
global daily_events
if daily_events:
recap_message = "\n".join(daily_events)
webhook = DiscordWebhook(url=config.DISCORD_WEBHOOK_URL, content=f"**Daily Recap:**\n{recap_message}")
recap_message = "**Daily Recap:**\n" + "\n".join(daily_events)
# Split the message into chunks of 2000 characters
message_chunks = [recap_message[i:i+2000] for i in range(0, len(recap_message), 2000)]
for chunk in message_chunks:
webhook = DiscordWebhook(url=config.DISCORD_WEBHOOK_URL, content=chunk)
try:
response = webhook.execute()
if response.status_code == 200:
logger.info("Daily recap sent successfully.")
logger.info("Daily recap chunk sent successfully.")
else:
logger.error(f"Error sending daily recap: {response.status_code} - {response.content}")
logger.error(f"Error sending daily recap chunk: {response.status_code} - {response.content}")
except Exception as e:
logger.error(f"Error sending daily recap: {e}")
logger.error(f"Error sending daily recap chunk: {e}")
time.sleep(1) # Wait 1 second between chunks to avoid rate limiting
daily_events = [] # Reset for the next day
def run_monitoring_cycle(nmap_scan_counter):
"""Runs a single monitoring cycle."""
@@ -398,6 +485,8 @@ def run_monitoring_cycle(nmap_scan_counter):
cpu_temp = get_cpu_temperature(sensors_output)
gpu_temp = get_gpu_temperature(sensors_output)
login_attempts = get_login_attempts()
docker_container_status = get_docker_container_status()
ufw_logs = get_ufw_logs()
nmap_results = None
if nmap_scan_counter == 0:
@@ -412,13 +501,16 @@ def run_monitoring_cycle(nmap_scan_counter):
"network_metrics": network_metrics,
"cpu_temperature": cpu_temp,
"gpu_temperature": gpu_temp,
"login_attempts": login_attempts
"login_attempts": login_attempts,
"docker_container_status": docker_container_status,
"ufw_logs": ufw_logs
}
if nmap_results:
combined_data["nmap_results"] = nmap_results
data_storage.store_data(combined_data)
data_storage.enforce_retention_policy()
with open("known_issues.json", "r") as f:
known_issues = json.load(f)
@@ -430,6 +522,7 @@ def run_monitoring_cycle(nmap_scan_counter):
anomalies = analyze_data_locally(combined_data, baselines, known_issues, port_applications)
if anomalies:
logger.info(f"Detected {len(anomalies)} anomalies: {anomalies}")
llm_response = generate_llm_report(anomalies)
if llm_response and llm_response.get('severity') != "none":
daily_events.append(llm_response.get('reason'))
@@ -440,6 +533,7 @@ def run_monitoring_cycle(nmap_scan_counter):
def main():
"""Main function to run the monitoring agent."""
data_storage.initialize_database()
if config.TEST_MODE:
logger.info("Running in test mode...")
run_monitoring_cycle(0)

0
port_applications.json Normal file → Executable file
View File

1
requirements.txt Normal file → Executable file
View File

@@ -5,3 +5,4 @@ ollama
syslog-rfc5424-parser
python-nmap
schedule
docker

0
test_output.log Normal file → Executable file
View File

479
tmp/monitoring_agent.log Executable file
View File

@@ -0,0 +1,479 @@
2025-09-15 00:01:21,407 - INFO - Running monitoring cycle...
2025-09-15 00:31:11,922 - INFO - Running monitoring cycle...
2025-09-15 00:36:14,048 - INFO - Running monitoring cycle...
2025-09-15 00:41:16,122 - INFO - Running monitoring cycle...
2025-09-15 00:46:18,223 - INFO - Running monitoring cycle...
2025-09-15 00:53:17,684 - INFO - Running monitoring cycle...
2025-09-15 00:58:19,786 - INFO - Running monitoring cycle...
2025-09-15 01:03:21,873 - INFO - Running monitoring cycle...
2025-09-15 01:08:23,956 - INFO - Running monitoring cycle...
2025-09-15 01:15:53,304 - INFO - Running monitoring cycle...
2025-09-15 01:20:55,400 - INFO - Running monitoring cycle...
2025-09-15 01:25:57,573 - INFO - Running monitoring cycle...
2025-09-15 01:30:59,656 - INFO - Running monitoring cycle...
2025-09-15 01:49:24,983 - INFO - Running monitoring cycle...
2025-09-15 01:54:27,106 - INFO - Running monitoring cycle...
2025-09-15 01:59:29,198 - INFO - Running monitoring cycle...
2025-09-15 02:04:31,335 - INFO - Running monitoring cycle...
2025-09-15 02:05:49,829 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:05:49,829 - INFO - Generating LLM report...
2025-09-15 02:05:54,309 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues with a high severity level because it has exited unexpectedly."}
2025-09-15 02:10:54,309 - INFO - Running monitoring cycle...
2025-09-15 02:10:56,390 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:10:56,390 - INFO - Generating LLM report...
2025-09-15 02:11:00,906 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped (exited). This may lead to Minecraft service disruptions."}
2025-09-15 02:16:00,906 - INFO - Running monitoring cycle...
2025-09-15 02:16:02,986 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:16:02,986 - INFO - Generating LLM report...
2025-09-15 02:16:07,417 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited unexpectedly without starting."}
2025-09-15 02:21:07,417 - INFO - Running monitoring cycle...
2025-09-15 02:21:09,515 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:21:09,515 - INFO - Generating LLM report...
2025-09-15 02:21:13,947 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' has exited unexpectedly; it is currently stopped."}
2025-09-15 02:26:13,948 - INFO - Running monitoring cycle...
2025-09-15 02:28:09,890 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:28:09,890 - INFO - Generating LLM report...
2025-09-15 02:28:14,339 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped; it exited unexpectedly."}
2025-09-15 02:33:14,339 - INFO - Running monitoring cycle...
2025-09-15 02:33:16,482 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:33:16,482 - INFO - Generating LLM report...
2025-09-15 02:33:20,965 - INFO - LLM Response: {'severity': 'high', 'reason': "The Docker container named 'minecraft' is currently stopped; its status shows it has exited."}
2025-09-15 02:38:20,965 - INFO - Running monitoring cycle...
2025-09-15 02:38:23,059 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:38:23,059 - INFO - Generating LLM report...
2025-09-15 02:38:27,574 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing a critical failure; it has exited unexpectedly without proper shutdown."}
2025-09-15 02:43:27,574 - INFO - Running monitoring cycle...
2025-09-15 02:43:29,681 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:43:29,681 - INFO - Generating LLM report...
2025-09-15 02:43:34,112 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently exited; it should be running."}
2025-09-15 02:48:34,112 - INFO - Running monitoring cycle...
2025-09-15 02:50:08,317 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:50:08,317 - INFO - Generating LLM report...
2025-09-15 02:50:12,959 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing a high-severity issue due to it being currently stopped; its status indicates that it's exited."}
2025-09-15 02:55:12,959 - INFO - Running monitoring cycle...
2025-09-15 02:55:15,068 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 02:55:15,068 - INFO - Generating LLM report...
2025-09-15 02:55:19,562 - INFO - LLM Response: {'severity': 'high', 'reason': "The Docker container named 'minecraft' has exited; it is currently stopped."}
2025-09-15 03:00:19,563 - INFO - Running monitoring cycle...
2025-09-15 03:00:21,651 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 03:00:21,651 - INFO - Generating LLM report...
2025-09-15 03:00:26,074 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently exited; it needs restarting."}
2025-09-15 03:05:26,074 - INFO - Running monitoring cycle...
2025-09-15 03:05:28,216 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 03:05:28,216 - INFO - Generating LLM report...
2025-09-15 03:05:32,610 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently exited but expected to be running."}
2025-09-15 03:10:32,610 - INFO - Running monitoring cycle...
2025-09-15 03:13:12,236 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 03:13:12,236 - INFO - Generating LLM report...
2025-09-15 03:13:16,630 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited prematurely."}
2025-09-15 03:18:16,630 - INFO - Running monitoring cycle...
2025-09-15 03:18:18,787 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 03:18:18,787 - INFO - Generating LLM report...
2025-09-15 03:18:23,312 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing a critical issue; it has exited unexpectedly without starting."}
2025-09-15 03:23:23,312 - INFO - Running monitoring cycle...
2025-09-15 03:23:25,413 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 03:23:25,413 - INFO - Generating LLM report...
2025-09-15 03:23:29,917 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues with its operational status; it has exited unexpectedly."}
2025-09-15 03:28:29,917 - INFO - Running monitoring cycle...
2025-09-15 03:28:32,051 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 03:28:32,052 - INFO - Generating LLM report...
2025-09-15 03:28:36,665 - INFO - LLM Response: {'severity': 'high', 'reason': "The Docker container named 'minecraft' is currently stopped with status 'exited', which could indicate a failure to start correctly."}
2025-09-15 03:33:36,665 - INFO - Running monitoring cycle...
2025-09-15 03:54:15,994 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 03:54:15,994 - INFO - Generating LLM report...
2025-09-15 03:54:20,384 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is down; it has exited."}
2025-09-15 03:59:20,384 - INFO - Running monitoring cycle...
2025-09-15 03:59:22,474 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 03:59:22,474 - INFO - Generating LLM report...
2025-09-15 03:59:26,867 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped with status exited."}
2025-09-15 04:04:26,867 - INFO - Running monitoring cycle...
2025-09-15 04:04:28,958 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:04:28,958 - INFO - Generating LLM report...
2025-09-15 04:04:33,343 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped (exited)."}
2025-09-15 04:09:33,344 - INFO - Running monitoring cycle...
2025-09-15 04:09:35,442 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:09:35,442 - INFO - Generating LLM report...
2025-09-15 04:09:39,882 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently exited; it needs restarting."}
2025-09-15 04:14:39,882 - INFO - Running monitoring cycle...
2025-09-15 04:17:37,763 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:17:37,763 - INFO - Generating LLM report...
2025-09-15 04:17:42,223 - INFO - LLM Response: {'severity': 'high', 'reason': "The Docker container 'minecraft' is currently stopped with a status of exited."}
2025-09-15 04:22:42,224 - INFO - Running monitoring cycle...
2025-09-15 04:22:44,301 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:22:44,301 - INFO - Generating LLM report...
2025-09-15 04:22:48,808 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing a high severity issue because it has exited unexpectedly."}
2025-09-15 04:27:48,808 - INFO - Running monitoring cycle...
2025-09-15 04:27:50,896 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:27:50,896 - INFO - Generating LLM report...
2025-09-15 04:27:55,278 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently exited but should be running."}
2025-09-15 04:32:55,279 - INFO - Running monitoring cycle...
2025-09-15 04:32:57,383 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:32:57,383 - INFO - Generating LLM report...
2025-09-15 04:33:01,780 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited unexpectedly."}
2025-09-15 04:38:01,781 - INFO - Running monitoring cycle...
2025-09-15 04:44:04,873 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:44:04,873 - INFO - Generating LLM report...
2025-09-15 04:44:09,313 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues since it has exited unexpectedly."}
2025-09-15 04:49:09,313 - INFO - Running monitoring cycle...
2025-09-15 04:49:11,409 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:49:11,410 - INFO - Generating LLM report...
2025-09-15 04:49:15,896 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited without completing its intended function."}
2025-09-15 04:54:15,896 - INFO - Running monitoring cycle...
2025-09-15 04:54:17,996 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:54:17,996 - INFO - Generating LLM report...
2025-09-15 04:54:22,383 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped because it exited unexpectedly."}
2025-09-15 04:59:22,383 - INFO - Running monitoring cycle...
2025-09-15 04:59:24,512 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 04:59:24,512 - INFO - Generating LLM report...
2025-09-15 04:59:28,919 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped; it exited unexpectedly."}
2025-09-15 05:04:28,919 - INFO - Running monitoring cycle...
2025-09-15 05:06:54,084 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 05:06:54,085 - INFO - Generating LLM report...
2025-09-15 05:06:58,635 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is stopped with status exited; current state indicates it did not start properly."}
2025-09-15 05:11:58,635 - INFO - Running monitoring cycle...
2025-09-15 05:12:00,747 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 05:12:00,747 - INFO - Generating LLM report...
2025-09-15 05:12:05,264 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped (exited). It needs to be restarted."}
2025-09-15 05:17:05,265 - INFO - Running monitoring cycle...
2025-09-15 05:17:07,399 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 05:17:07,399 - INFO - Generating LLM report...
2025-09-15 05:17:11,941 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is stopped with status exited; this can cause application downtime if it was running."}
2025-09-15 05:22:11,941 - INFO - Running monitoring cycle...
2025-09-15 05:22:14,045 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 05:22:14,045 - INFO - Generating LLM report...
2025-09-15 05:22:18,427 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is down because it has exited unexpectedly."}
2025-09-15 05:27:18,428 - INFO - Running monitoring cycle...
2025-09-15 05:33:49,638 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 05:33:49,638 - INFO - Generating LLM report...
2025-09-15 05:33:54,110 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited unexpectedly."}
2025-09-15 05:38:54,111 - INFO - Running monitoring cycle...
2025-09-15 05:38:56,191 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 05:38:56,191 - INFO - Generating LLM report...
2025-09-15 05:39:00,598 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited without running."}
2025-09-15 05:44:00,598 - INFO - Running monitoring cycle...
2025-09-15 05:44:02,752 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 05:44:02,752 - INFO - Generating LLM report...
2025-09-15 05:44:07,209 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is not running due to its current status being exited."}
2025-09-15 05:49:07,210 - INFO - Running monitoring cycle...
2025-09-15 05:49:09,336 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 05:49:09,336 - INFO - Generating LLM report...
2025-09-15 05:49:13,748 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped with status exited."}
2025-09-15 05:54:13,749 - INFO - Running monitoring cycle...
2025-09-15 06:01:11,734 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:01:11,735 - INFO - Generating LLM report...
2025-09-15 06:01:16,281 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited without completing its intended task."}
2025-09-15 06:06:16,281 - INFO - Running monitoring cycle...
2025-09-15 06:06:18,358 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:06:18,358 - INFO - Generating LLM report...
2025-09-15 06:06:22,810 - INFO - LLM Response: {'severity': 'high', 'reason': "The Docker container 'minecraft' is currently not running; it exited unexpectedly."}
2025-09-15 06:11:22,810 - INFO - Running monitoring cycle...
2025-09-15 06:11:24,896 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:11:24,896 - INFO - Generating LLM report...
2025-09-15 06:11:29,368 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues with its operational status; it has exited unexpectedly."}
2025-09-15 06:16:29,368 - INFO - Running monitoring cycle...
2025-09-15 06:16:31,452 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:16:31,452 - INFO - Generating LLM report...
2025-09-15 06:16:35,863 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently exited; it needs restarting."}
2025-09-15 06:21:35,864 - INFO - Running monitoring cycle...
2025-09-15 06:26:27,967 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:26:27,967 - INFO - Generating LLM report...
2025-09-15 06:26:32,378 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited unexpectedly."}
2025-09-15 06:31:32,378 - INFO - Running monitoring cycle...
2025-09-15 06:31:34,493 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:31:34,494 - INFO - Generating LLM report...
2025-09-15 06:31:39,022 - INFO - LLM Response: {'severity': 'high', 'reason': "The Docker container named 'minecraft' is currently stopped; its status indicates that it has exited."}
2025-09-15 06:36:39,022 - INFO - Running monitoring cycle...
2025-09-15 06:36:41,124 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:36:41,124 - INFO - Generating LLM report...
2025-09-15 06:36:45,614 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently exited; it was previously running but has stopped without apparent cause."}
2025-09-15 06:41:45,614 - INFO - Running monitoring cycle...
2025-09-15 06:41:47,715 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:41:47,715 - INFO - Generating LLM report...
2025-09-15 06:41:52,176 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited without starting."}
2025-09-15 06:46:52,177 - INFO - Running monitoring cycle...
2025-09-15 06:47:20,506 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:47:20,506 - INFO - Generating LLM report...
2025-09-15 06:47:24,980 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped with status 'exited'."}
2025-09-15 06:52:24,980 - INFO - Running monitoring cycle...
2025-09-15 06:52:27,071 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:52:27,071 - INFO - Generating LLM report...
2025-09-15 06:52:31,558 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing a critical issue since it exited; it's currently non-operational."}
2025-09-15 06:57:31,559 - INFO - Running monitoring cycle...
2025-09-15 06:57:33,644 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 06:57:33,644 - INFO - Generating LLM report...
2025-09-15 06:57:38,061 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues since it exited unexpectedly without running."}
2025-09-15 07:02:38,061 - INFO - Running monitoring cycle...
2025-09-15 07:02:40,160 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:02:40,160 - INFO - Generating LLM report...
2025-09-15 07:02:44,585 - INFO - LLM Response: {'severity': 'high', 'reason': "The Docker container named 'minecraft' is currently stopped because it has exited."}
2025-09-15 07:07:44,585 - INFO - Running monitoring cycle...
2025-09-15 07:08:51,220 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:08:51,220 - INFO - Generating LLM report...
2025-09-15 07:08:55,675 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped; it exited unexpectedly."}
2025-09-15 07:13:55,675 - INFO - Running monitoring cycle...
2025-09-15 07:13:57,772 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:13:57,773 - INFO - Generating LLM report...
2025-09-15 07:14:02,247 - INFO - LLM Response: {'severity': 'high', 'reason': "The Docker container named 'minecraft' has exited unexpectedly; it is currently stopped."}
2025-09-15 07:19:02,247 - INFO - Running monitoring cycle...
2025-09-15 07:19:04,378 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:19:04,378 - INFO - Generating LLM report...
2025-09-15 07:19:08,835 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped because it exited unexpectedly."}
2025-09-15 07:24:08,836 - INFO - Running monitoring cycle...
2025-09-15 07:24:10,941 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:24:10,941 - INFO - Generating LLM report...
2025-09-15 07:24:15,376 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing a critical issue: it has exited unexpectedly."}
2025-09-15 07:29:15,376 - INFO - Running monitoring cycle...
2025-09-15 07:31:35,749 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:31:35,749 - INFO - Generating LLM report...
2025-09-15 07:31:40,194 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues; it has exited unexpectedly."}
2025-09-15 07:36:40,195 - INFO - Running monitoring cycle...
2025-09-15 07:36:42,291 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:36:42,291 - INFO - Generating LLM report...
2025-09-15 07:36:46,704 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is reported missing; it exited unexpectedly."}
2025-09-15 07:41:46,705 - INFO - Running monitoring cycle...
2025-09-15 07:41:48,797 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:41:48,797 - INFO - Generating LLM report...
2025-09-15 07:41:53,308 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently exited; it was previously running but has stopped unexpectedly."}
2025-09-15 07:46:53,309 - INFO - Running monitoring cycle...
2025-09-15 07:46:55,406 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:46:55,406 - INFO - Generating LLM report...
2025-09-15 07:46:59,887 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is currently stopped (exited), which may lead to service disruption."}
2025-09-15 07:51:59,887 - INFO - Running monitoring cycle...
2025-09-15 07:54:25,483 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:54:25,483 - INFO - Generating LLM report...
2025-09-15 07:54:30,100 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing a high severity issue due to it being non-operational with its current status reported as exited."}
2025-09-15 07:59:30,100 - INFO - Running monitoring cycle...
2025-09-15 07:59:32,238 - INFO - Detected 1 anomalies: [{'severity': 'high', 'reason': "Docker container 'minecraft' is not running. Current status: exited"}]
2025-09-15 07:59:32,238 - INFO - Generating LLM report...
2025-09-15 07:59:36,730 - INFO - LLM Response: {'severity': 'high', 'reason': "Docker container 'minecraft' is experiencing issues since it exited without completing its intended tasks."}
2025-09-15 08:04:36,731 - INFO - Running monitoring cycle...
2025-09-15 08:09:38,841 - INFO - Running monitoring cycle...
2025-09-15 08:14:40,943 - INFO - Running monitoring cycle...
2025-09-15 08:22:01,659 - INFO - Running monitoring cycle...
2025-09-15 08:27:03,759 - INFO - Running monitoring cycle...
2025-09-15 08:32:05,908 - INFO - Running monitoring cycle...
2025-09-15 08:37:08,055 - INFO - Running monitoring cycle...
2025-09-15 08:45:34,653 - INFO - Running monitoring cycle...
2025-09-15 08:50:36,768 - INFO - Running monitoring cycle...
2025-09-15 08:55:38,898 - INFO - Running monitoring cycle...
2025-09-15 09:00:40,997 - INFO - Running monitoring cycle...
2025-09-15 09:07:54,915 - INFO - Running monitoring cycle...
2025-09-15 09:12:57,048 - INFO - Running monitoring cycle...
2025-09-15 09:17:59,145 - INFO - Running monitoring cycle...
2025-09-15 09:23:01,297 - INFO - Running monitoring cycle...
2025-09-15 09:28:39,356 - INFO - Running monitoring cycle...
2025-09-15 09:33:41,445 - INFO - Running monitoring cycle...
2025-09-15 09:38:43,524 - INFO - Running monitoring cycle...
2025-09-15 09:43:45,620 - INFO - Running monitoring cycle...
2025-09-15 09:49:26,414 - INFO - Running monitoring cycle...
2025-09-15 09:54:28,554 - INFO - Running monitoring cycle...
2025-09-15 09:59:30,653 - INFO - Running monitoring cycle...
2025-09-15 10:04:32,778 - INFO - Running monitoring cycle...
2025-09-15 10:13:01,370 - INFO - Running monitoring cycle...
2025-09-15 10:18:03,453 - INFO - Running monitoring cycle...
2025-09-15 10:23:05,550 - INFO - Running monitoring cycle...
2025-09-15 10:28:07,634 - INFO - Running monitoring cycle...
2025-09-15 10:36:19,972 - INFO - Running monitoring cycle...
2025-09-15 10:41:22,091 - INFO - Running monitoring cycle...
2025-09-15 10:46:24,244 - INFO - Running monitoring cycle...
2025-09-15 10:51:26,346 - INFO - Running monitoring cycle...
2025-09-15 11:00:24,637 - INFO - Running monitoring cycle...
2025-09-15 11:05:26,720 - INFO - Running monitoring cycle...
2025-09-15 11:10:28,819 - INFO - Running monitoring cycle...
2025-09-15 11:15:30,897 - INFO - Running monitoring cycle...
2025-09-15 11:24:21,912 - INFO - Running monitoring cycle...
2025-09-15 11:29:23,994 - INFO - Running monitoring cycle...
2025-09-15 11:34:26,089 - INFO - Running monitoring cycle...
2025-09-15 11:39:28,234 - INFO - Running monitoring cycle...
2025-09-15 11:50:22,435 - INFO - Running monitoring cycle...
2025-09-15 11:55:24,575 - INFO - Running monitoring cycle...
2025-09-15 12:00:26,724 - INFO - Running monitoring cycle...
2025-09-15 12:05:28,874 - INFO - Running monitoring cycle...
2025-09-15 12:12:34,647 - INFO - Running monitoring cycle...
2025-09-15 12:17:36,748 - INFO - Running monitoring cycle...
2025-09-15 12:22:38,907 - INFO - Running monitoring cycle...
2025-09-15 12:27:40,996 - INFO - Running monitoring cycle...
2025-09-15 12:34:57,190 - INFO - Running monitoring cycle...
2025-09-15 12:39:59,344 - INFO - Running monitoring cycle...
2025-09-15 12:42:28,467 - INFO - Running monitoring cycle...
2025-09-15 12:43:10,948 - INFO - Running monitoring cycle...
2025-09-15 12:43:13,084 - WARNING - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 12:45:11,051 - INFO - Running in test mode...
2025-09-15 12:45:11,051 - INFO - Running monitoring cycle...
2025-09-15 12:45:13,146 - WARNING - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 12:45:44,457 - INFO - Running in test mode...
2025-09-15 12:45:44,457 - INFO - Running monitoring cycle...
2025-09-15 12:45:46,590 - WARNING - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 12:46:33,528 - INFO - Running in test mode...
2025-09-15 12:46:33,529 - INFO - Running monitoring cycle...
2025-09-15 12:46:35,614 - WARNING - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 12:47:39,333 - INFO - Running in test mode...
2025-09-15 12:47:39,333 - INFO - Running monitoring cycle...
2025-09-15 12:47:41,432 - WARNING - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 12:58:20,016 - DEBUG - Entering main
2025-09-15 12:58:20,016 - INFO - Running in test mode...
2025-09-15 12:58:20,016 - DEBUG - Entering run_monitoring_cycle
2025-09-15 12:58:20,016 - INFO - Running monitoring cycle...
2025-09-15 12:58:20,016 - DEBUG - Entering get_system_logs
2025-09-15 12:58:20,016 - DEBUG - Exiting get_system_logs
2025-09-15 12:58:20,016 - DEBUG - Entering get_network_metrics
2025-09-15 12:58:22,047 - DEBUG - Exiting get_network_metrics
2025-09-15 12:58:22,061 - DEBUG - Entering get_sensor_data
2025-09-15 12:58:22,078 - DEBUG - Exiting get_sensor_data
2025-09-15 12:58:22,078 - DEBUG - Entering get_cpu_temperature
2025-09-15 12:58:22,078 - DEBUG - Exiting get_cpu_temperature
2025-09-15 12:58:22,078 - DEBUG - Entering get_gpu_temperature
2025-09-15 12:58:22,078 - DEBUG - Exiting get_gpu_temperature
2025-09-15 12:58:22,079 - DEBUG - Entering get_login_attempts
2025-09-15 12:58:22,079 - DEBUG - Exiting get_login_attempts
2025-09-15 12:58:22,079 - DEBUG - Entering get_docker_container_status
2025-09-15 12:58:22,111 - DEBUG - Exiting get_docker_container_status
2025-09-15 12:58:22,113 - DEBUG - Entering get_nmap_scan_results
2025-09-15 12:58:22,117 - WARNING - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 12:58:28,544 - DEBUG - Exiting get_nmap_scan_results
2025-09-15 12:58:28,552 - DEBUG - Entering analyze_data_locally
2025-09-15 12:58:28,553 - DEBUG - Exiting analyze_data_locally
2025-09-15 12:58:28,553 - DEBUG - Exiting run_monitoring_cycle
2025-09-15 12:58:28,553 - DEBUG - Exiting main
2025-09-15 12:58:31,241 - DEBUG - Entering main
2025-09-15 12:58:31,242 - INFO - Running in test mode...
2025-09-15 12:58:31,242 - DEBUG - Entering run_monitoring_cycle
2025-09-15 12:58:31,242 - INFO - Running monitoring cycle...
2025-09-15 12:58:31,242 - DEBUG - Entering get_system_logs
2025-09-15 12:58:31,242 - DEBUG - Exiting get_system_logs
2025-09-15 12:58:31,242 - DEBUG - Entering get_network_metrics
2025-09-15 12:58:33,272 - DEBUG - Exiting get_network_metrics
2025-09-15 12:58:33,275 - DEBUG - Entering get_sensor_data
2025-09-15 12:58:33,289 - DEBUG - Exiting get_sensor_data
2025-09-15 12:58:33,289 - DEBUG - Entering get_cpu_temperature
2025-09-15 12:58:33,289 - DEBUG - Exiting get_cpu_temperature
2025-09-15 12:58:33,289 - DEBUG - Entering get_gpu_temperature
2025-09-15 12:58:33,289 - DEBUG - Exiting get_gpu_temperature
2025-09-15 12:58:33,289 - DEBUG - Entering get_login_attempts
2025-09-15 12:58:33,290 - DEBUG - Exiting get_login_attempts
2025-09-15 12:58:33,290 - DEBUG - Entering get_docker_container_status
2025-09-15 12:58:33,319 - DEBUG - Exiting get_docker_container_status
2025-09-15 12:58:33,320 - DEBUG - Entering get_nmap_scan_results
2025-09-15 12:58:33,324 - WARNING - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 12:59:20,558 - DEBUG - Exiting get_nmap_scan_results
2025-09-15 12:59:20,568 - DEBUG - Entering analyze_data_locally
2025-09-15 12:59:20,569 - DEBUG - Exiting analyze_data_locally
2025-09-15 12:59:20,569 - DEBUG - Exiting run_monitoring_cycle
2025-09-15 12:59:20,569 - DEBUG - Exiting main
2025-09-15 12:59:45,756 - DEBUG - __main__ - Entering main
2025-09-15 12:59:45,756 - INFO - database - Database initialized successfully.
2025-09-15 12:59:45,756 - INFO - __main__ - Running in test mode...
2025-09-15 12:59:45,756 - DEBUG - __main__ - Entering run_monitoring_cycle
2025-09-15 12:59:45,756 - INFO - __main__ - Running monitoring cycle...
2025-09-15 12:59:45,757 - DEBUG - __main__ - Entering get_system_logs
2025-09-15 12:59:45,757 - DEBUG - __main__ - Exiting get_system_logs
2025-09-15 12:59:45,757 - DEBUG - __main__ - Entering get_network_metrics
2025-09-15 12:59:47,785 - DEBUG - __main__ - Exiting get_network_metrics
2025-09-15 12:59:47,795 - DEBUG - __main__ - Entering get_sensor_data
2025-09-15 12:59:47,819 - DEBUG - __main__ - Exiting get_sensor_data
2025-09-15 12:59:47,820 - DEBUG - __main__ - Entering get_cpu_temperature
2025-09-15 12:59:47,820 - DEBUG - __main__ - Exiting get_cpu_temperature
2025-09-15 12:59:47,820 - DEBUG - __main__ - Entering get_gpu_temperature
2025-09-15 12:59:47,821 - DEBUG - __main__ - Exiting get_gpu_temperature
2025-09-15 12:59:47,821 - DEBUG - __main__ - Entering get_login_attempts
2025-09-15 12:59:47,821 - DEBUG - __main__ - Exiting get_login_attempts
2025-09-15 12:59:47,822 - DEBUG - __main__ - Entering get_docker_container_status
2025-09-15 12:59:47,822 - DEBUG - docker.utils.config - Trying paths: ['/home/artanis/.docker/config.json', '/home/artanis/.dockercfg']
2025-09-15 12:59:47,822 - DEBUG - docker.utils.config - No config file found
2025-09-15 12:59:47,823 - DEBUG - docker.utils.config - Trying paths: ['/home/artanis/.docker/config.json', '/home/artanis/.dockercfg']
2025-09-15 12:59:47,823 - DEBUG - docker.utils.config - No config file found
2025-09-15 12:59:47,833 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /version HTTP/1.1" 200 822
2025-09-15 12:59:47,836 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/json?limit=-1&all=1&size=0&trunc_cmd=0 HTTP/1.1" 200 None
2025-09-15 12:59:47,838 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/6fe246915fcd7e9ba47ab659c2bded702a248ba7ba0bea67d5440a429059ecf9/json HTTP/1.1" 200 None
2025-09-15 12:59:47,839 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/db9267cbc792fd3b42cbe3c91a81c9e9d9c8f10784264bbaa5dd6c8443f1ebec/json HTTP/1.1" 200 None
2025-09-15 12:59:47,840 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/04947c346ebea841c3ff66821fb02cceb1ce6fc1e249dda03f6cfcc7ab1387ee/json HTTP/1.1" 200 None
2025-09-15 12:59:47,841 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/892ca3318ca6c7f59efdafb7c7fe72c2fd29b2163ba93bd7a96b08bdf11149c7/json HTTP/1.1" 200 None
2025-09-15 12:59:47,842 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/e4c49da7ccd7dbe046e4b16b44da696c7ff6dbe2bfce332f55830677c8bb5385/json HTTP/1.1" 200 None
2025-09-15 12:59:47,843 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/eaf91d09a18ebc4c4a5273ea3e40ee5b235ff601b36df03b622ef7d4c711e14d/json HTTP/1.1" 200 None
2025-09-15 12:59:47,845 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/8ee77507e001ffa2e3c49fd0dff574b560301c74fe897e44d1b64bb30891b5dd/json HTTP/1.1" 200 None
2025-09-15 12:59:47,846 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/193897be46b32bbdcd70d9f8f00f4bb3a0ba4a9ad23222620a15b65aaa9407ea/json HTTP/1.1" 200 None
2025-09-15 12:59:47,847 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/ea66b86039b4d69764c32380e51f437cff7f5edd693c08343a6a305caf52d329/json HTTP/1.1" 200 None
2025-09-15 12:59:47,848 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/3af5798ed8340c94591efaa44b4beed306c4b753380f8fde0fd66dafcbf7491b/json HTTP/1.1" 200 None
2025-09-15 12:59:47,849 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/9bada910535adab609ae61c561e3373b2f7c5749fe831406f4f95d4262c40768/json HTTP/1.1" 200 None
2025-09-15 12:59:47,850 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/c8349318a9b41ee73228fd8017e54bfda30f09e196688b0e1adfdfe88d0e7809/json HTTP/1.1" 200 None
2025-09-15 12:59:47,851 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/dcaec110abb26aebf65c0dd85daccc345283ec3d6bacf3d64e42fbe8187ec005/json HTTP/1.1" 200 None
2025-09-15 12:59:47,852 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/2e4b6585210f65df2ec680fe3df7673fc7c5078d24e2103677409ece211b71c4/json HTTP/1.1" 200 None
2025-09-15 12:59:47,853 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/cd875071300812e4c3a15e2c84b9b73b36f67a236c1fdd46c5a49f3992aa429f/json HTTP/1.1" 200 None
2025-09-15 12:59:47,854 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/393705e06222d67c9de37dce4b03c036bc3774deb9d8a39bda8096481be569c3/json HTTP/1.1" 200 None
2025-09-15 12:59:47,856 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/0ca3adee66289acbaff8a2cae54e888b3fffe2f8b645ce326cf9072023f2d81c/json HTTP/1.1" 200 None
2025-09-15 12:59:47,858 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/1a4d4abeea6d3488f754679bde7063749213120e9f243c56f060a636ae5ea187/json HTTP/1.1" 200 None
2025-09-15 12:59:47,859 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/ae68bc651bf3188f354038b4acc819b30960bb0ce6e6569b132562f15b9d54e8/json HTTP/1.1" 200 None
2025-09-15 12:59:47,859 - DEBUG - __main__ - Exiting get_docker_container_status
2025-09-15 12:59:47,861 - DEBUG - __main__ - Entering get_nmap_scan_results
2025-09-15 12:59:47,865 - WARNING - __main__ - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 13:00:16,585 - DEBUG - __main__ - Exiting get_nmap_scan_results
2025-09-15 13:00:16,588 - INFO - database - Retention cutoff: 2025-09-15T18:00:15.588626+00:00
2025-09-15 13:00:16,589 - INFO - database - Found 1 old records to delete.
2025-09-15 13:00:16,591 - INFO - database - Deleted 1 old records.
2025-09-15 13:00:16,591 - DEBUG - __main__ - Entering analyze_data_locally
2025-09-15 13:00:16,591 - DEBUG - __main__ - Exiting analyze_data_locally
2025-09-15 13:00:16,591 - DEBUG - __main__ - Exiting run_monitoring_cycle
2025-09-15 13:00:16,591 - DEBUG - __main__ - Exiting main
2025-09-15 13:00:19,271 - DEBUG - __main__ - Entering main
2025-09-15 13:00:19,271 - INFO - database - Database initialized successfully.
2025-09-15 13:00:19,271 - INFO - __main__ - Running in test mode...
2025-09-15 13:00:19,271 - DEBUG - __main__ - Entering run_monitoring_cycle
2025-09-15 13:00:19,271 - INFO - __main__ - Running monitoring cycle...
2025-09-15 13:00:19,271 - DEBUG - __main__ - Entering get_system_logs
2025-09-15 13:00:19,271 - DEBUG - __main__ - Exiting get_system_logs
2025-09-15 13:00:19,272 - DEBUG - __main__ - Entering get_network_metrics
2025-09-15 13:00:21,297 - DEBUG - __main__ - Exiting get_network_metrics
2025-09-15 13:00:21,299 - DEBUG - __main__ - Entering get_sensor_data
2025-09-15 13:00:21,314 - DEBUG - __main__ - Exiting get_sensor_data
2025-09-15 13:00:21,314 - DEBUG - __main__ - Entering get_cpu_temperature
2025-09-15 13:00:21,315 - DEBUG - __main__ - Exiting get_cpu_temperature
2025-09-15 13:00:21,315 - DEBUG - __main__ - Entering get_gpu_temperature
2025-09-15 13:00:21,315 - DEBUG - __main__ - Exiting get_gpu_temperature
2025-09-15 13:00:21,315 - DEBUG - __main__ - Entering get_login_attempts
2025-09-15 13:00:21,315 - DEBUG - __main__ - Exiting get_login_attempts
2025-09-15 13:00:21,315 - DEBUG - __main__ - Entering get_docker_container_status
2025-09-15 13:00:21,315 - DEBUG - docker.utils.config - Trying paths: ['/home/artanis/.docker/config.json', '/home/artanis/.dockercfg']
2025-09-15 13:00:21,315 - DEBUG - docker.utils.config - No config file found
2025-09-15 13:00:21,315 - DEBUG - docker.utils.config - Trying paths: ['/home/artanis/.docker/config.json', '/home/artanis/.dockercfg']
2025-09-15 13:00:21,315 - DEBUG - docker.utils.config - No config file found
2025-09-15 13:00:21,321 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /version HTTP/1.1" 200 822
2025-09-15 13:00:21,324 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/json?limit=-1&all=1&size=0&trunc_cmd=0 HTTP/1.1" 200 None
2025-09-15 13:00:21,326 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/6fe246915fcd7e9ba47ab659c2bded702a248ba7ba0bea67d5440a429059ecf9/json HTTP/1.1" 200 None
2025-09-15 13:00:21,327 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/db9267cbc792fd3b42cbe3c91a81c9e9d9c8f10784264bbaa5dd6c8443f1ebec/json HTTP/1.1" 200 None
2025-09-15 13:00:21,328 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/04947c346ebea841c3ff66821fb02cceb1ce6fc1e249dda03f6cfcc7ab1387ee/json HTTP/1.1" 200 None
2025-09-15 13:00:21,329 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/892ca3318ca6c7f59efdafb7c7fe72c2fd29b2163ba93bd7a96b08bdf11149c7/json HTTP/1.1" 200 None
2025-09-15 13:00:21,331 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/e4c49da7ccd7dbe046e4b16b44da696c7ff6dbe2bfce332f55830677c8bb5385/json HTTP/1.1" 200 None
2025-09-15 13:00:21,332 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/eaf91d09a18ebc4c4a5273ea3e40ee5b235ff601b36df03b622ef7d4c711e14d/json HTTP/1.1" 200 None
2025-09-15 13:00:21,334 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/8ee77507e001ffa2e3c49fd0dff574b560301c74fe897e44d1b64bb30891b5dd/json HTTP/1.1" 200 None
2025-09-15 13:00:21,335 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/193897be46b32bbdcd70d9f8f00f4bb3a0ba4a9ad23222620a15b65aaa9407ea/json HTTP/1.1" 200 None
2025-09-15 13:00:21,336 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/ea66b86039b4d69764c32380e51f437cff7f5edd693c08343a6a305caf52d329/json HTTP/1.1" 200 None
2025-09-15 13:00:21,337 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/3af5798ed8340c94591efaa44b4beed306c4b753380f8fde0fd66dafcbf7491b/json HTTP/1.1" 200 None
2025-09-15 13:00:21,338 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/9bada910535adab609ae61c561e3373b2f7c5749fe831406f4f95d4262c40768/json HTTP/1.1" 200 None
2025-09-15 13:00:21,339 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/c8349318a9b41ee73228fd8017e54bfda30f09e196688b0e1adfdfe88d0e7809/json HTTP/1.1" 200 None
2025-09-15 13:00:21,340 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/dcaec110abb26aebf65c0dd85daccc345283ec3d6bacf3d64e42fbe8187ec005/json HTTP/1.1" 200 None
2025-09-15 13:00:21,341 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/2e4b6585210f65df2ec680fe3df7673fc7c5078d24e2103677409ece211b71c4/json HTTP/1.1" 200 None
2025-09-15 13:00:21,343 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/cd875071300812e4c3a15e2c84b9b73b36f67a236c1fdd46c5a49f3992aa429f/json HTTP/1.1" 200 None
2025-09-15 13:00:21,344 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/393705e06222d67c9de37dce4b03c036bc3774deb9d8a39bda8096481be569c3/json HTTP/1.1" 200 None
2025-09-15 13:00:21,345 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/0ca3adee66289acbaff8a2cae54e888b3fffe2f8b645ce326cf9072023f2d81c/json HTTP/1.1" 200 None
2025-09-15 13:00:21,346 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/1a4d4abeea6d3488f754679bde7063749213120e9f243c56f060a636ae5ea187/json HTTP/1.1" 200 None
2025-09-15 13:00:21,347 - DEBUG - urllib3.connectionpool - http://localhost:None "GET /v1.51/containers/ae68bc651bf3188f354038b4acc819b30960bb0ce6e6569b132562f15b9d54e8/json HTTP/1.1" 200 None
2025-09-15 13:00:21,347 - DEBUG - __main__ - Exiting get_docker_container_status
2025-09-15 13:00:21,349 - DEBUG - __main__ - Entering get_nmap_scan_results
2025-09-15 13:00:21,353 - WARNING - __main__ - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 13:05:10,688 - DEBUG - __main__ - Exiting get_nmap_scan_results
2025-09-15 13:05:10,691 - INFO - database - Retention cutoff: 2025-09-15T18:05:09.691390+00:00
2025-09-15 13:05:10,691 - INFO - database - Found 1 old records to delete.
2025-09-15 13:05:10,693 - INFO - database - Deleted 1 old records.
2025-09-15 13:05:10,694 - DEBUG - __main__ - Entering analyze_data_locally
2025-09-15 13:05:10,695 - DEBUG - __main__ - Exiting analyze_data_locally
2025-09-15 13:05:10,695 - DEBUG - __main__ - Exiting run_monitoring_cycle
2025-09-15 13:05:10,695 - DEBUG - __main__ - Exiting main
2025-09-15 13:21:41,948 - INFO - Running in test mode...
2025-09-15 13:21:41,949 - INFO - Running monitoring cycle...
2025-09-15 13:21:44,096 - WARNING - Nmap -sS scan requires root privileges. Falling back to -sT.
2025-09-15 13:21:56,641 - INFO - Detected 9 anomalies: [{'severity': 'high', 'reason': 'High number of blocked connections (1477) from IP address: 23.28.198.165'}, {'severity': 'high', 'reason': 'High number of blocked connections (33) from IP address: 84.252.134.217'}, {'severity': 'high', 'reason': 'High number of blocked connections (140) from IP address: 51.250.10.6'}, {'severity': 'high', 'reason': 'High number of blocked connections (48) from IP address: 158.160.20.113'}, {'severity': 'high', 'reason': 'High number of blocked connections (13) from IP address: 182.93.50.90'}, {'severity': 'high', 'reason': 'High number of blocked connections (82) from IP address: 172.22.0.2'}, {'severity': 'high', 'reason': 'High number of blocked connections (591) from IP address: 192.168.2.117'}, {'severity': 'high', 'reason': 'High number of blocked connections (12) from IP address: 172.23.0.2'}, {'severity': 'high', 'reason': 'High number of blocked connections (11) from IP address: 192.168.2.104'}]
2025-09-15 13:21:56,642 - INFO - Generating LLM report...
2025-09-15 13:22:04,084 - INFO - LLM Response: {'severity': 'high', 'reason': 'High number of blocked connections detected from multiple IP addresses: 23.28.198.165 (1477), 84.252.134.217 (33), 51.250.10.6 (140), 158.160.20.113 (48), 182.93.50.90 (13), 172.22.0.2 (82), 192.168.2.117 (591), 172.23.0.2 (12), and 192.168.2.104 (11). This indicates a potential coordinated attack or misconfigured system.'}
2025-09-15 13:22:04,982 - ERROR - Error sending Discord alert: 400 - b'{"content": ["Must be 2000 or fewer in length."]}'
2025-09-15 13:22:11,390 - INFO - Google Home alert sent successfully.
2025-09-15 13:25:08,619 - INFO - Running monitoring cycle...

View File

@@ -0,0 +1,32 @@
2025-09-14 20:27:49,614 - INFO - Running monitoring cycle...
2025-09-14 20:34:15,578 - INFO - Running monitoring cycle...
2025-09-14 20:39:17,650 - INFO - Running monitoring cycle...
2025-09-14 20:44:19,738 - INFO - Running monitoring cycle...
2025-09-14 20:49:21,809 - INFO - Running monitoring cycle...
2025-09-14 20:55:57,821 - INFO - Running monitoring cycle...
2025-09-14 21:00:59,895 - INFO - Running monitoring cycle...
2025-09-14 21:06:02,000 - INFO - Running monitoring cycle...
2025-09-14 21:11:04,092 - INFO - Running monitoring cycle...
2025-09-14 21:46:00,340 - INFO - Running monitoring cycle...
2025-09-14 21:51:02,413 - INFO - Running monitoring cycle...
2025-09-14 21:56:04,515 - INFO - Running monitoring cycle...
2025-09-14 22:01:06,608 - INFO - Running monitoring cycle...
2025-09-14 22:08:01,730 - INFO - Running monitoring cycle...
2025-09-14 22:13:03,882 - INFO - Running monitoring cycle...
2025-09-14 22:18:06,032 - INFO - Running monitoring cycle...
2025-09-14 22:23:08,183 - INFO - Running monitoring cycle...
2025-09-14 22:29:47,066 - INFO - Running monitoring cycle...
2025-09-14 22:34:49,156 - INFO - Running monitoring cycle...
2025-09-14 22:39:51,311 - INFO - Running monitoring cycle...
2025-09-14 22:44:53,423 - INFO - Running monitoring cycle...
2025-09-14 22:53:51,148 - INFO - Running monitoring cycle...
2025-09-14 22:58:53,301 - INFO - Running monitoring cycle...
2025-09-14 23:03:55,388 - INFO - Running monitoring cycle...
2025-09-14 23:08:57,530 - INFO - Running monitoring cycle...
2025-09-14 23:18:07,849 - INFO - Running monitoring cycle...
2025-09-14 23:23:09,993 - INFO - Running monitoring cycle...
2025-09-14 23:28:12,167 - INFO - Running monitoring cycle...
2025-09-14 23:33:14,332 - INFO - Running monitoring cycle...
2025-09-14 23:46:15,054 - INFO - Running monitoring cycle...
2025-09-14 23:51:17,204 - INFO - Running monitoring cycle...
2025-09-14 23:56:19,308 - INFO - Running monitoring cycle...

1
ufw_log_position.txt Normal file
View File

@@ -0,0 +1 @@
822805