Files
html/api/arch-scanner-wrap.py
2026-04-12 22:57:03 +02:00

53 lines
1.9 KiB
Python
Executable File

#!/usr/bin/env python3
import json, os
print("=== ARCHITECTURE INDEX ===")
try:
with open('/var/www/html/api/architecture-index.json') as f:
d = json.load(f)
print(f"Generated: {d.get('generated','?')[:16]}")
for sv in d.get('servers',[]):
print(f" {sv.get('id','?')} {sv.get('role','?')} disk:{sv.get('disk_pct','?')}%")
print(f"Docker: {len(d.get('docker',[]))}")
print(f"Domains: {len(d.get('domains',[]))}")
print(f"Ollama: {len(d.get('ollama',[]))}")
print(f"Qdrant: {len(d.get('qdrant',[]))}")
print(f"Screens: {len(d.get('screens',[]))}")
auth = d.get('auth',{})
print(f"Auth: {auth.get('system','?')} protected={auth.get('protected_count','?')}")
except Exception as e:
print(f"ERROR: {e}")
print()
print("=== TOPOLOGY ===")
try:
with open('/var/www/html/api/architecture-topology.json') as f:
t = json.load(f)
nodes = t.get('nodes',[])
print(f"Nodes: {len(nodes)}")
print(f"AI Optimizations: {len(t.get('ai_optimizations',[]))}")
print(f"BPMN Processes: {len(t.get('bpmn_processes',[]))}")
print(f"SOA Services: {len(t.get('soa_services',[]))}")
for s in t.get('soa_services',[])[:8]:
print(f" {s.get('name','?'):20s} {s.get('status','?')}")
except Exception as e:
print(f"ERROR: {e}")
print()
print("=== AUTONOMOUS ===")
import subprocess
r = subprocess.run(['php','/var/www/html/api/architecture-autonomous.php'], capture_output=True, text=True, timeout=10)
try:
a = json.loads(r.stdout)
nodes = a.get('nodes',[])
up = sum(1 for n in nodes if n.get('status')=='up')
print(f"Nodes: {len(nodes)} total, {up} UP")
groups = {}
for n in nodes:
g = n.get('group','other')
groups[g] = groups.get(g,0)+1
for g,c in sorted(groups.items(), key=lambda x:-x[1]):
print(f" {g:15s}: {c}")
except Exception as e:
print(f"ERROR: {e}")