34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Quick system diagnostics - generates a JSON report."""
|
|
import json
|
|
import os
|
|
import platform
|
|
import socket
|
|
from datetime import datetime, timezone
|
|
from pathlib import Path
|
|
|
|
def get_system_info():
|
|
return {
|
|
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
"hostname": socket.gethostname(),
|
|
"platform": platform.platform(),
|
|
"python_version": platform.python_version(),
|
|
"working_directory": os.getcwd(),
|
|
"user": os.environ.get("USER", "unknown"),
|
|
"home": str(Path.home()),
|
|
"environment_vars": {
|
|
k: v for k, v in os.environ.items()
|
|
if k in ["PATH", "HOME", "USER", "SHELL", "LANG", "PWD"]
|
|
}
|
|
}
|
|
|
|
def main():
|
|
info = get_system_info()
|
|
output_path = "/root/.hermes/wizard-outputs/spark/report.json"
|
|
with open(output_path, "w") as f:
|
|
json.dump(info, f, indent=2)
|
|
print(f"Report written to: {output_path}")
|
|
print(json.dumps(info, indent=2))
|
|
|
|
if __name__ == "__main__":
|
|
main() |