Add Loki and Sentinel utility classes for web API endpoints

- Implemented LokiUtils class with GET and POST endpoints for managing scripts, jobs, and payloads.
- Added SentinelUtils class with GET and POST endpoints for managing events, rules, devices, and notifications.
- Both classes include error handling and JSON response formatting.
This commit is contained in:
infinition
2026-03-14 22:33:10 +01:00
parent eb20b168a6
commit aac77a3e76
525 changed files with 29400 additions and 13136 deletions

35
debug_schema.py Normal file
View File

@@ -0,0 +1,35 @@
import sqlite3
import os
db_path = "bjorn.db"
def check_schema():
if not os.path.exists(db_path):
print(f"Database {db_path} not found.")
return
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
tables = ["rl_training_log", "rl_experiences"]
with open("schema_debug.txt", "w") as f:
for table in tables:
f.write(f"\nSchema for {table}:\n")
try:
cursor.execute(f"PRAGMA table_info({table})")
columns = cursor.fetchall()
if not columns:
f.write(" (Table not found)\n")
else:
for col in columns:
f.write(f" - {col[1]} ({col[2]})\n")
except Exception as e:
f.write(f" Error: {e}\n")
conn.close()
if __name__ == "__main__":
check_schema()
print("Done writing to schema_debug.txt")