systemreports 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- systemreports/__init__.py +3 -0
- systemreports/__main__.py +4 -0
- systemreports/app.py +34 -0
- systemreports/cli.py +78 -0
- systemreports/collector.py +268 -0
- systemreports/static/style.css +206 -0
- systemreports/templates/index.html +298 -0
- systemreports-2.0.0.dist-info/METADATA +99 -0
- systemreports-2.0.0.dist-info/RECORD +14 -0
- systemreports-2.0.0.dist-info/WHEEL +5 -0
- systemreports-2.0.0.dist-info/entry_points.txt +2 -0
- systemreports-2.0.0.dist-info/licenses/LICENSE +201 -0
- systemreports-2.0.0.dist-info/licenses/NOTICE +5 -0
- systemreports-2.0.0.dist-info/top_level.txt +1 -0
systemreports/app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Flask app serving the system report dashboard."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
from flask import Flask, jsonify, render_template, request
|
|
8
|
+
|
|
9
|
+
from systemreports.collector import collect_report
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def create_app() -> Flask:
|
|
13
|
+
root = os.path.dirname(os.path.abspath(__file__))
|
|
14
|
+
app = Flask(
|
|
15
|
+
__name__,
|
|
16
|
+
template_folder=os.path.join(root, "templates"),
|
|
17
|
+
static_folder=os.path.join(root, "static"),
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
@app.route("/")
|
|
21
|
+
def index():
|
|
22
|
+
return render_template("index.html")
|
|
23
|
+
|
|
24
|
+
@app.route("/api/report")
|
|
25
|
+
def api_report():
|
|
26
|
+
ports = request.args.get("ports", "1").lower() not in ("0", "false", "no")
|
|
27
|
+
return jsonify(collect_report(include_listen_ports=ports))
|
|
28
|
+
|
|
29
|
+
return app
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def run_server(host: str = "127.0.0.1", port: int = 5050, debug: bool = False) -> None:
|
|
33
|
+
app = create_app()
|
|
34
|
+
app.run(host=host, port=port, debug=debug, threaded=True)
|
systemreports/cli.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Command-line entry: web dashboard or legacy text report."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import json
|
|
7
|
+
import webbrowser
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _print_text_report() -> None:
|
|
11
|
+
"""Original-style console output using the new collector."""
|
|
12
|
+
from systemreports.collector import collect_report
|
|
13
|
+
|
|
14
|
+
r = collect_report(include_listen_ports=False)
|
|
15
|
+
cpu = r["cpu"]
|
|
16
|
+
mem = r["memory"]
|
|
17
|
+
sysinfo = r["system"]
|
|
18
|
+
disk = r["disk"]
|
|
19
|
+
net = r["network"]
|
|
20
|
+
up = r["uptime"]
|
|
21
|
+
load = cpu["load_average"]
|
|
22
|
+
load_s = (
|
|
23
|
+
f"({load['1m']}, {load['5m']}, {load['15m']})" if load else "N/A (not available on this OS)"
|
|
24
|
+
)
|
|
25
|
+
print("This System Report is Generated on :-", r["generated_at"])
|
|
26
|
+
print("=========================================================")
|
|
27
|
+
print("Name of Operating System is :- ", sysinfo["os"], sysinfo["release"])
|
|
28
|
+
print("Host Name :- ", sysinfo["node"])
|
|
29
|
+
print("Load Average :- ", load_s)
|
|
30
|
+
print("System Architecture :- ", sysinfo["machine"])
|
|
31
|
+
print("Kernel / version detail :- ", sysinfo["version"][:120])
|
|
32
|
+
print("CPU model :- ", cpu["model"])
|
|
33
|
+
print("CPU cores (physical / logical) :- ", cpu["physical_cores"], "/", cpu["logical_cores"])
|
|
34
|
+
print("CPU usage % :- ", cpu["usage_percent"])
|
|
35
|
+
print("root Disk mount :- ", disk["mount"])
|
|
36
|
+
print("Disk total / used / free (GB) :- ", disk["total_gb"], "/", disk["used_gb"], "/", disk["free_gb"])
|
|
37
|
+
print("Memory total / used / free (GB) :- ", mem["total_gb"], "/", mem["used_gb"], "/", mem["free_gb"])
|
|
38
|
+
print("Swap used (GB) / % :- ", mem["swap_used_gb"], "/", mem["swap_percent"])
|
|
39
|
+
print("Process count :- ", r["processes"]["count"])
|
|
40
|
+
print("Uptime (seconds) :- ", up["seconds"])
|
|
41
|
+
print("Last boot (local) :- ", up["boot_time_iso"])
|
|
42
|
+
print("Primary IPv4 :- ", net["primary_ipv4"])
|
|
43
|
+
print("DNS google.com :- ", net["dns_google_reachable"])
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def main() -> None:
|
|
47
|
+
p = argparse.ArgumentParser(description="System report: web dashboard or CLI output.")
|
|
48
|
+
p.add_argument("--cli", action="store_true", help="Print text report to the console.")
|
|
49
|
+
p.add_argument("--json", action="store_true", help="Print full JSON report to stdout.")
|
|
50
|
+
p.add_argument("--host", default="127.0.0.1", help="Bind address for --serve.")
|
|
51
|
+
p.add_argument("--port", type=int, default=5050, help="Port for --serve.")
|
|
52
|
+
p.add_argument("--no-browser", action="store_true", help="Do not open a browser with --serve.")
|
|
53
|
+
p.add_argument("--debug", action="store_true", help="Flask debug mode (dev only).")
|
|
54
|
+
args = p.parse_args()
|
|
55
|
+
|
|
56
|
+
if args.json:
|
|
57
|
+
from systemreports.collector import collect_report
|
|
58
|
+
|
|
59
|
+
print(json.dumps(collect_report(), indent=2))
|
|
60
|
+
return
|
|
61
|
+
|
|
62
|
+
if args.cli:
|
|
63
|
+
_print_text_report()
|
|
64
|
+
return
|
|
65
|
+
|
|
66
|
+
# Default: web dashboard
|
|
67
|
+
if not args.no_browser:
|
|
68
|
+
url = f"http://{args.host}:{args.port}/"
|
|
69
|
+
if args.host in ("0.0.0.0", "::"):
|
|
70
|
+
url = f"http://127.0.0.1:{args.port}/"
|
|
71
|
+
webbrowser.open(url)
|
|
72
|
+
from systemreports.app import run_server
|
|
73
|
+
|
|
74
|
+
run_server(host=args.host, port=args.port, debug=args.debug)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if __name__ == "__main__":
|
|
78
|
+
main()
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"""Gather system metrics on Windows, macOS, and Linux."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import platform
|
|
7
|
+
import socket
|
|
8
|
+
import sys
|
|
9
|
+
import time
|
|
10
|
+
from datetime import datetime, timezone
|
|
11
|
+
from typing import Any, Dict, List, Optional
|
|
12
|
+
|
|
13
|
+
import psutil
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _root_fs_path() -> str:
|
|
17
|
+
if os.name == "nt":
|
|
18
|
+
drive = os.environ.get("SystemDrive", "C:")
|
|
19
|
+
return drive + (os.sep if not drive.endswith(("\\", "/")) else "")
|
|
20
|
+
return "/"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _bytes_to_gb(n: float) -> float:
|
|
24
|
+
return round(n / (1024**3), 2)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _bytes_to_mb(n: float) -> float:
|
|
28
|
+
return round(n / (1024**2), 2)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _safe_iso(ts: float) -> str:
|
|
32
|
+
return datetime.fromtimestamp(ts, tz=timezone.utc).astimezone().strftime("%Y-%m-%d %H:%M:%S %Z")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _cpu_model() -> str:
|
|
36
|
+
proc = platform.processor() or ""
|
|
37
|
+
if proc.strip():
|
|
38
|
+
return proc.strip()
|
|
39
|
+
if sys.platform == "darwin":
|
|
40
|
+
try:
|
|
41
|
+
import subprocess
|
|
42
|
+
|
|
43
|
+
out = subprocess.check_output(["sysctl", "-n", "machdep.cpu.brand_string"])
|
|
44
|
+
return out.decode("utf-8", errors="ignore").strip()
|
|
45
|
+
except (OSError, subprocess.CalledProcessError):
|
|
46
|
+
pass
|
|
47
|
+
if sys.platform.startswith("linux"):
|
|
48
|
+
try:
|
|
49
|
+
with open("/proc/cpuinfo", encoding="utf-8", errors="ignore") as f:
|
|
50
|
+
for line in f:
|
|
51
|
+
if line.lower().startswith("model name"):
|
|
52
|
+
return line.split(":", 1)[1].strip()
|
|
53
|
+
except OSError:
|
|
54
|
+
pass
|
|
55
|
+
return "Unknown"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _load_average() -> Optional[Dict[str, float]]:
|
|
59
|
+
try:
|
|
60
|
+
one, five, fifteen = os.getloadavg()
|
|
61
|
+
return {"1m": round(one, 2), "5m": round(five, 2), "15m": round(fifteen, 2)}
|
|
62
|
+
except (AttributeError, OSError):
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _disk_io() -> Optional[Dict[str, Any]]:
|
|
67
|
+
try:
|
|
68
|
+
io = psutil.disk_io_counters(perdisk=False)
|
|
69
|
+
if io is None:
|
|
70
|
+
return None
|
|
71
|
+
return {
|
|
72
|
+
"read_bytes": io.read_bytes,
|
|
73
|
+
"write_bytes": io.write_bytes,
|
|
74
|
+
"read_count": io.read_count,
|
|
75
|
+
"write_count": io.write_count,
|
|
76
|
+
}
|
|
77
|
+
except (RuntimeError, PermissionError):
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _network_interfaces() -> List[Dict[str, Any]]:
|
|
82
|
+
out: List[Dict[str, Any]] = []
|
|
83
|
+
addrs = psutil.net_if_addrs()
|
|
84
|
+
stats = psutil.net_if_stats()
|
|
85
|
+
for name, addr_list in addrs.items():
|
|
86
|
+
entry: Dict[str, Any] = {"name": name, "addresses": [], "is_up": None, "speed_mbps": None}
|
|
87
|
+
st = stats.get(name)
|
|
88
|
+
if st:
|
|
89
|
+
entry["is_up"] = st.isup
|
|
90
|
+
entry["speed_mbps"] = st.speed if st.speed > 0 else None
|
|
91
|
+
for a in addr_list:
|
|
92
|
+
if a.family == socket.AF_INET:
|
|
93
|
+
entry["addresses"].append({"family": "IPv4", "address": a.address, "netmask": a.netmask})
|
|
94
|
+
elif a.family == socket.AF_INET6:
|
|
95
|
+
entry["addresses"].append({"family": "IPv6", "address": a.address, "netmask": a.netmask})
|
|
96
|
+
elif hasattr(psutil, "AF_LINK") and a.family == psutil.AF_LINK:
|
|
97
|
+
entry["addresses"].append({"family": "MAC", "address": a.address})
|
|
98
|
+
out.append(entry)
|
|
99
|
+
return sorted(out, key=lambda x: x["name"])
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _primary_ipv4() -> Optional[str]:
|
|
103
|
+
try:
|
|
104
|
+
return socket.gethostbyname(socket.gethostname())
|
|
105
|
+
except OSError:
|
|
106
|
+
pass
|
|
107
|
+
for iface in _network_interfaces():
|
|
108
|
+
for a in iface["addresses"]:
|
|
109
|
+
if a.get("family") == "IPv4" and not a["address"].startswith("127."):
|
|
110
|
+
return a["address"]
|
|
111
|
+
return None
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _listen_ports(limit: int = 80) -> Dict[str, Any]:
|
|
115
|
+
try:
|
|
116
|
+
conns = psutil.net_connections(kind="inet")
|
|
117
|
+
ports = sorted(
|
|
118
|
+
{c.laddr.port for c in conns if c.status == psutil.CONN_LISTEN and c.laddr}
|
|
119
|
+
)
|
|
120
|
+
return {"available": True, "ports": ports[:limit], "truncated": len(ports) > limit}
|
|
121
|
+
except (psutil.AccessDenied, PermissionError):
|
|
122
|
+
return {
|
|
123
|
+
"available": False,
|
|
124
|
+
"ports": [],
|
|
125
|
+
"message": "Elevated permissions required to list listening ports on this OS.",
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _top_processes_cpu(n: int = 8) -> List[Dict[str, Any]]:
|
|
130
|
+
for p in psutil.process_iter(["pid", "name"]):
|
|
131
|
+
try:
|
|
132
|
+
p.cpu_percent(interval=None)
|
|
133
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied):
|
|
134
|
+
pass
|
|
135
|
+
time.sleep(0.15)
|
|
136
|
+
procs: List[Dict[str, Any]] = []
|
|
137
|
+
for p in psutil.process_iter(["pid", "name", "cpu_percent", "memory_percent"]):
|
|
138
|
+
try:
|
|
139
|
+
cpu = p.cpu_percent(interval=None)
|
|
140
|
+
mem = p.memory_percent()
|
|
141
|
+
rss = p.memory_info().rss
|
|
142
|
+
procs.append(
|
|
143
|
+
{
|
|
144
|
+
"pid": p.pid,
|
|
145
|
+
"name": p.info.get("name") or "?",
|
|
146
|
+
"cpu_percent": round(cpu or 0.0, 1),
|
|
147
|
+
"memory_percent": round(mem or 0.0, 1),
|
|
148
|
+
"rss_bytes": rss,
|
|
149
|
+
"rss_mb": _bytes_to_mb(rss),
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
|
|
153
|
+
continue
|
|
154
|
+
procs.sort(key=lambda x: x["cpu_percent"], reverse=True)
|
|
155
|
+
return procs[:n]
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def _top_processes_memory(n: int = 8) -> List[Dict[str, Any]]:
|
|
159
|
+
procs: List[Dict[str, Any]] = []
|
|
160
|
+
for p in psutil.process_iter(["pid", "name"]):
|
|
161
|
+
try:
|
|
162
|
+
rss = p.memory_info().rss
|
|
163
|
+
procs.append(
|
|
164
|
+
{
|
|
165
|
+
"pid": p.pid,
|
|
166
|
+
"name": p.info.get("name") or "?",
|
|
167
|
+
"rss_bytes": rss,
|
|
168
|
+
"rss_mb": _bytes_to_mb(rss),
|
|
169
|
+
"memory_percent": round(p.memory_percent() or 0.0, 1),
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
|
|
173
|
+
continue
|
|
174
|
+
procs.sort(key=lambda x: x["rss_bytes"], reverse=True)
|
|
175
|
+
return procs[:n]
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def collect_report(*, include_listen_ports: bool = True) -> Dict[str, Any]:
|
|
179
|
+
"""Return a JSON-serializable system report."""
|
|
180
|
+
root = _root_fs_path()
|
|
181
|
+
uname = platform.uname()
|
|
182
|
+
boot = psutil.boot_time()
|
|
183
|
+
vm = psutil.virtual_memory()
|
|
184
|
+
sw = psutil.swap_memory()
|
|
185
|
+
disk = psutil.disk_usage(root)
|
|
186
|
+
phys = psutil.cpu_count(logical=False)
|
|
187
|
+
logical = psutil.cpu_count(logical=True)
|
|
188
|
+
cpu_pct = psutil.cpu_percent(interval=0.2)
|
|
189
|
+
|
|
190
|
+
net_io = psutil.net_io_counters(pernic=False)
|
|
191
|
+
net_totals = None
|
|
192
|
+
if net_io:
|
|
193
|
+
net_totals = {
|
|
194
|
+
"bytes_sent": net_io.bytes_sent,
|
|
195
|
+
"bytes_recv": net_io.bytes_recv,
|
|
196
|
+
"packets_sent": net_io.packets_sent,
|
|
197
|
+
"packets_recv": net_io.packets_recv,
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
report: Dict[str, Any] = {
|
|
201
|
+
"generated_at": datetime.now().astimezone().isoformat(),
|
|
202
|
+
"cpu": {
|
|
203
|
+
"model": _cpu_model(),
|
|
204
|
+
"physical_cores": phys,
|
|
205
|
+
"logical_cores": logical,
|
|
206
|
+
"usage_percent": round(cpu_pct, 1),
|
|
207
|
+
"load_average": _load_average(),
|
|
208
|
+
},
|
|
209
|
+
"memory": {
|
|
210
|
+
"total_bytes": vm.total,
|
|
211
|
+
"total_gb": _bytes_to_gb(vm.total),
|
|
212
|
+
"used_bytes": vm.used,
|
|
213
|
+
"used_gb": _bytes_to_gb(vm.used),
|
|
214
|
+
"free_bytes": vm.available,
|
|
215
|
+
"free_gb": _bytes_to_gb(vm.available),
|
|
216
|
+
"percent_used": round(vm.percent, 1),
|
|
217
|
+
"swap_total_bytes": sw.total,
|
|
218
|
+
"swap_total_gb": _bytes_to_gb(sw.total) if sw.total else 0,
|
|
219
|
+
"swap_used_bytes": sw.used,
|
|
220
|
+
"swap_used_gb": _bytes_to_gb(sw.used) if sw.used else 0,
|
|
221
|
+
"swap_percent": round(sw.percent, 1) if sw.total else 0,
|
|
222
|
+
},
|
|
223
|
+
"system": {
|
|
224
|
+
"os": uname.system,
|
|
225
|
+
"node": uname.node,
|
|
226
|
+
"release": uname.release,
|
|
227
|
+
"version": uname.version,
|
|
228
|
+
"machine": uname.machine,
|
|
229
|
+
"platform": platform.platform(),
|
|
230
|
+
"python_version": sys.version.split()[0],
|
|
231
|
+
},
|
|
232
|
+
"disk": {
|
|
233
|
+
"mount": root,
|
|
234
|
+
"total_bytes": disk.total,
|
|
235
|
+
"total_gb": _bytes_to_gb(disk.total),
|
|
236
|
+
"used_bytes": disk.used,
|
|
237
|
+
"used_gb": _bytes_to_gb(disk.used),
|
|
238
|
+
"free_bytes": disk.free,
|
|
239
|
+
"free_gb": _bytes_to_gb(disk.free),
|
|
240
|
+
"percent_used": round(disk.percent, 1),
|
|
241
|
+
"io": _disk_io(),
|
|
242
|
+
},
|
|
243
|
+
"network": {
|
|
244
|
+
"primary_ipv4": _primary_ipv4(),
|
|
245
|
+
"interfaces": _network_interfaces(),
|
|
246
|
+
"totals": net_totals,
|
|
247
|
+
"dns_google_reachable": None,
|
|
248
|
+
},
|
|
249
|
+
"processes": {
|
|
250
|
+
"count": len(psutil.pids()),
|
|
251
|
+
"top_cpu": _top_processes_cpu(8),
|
|
252
|
+
"top_memory": _top_processes_memory(8),
|
|
253
|
+
},
|
|
254
|
+
"uptime": {
|
|
255
|
+
"seconds": int(time.time() - boot),
|
|
256
|
+
"boot_time_iso": _safe_iso(boot),
|
|
257
|
+
},
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
try:
|
|
261
|
+
report["network"]["dns_google_reachable"] = socket.gethostbyname("google.com")
|
|
262
|
+
except OSError:
|
|
263
|
+
report["network"]["dns_google_reachable"] = None
|
|
264
|
+
|
|
265
|
+
if include_listen_ports:
|
|
266
|
+
report["network"]["listen_ports"] = _listen_ports()
|
|
267
|
+
|
|
268
|
+
return report
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--bg: #0f1419;
|
|
3
|
+
--surface: #1a2332;
|
|
4
|
+
--border: #2d3a4d;
|
|
5
|
+
--text: #e7ecf3;
|
|
6
|
+
--muted: #8b9cb3;
|
|
7
|
+
--accent: #3d9cfd;
|
|
8
|
+
--accent-dim: #2563a8;
|
|
9
|
+
--ok: #34d399;
|
|
10
|
+
--warn: #fbbf24;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
* {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
body {
|
|
18
|
+
margin: 0;
|
|
19
|
+
font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
|
|
20
|
+
background: var(--bg);
|
|
21
|
+
color: var(--text);
|
|
22
|
+
line-height: 1.5;
|
|
23
|
+
min-height: 100vh;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
header {
|
|
27
|
+
padding: 1.25rem 1.5rem;
|
|
28
|
+
border-bottom: 1px solid var(--border);
|
|
29
|
+
background: var(--surface);
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
gap: 1rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
header h1 {
|
|
38
|
+
margin: 0;
|
|
39
|
+
font-size: 1.25rem;
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
header .meta {
|
|
44
|
+
color: var(--muted);
|
|
45
|
+
font-size: 0.875rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.toolbar {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 0.75rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.toolbar label {
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: 0.35rem;
|
|
58
|
+
font-size: 0.8rem;
|
|
59
|
+
color: var(--muted);
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.toolbar button {
|
|
64
|
+
background: var(--accent);
|
|
65
|
+
color: #fff;
|
|
66
|
+
border: none;
|
|
67
|
+
padding: 0.45rem 0.9rem;
|
|
68
|
+
border-radius: 6px;
|
|
69
|
+
font-size: 0.875rem;
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.toolbar button:hover {
|
|
74
|
+
background: var(--accent-dim);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.toolbar button:disabled {
|
|
78
|
+
opacity: 0.5;
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#status {
|
|
83
|
+
font-size: 0.8rem;
|
|
84
|
+
color: var(--muted);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
main {
|
|
88
|
+
max-width: 1200px;
|
|
89
|
+
margin: 0 auto;
|
|
90
|
+
padding: 1.25rem 1.5rem 2rem;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.grid {
|
|
94
|
+
display: grid;
|
|
95
|
+
gap: 1rem;
|
|
96
|
+
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.card {
|
|
100
|
+
background: var(--surface);
|
|
101
|
+
border: 1px solid var(--border);
|
|
102
|
+
border-radius: 10px;
|
|
103
|
+
padding: 1rem 1.15rem;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.card h2 {
|
|
107
|
+
margin: 0 0 0.75rem;
|
|
108
|
+
font-size: 0.95rem;
|
|
109
|
+
font-weight: 600;
|
|
110
|
+
color: var(--accent);
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: 0.4rem;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.card.full {
|
|
117
|
+
grid-column: 1 / -1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
dl {
|
|
121
|
+
margin: 0;
|
|
122
|
+
display: grid;
|
|
123
|
+
grid-template-columns: auto 1fr;
|
|
124
|
+
gap: 0.35rem 1rem;
|
|
125
|
+
font-size: 0.875rem;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
dt {
|
|
129
|
+
color: var(--muted);
|
|
130
|
+
font-weight: 500;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
dd {
|
|
134
|
+
margin: 0;
|
|
135
|
+
word-break: break-word;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.bar {
|
|
139
|
+
height: 8px;
|
|
140
|
+
background: var(--border);
|
|
141
|
+
border-radius: 4px;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
margin-top: 0.25rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.bar > span {
|
|
147
|
+
display: block;
|
|
148
|
+
height: 100%;
|
|
149
|
+
background: linear-gradient(90deg, var(--accent-dim), var(--accent));
|
|
150
|
+
border-radius: 4px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
table {
|
|
154
|
+
width: 100%;
|
|
155
|
+
border-collapse: collapse;
|
|
156
|
+
font-size: 0.8rem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
th,
|
|
160
|
+
td {
|
|
161
|
+
text-align: left;
|
|
162
|
+
padding: 0.4rem 0.5rem;
|
|
163
|
+
border-bottom: 1px solid var(--border);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
th {
|
|
167
|
+
color: var(--muted);
|
|
168
|
+
font-weight: 600;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.iface-name {
|
|
172
|
+
font-weight: 600;
|
|
173
|
+
color: var(--text);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.error-banner {
|
|
177
|
+
background: #3d1f1f;
|
|
178
|
+
border: 1px solid #7f2d2d;
|
|
179
|
+
color: #fecaca;
|
|
180
|
+
padding: 0.75rem 1rem;
|
|
181
|
+
border-radius: 8px;
|
|
182
|
+
margin-bottom: 1rem;
|
|
183
|
+
font-size: 0.875rem;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.hidden {
|
|
187
|
+
display: none !important;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@media (prefers-color-scheme: light) {
|
|
191
|
+
:root {
|
|
192
|
+
--bg: #f0f4f8;
|
|
193
|
+
--surface: #fff;
|
|
194
|
+
--border: #d0dbe8;
|
|
195
|
+
--text: #1a2332;
|
|
196
|
+
--muted: #5c6b7f;
|
|
197
|
+
--accent: #0b6bcb;
|
|
198
|
+
--accent-dim: #084a94;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.error-banner {
|
|
202
|
+
background: #fef2f2;
|
|
203
|
+
border-color: #fecaca;
|
|
204
|
+
color: #991b1b;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>System Report</title>
|
|
7
|
+
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<header>
|
|
11
|
+
<div>
|
|
12
|
+
<h1>System report</h1>
|
|
13
|
+
<div class="meta" id="generated">Loading…</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="toolbar">
|
|
16
|
+
<label><input type="checkbox" id="auto" checked /> Auto-refresh (15s)</label>
|
|
17
|
+
<label><input type="checkbox" id="ports" checked /> Include listening ports</label>
|
|
18
|
+
<button type="button" id="refresh">Refresh now</button>
|
|
19
|
+
</div>
|
|
20
|
+
<span id="status"></span>
|
|
21
|
+
</header>
|
|
22
|
+
<main>
|
|
23
|
+
<div id="err" class="error-banner hidden"></div>
|
|
24
|
+
<div class="grid" id="content"></div>
|
|
25
|
+
</main>
|
|
26
|
+
<script>
|
|
27
|
+
function fmtBytes(n) {
|
|
28
|
+
if (n == null) return "—";
|
|
29
|
+
const u = ["B", "KB", "MB", "GB", "TB"];
|
|
30
|
+
let i = 0;
|
|
31
|
+
let x = n;
|
|
32
|
+
while (x >= 1024 && i < u.length - 1) { x /= 1024; i++; }
|
|
33
|
+
return (i === 0 ? x : x.toFixed(2)) + " " + u[i];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function fmtUptime(sec) {
|
|
37
|
+
const d = Math.floor(sec / 86400);
|
|
38
|
+
const h = Math.floor((sec % 86400) / 3600);
|
|
39
|
+
const m = Math.floor((sec % 3600) / 60);
|
|
40
|
+
const parts = [];
|
|
41
|
+
if (d) parts.push(d + "d");
|
|
42
|
+
if (h || d) parts.push(h + "h");
|
|
43
|
+
parts.push(m + "m");
|
|
44
|
+
return parts.join(" ");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function bar(pct) {
|
|
48
|
+
const v = Math.min(100, Math.max(0, pct));
|
|
49
|
+
return '<div class="bar"><span style="width:' + v + '%"></span></div>';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function render(r) {
|
|
53
|
+
const cpu = r.cpu;
|
|
54
|
+
const mem = r.memory;
|
|
55
|
+
const sys = r.system;
|
|
56
|
+
const disk = r.disk;
|
|
57
|
+
const net = r.network;
|
|
58
|
+
const proc = r.processes;
|
|
59
|
+
const up = r.uptime;
|
|
60
|
+
const load = cpu.load_average;
|
|
61
|
+
const loadStr = load
|
|
62
|
+
? load["1m"] + ", " + load["5m"] + ", " + load["15m"]
|
|
63
|
+
: "N/A (Windows has no load average)";
|
|
64
|
+
|
|
65
|
+
let portsHtml = "";
|
|
66
|
+
const lp = net.listen_ports;
|
|
67
|
+
if (lp) {
|
|
68
|
+
if (lp.available) {
|
|
69
|
+
const list = lp.ports.length ? lp.ports.join(", ") : "none";
|
|
70
|
+
portsHtml = "<dt>Listening ports</dt><dd>" + (lp.truncated ? list + " …" : list) + "</dd>";
|
|
71
|
+
} else {
|
|
72
|
+
portsHtml = "<dt>Listening ports</dt><dd>" + (lp.message || "Unavailable") + "</dd>";
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let diskIo = "<dt>Disk I/O</dt><dd>—</dd>";
|
|
77
|
+
if (disk.io) {
|
|
78
|
+
diskIo =
|
|
79
|
+
"<dt>Disk I/O (read / write)</dt><dd>" +
|
|
80
|
+
fmtBytes(disk.io.read_bytes) +
|
|
81
|
+
" / " +
|
|
82
|
+
fmtBytes(disk.io.write_bytes) +
|
|
83
|
+
"</dd>";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let netTotals = "<dt>Bytes sent / recv (since boot)</dt><dd>—</dd>";
|
|
87
|
+
if (net.totals) {
|
|
88
|
+
netTotals =
|
|
89
|
+
"<dt>Bytes sent / received</dt><dd>" +
|
|
90
|
+
fmtBytes(net.totals.bytes_sent) +
|
|
91
|
+
" / " +
|
|
92
|
+
fmtBytes(net.totals.bytes_recv) +
|
|
93
|
+
"</dd>";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const ifaces = net.interfaces
|
|
97
|
+
.map(function (iface) {
|
|
98
|
+
const addrs = iface.addresses
|
|
99
|
+
.map(function (a) {
|
|
100
|
+
return a.family + ": " + a.address;
|
|
101
|
+
})
|
|
102
|
+
.join("<br/>");
|
|
103
|
+
const up = iface.is_up == null ? "" : iface.is_up ? "up" : "down";
|
|
104
|
+
const spd = iface.speed_mbps ? iface.speed_mbps + " Mbps" : "";
|
|
105
|
+
return (
|
|
106
|
+
"<tr><td class=\"iface-name\">" +
|
|
107
|
+
iface.name +
|
|
108
|
+
"</td><td>" +
|
|
109
|
+
addrs +
|
|
110
|
+
"</td><td>" +
|
|
111
|
+
up +
|
|
112
|
+
"</td><td>" +
|
|
113
|
+
spd +
|
|
114
|
+
"</td></tr>"
|
|
115
|
+
);
|
|
116
|
+
})
|
|
117
|
+
.join("");
|
|
118
|
+
|
|
119
|
+
const topCpu = proc.top_cpu
|
|
120
|
+
.map(function (p) {
|
|
121
|
+
return (
|
|
122
|
+
"<tr><td>" +
|
|
123
|
+
p.pid +
|
|
124
|
+
"</td><td>" +
|
|
125
|
+
(p.name || "").replace(/</g, "<") +
|
|
126
|
+
"</td><td>" +
|
|
127
|
+
p.cpu_percent +
|
|
128
|
+
"%</td><td>" +
|
|
129
|
+
p.rss_mb +
|
|
130
|
+
" MB</td></tr>"
|
|
131
|
+
);
|
|
132
|
+
})
|
|
133
|
+
.join("");
|
|
134
|
+
|
|
135
|
+
const topMem = proc.top_memory
|
|
136
|
+
.map(function (p) {
|
|
137
|
+
return (
|
|
138
|
+
"<tr><td>" +
|
|
139
|
+
p.pid +
|
|
140
|
+
"</td><td>" +
|
|
141
|
+
(p.name || "").replace(/</g, "<") +
|
|
142
|
+
"</td><td>" +
|
|
143
|
+
p.rss_mb +
|
|
144
|
+
" MB</td><td>" +
|
|
145
|
+
p.memory_percent +
|
|
146
|
+
"%</td></tr>"
|
|
147
|
+
);
|
|
148
|
+
})
|
|
149
|
+
.join("");
|
|
150
|
+
|
|
151
|
+
document.getElementById("generated").textContent = "Generated: " + r.generated_at;
|
|
152
|
+
document.getElementById("content").innerHTML =
|
|
153
|
+
'<section class="card"><h2>CPU</h2><dl>' +
|
|
154
|
+
"<dt>Model</dt><dd>" +
|
|
155
|
+
(cpu.model || "").replace(/</g, "<") +
|
|
156
|
+
"</dd>" +
|
|
157
|
+
"<dt>Cores (physical / logical)</dt><dd>" +
|
|
158
|
+
(cpu.physical_cores ?? "—") +
|
|
159
|
+
" / " +
|
|
160
|
+
(cpu.logical_cores ?? "—") +
|
|
161
|
+
"</dd>" +
|
|
162
|
+
"<dt>Usage</dt><dd>" +
|
|
163
|
+
cpu.usage_percent +
|
|
164
|
+
"%" +
|
|
165
|
+
bar(cpu.usage_percent) +
|
|
166
|
+
"</dd>" +
|
|
167
|
+
"<dt>Load avg (1m, 5m, 15m)</dt><dd>" +
|
|
168
|
+
loadStr +
|
|
169
|
+
"</dd></dl></section>" +
|
|
170
|
+
'<section class="card"><h2>Memory</h2><dl>' +
|
|
171
|
+
"<dt>Total RAM</dt><dd>" +
|
|
172
|
+
mem.total_gb +
|
|
173
|
+
" GB</dd>" +
|
|
174
|
+
"<dt>Used / free</dt><dd>" +
|
|
175
|
+
mem.used_gb +
|
|
176
|
+
" GB / " +
|
|
177
|
+
mem.free_gb +
|
|
178
|
+
" GB (" +
|
|
179
|
+
mem.percent_used +
|
|
180
|
+
"%)" +
|
|
181
|
+
bar(mem.percent_used) +
|
|
182
|
+
"</dd>" +
|
|
183
|
+
"<dt>Swap</dt><dd>" +
|
|
184
|
+
mem.swap_used_gb +
|
|
185
|
+
" GB used of " +
|
|
186
|
+
mem.swap_total_gb +
|
|
187
|
+
" GB (" +
|
|
188
|
+
mem.swap_percent +
|
|
189
|
+
"%)</dd></dl></section>" +
|
|
190
|
+
'<section class="card"><h2>System / OS</h2><dl>' +
|
|
191
|
+
"<dt>OS</dt><dd>" +
|
|
192
|
+
sys.os +
|
|
193
|
+
" " +
|
|
194
|
+
sys.release +
|
|
195
|
+
"</dd>" +
|
|
196
|
+
"<dt>Architecture</dt><dd>" +
|
|
197
|
+
sys.machine +
|
|
198
|
+
"</dd>" +
|
|
199
|
+
"<dt>Kernel / build</dt><dd>" +
|
|
200
|
+
(sys.version || "").replace(/</g, "<").slice(0, 200) +
|
|
201
|
+
(sys.version && sys.version.length > 200 ? "…" : "") +
|
|
202
|
+
"</dd>" +
|
|
203
|
+
"<dt>Hostname</dt><dd>" +
|
|
204
|
+
(sys.node || "").replace(/</g, "<") +
|
|
205
|
+
"</dd>" +
|
|
206
|
+
"<dt>Python</dt><dd>" +
|
|
207
|
+
sys.python_version +
|
|
208
|
+
"</dd></dl></section>" +
|
|
209
|
+
'<section class="card"><h2>Disk / storage</h2><dl>' +
|
|
210
|
+
"<dt>Mount</dt><dd>" +
|
|
211
|
+
(disk.mount || "").replace(/</g, "<") +
|
|
212
|
+
"</dd>" +
|
|
213
|
+
"<dt>Total</dt><dd>" +
|
|
214
|
+
disk.total_gb +
|
|
215
|
+
" GB</dd>" +
|
|
216
|
+
"<dt>Used / free</dt><dd>" +
|
|
217
|
+
disk.used_gb +
|
|
218
|
+
" GB / " +
|
|
219
|
+
disk.free_gb +
|
|
220
|
+
" GB (" +
|
|
221
|
+
disk.percent_used +
|
|
222
|
+
"%)" +
|
|
223
|
+
bar(disk.percent_used) +
|
|
224
|
+
"</dd>" +
|
|
225
|
+
diskIo +
|
|
226
|
+
"</dl></section>" +
|
|
227
|
+
'<section class="card full"><h2>Network</h2><dl>' +
|
|
228
|
+
"<dt>Primary IPv4</dt><dd>" +
|
|
229
|
+
(net.primary_ipv4 || "—") +
|
|
230
|
+
"</dd>" +
|
|
231
|
+
netTotals +
|
|
232
|
+
"<dt>DNS (google.com)</dt><dd>" +
|
|
233
|
+
(net.dns_google_reachable || "—") +
|
|
234
|
+
"</dd>" +
|
|
235
|
+
portsHtml +
|
|
236
|
+
'</dl><table><thead><tr><th>Interface</th><th>Addresses</th><th>Link</th><th>Speed</th></tr></thead><tbody>' +
|
|
237
|
+
ifaces +
|
|
238
|
+
"</tbody></table></section>" +
|
|
239
|
+
'<section class="card full"><h2>Processes</h2><p style="margin:0 0 0.5rem;font-size:0.875rem;color:var(--muted)">Running: ' +
|
|
240
|
+
proc.count +
|
|
241
|
+
'</p><div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem">' +
|
|
242
|
+
'<div><strong>Top CPU</strong><table><thead><tr><th>PID</th><th>Name</th><th>CPU</th><th>RSS</th></tr></thead><tbody>' +
|
|
243
|
+
topCpu +
|
|
244
|
+
"</tbody></table></div>" +
|
|
245
|
+
'<div><strong>Top memory</strong><table><thead><tr><th>PID</th><th>Name</th><th>RSS</th><th>%</th></tr></thead><tbody>' +
|
|
246
|
+
topMem +
|
|
247
|
+
"</tbody></table></div></div></section>" +
|
|
248
|
+
'<section class="card"><h2>Uptime</h2><dl>' +
|
|
249
|
+
"<dt>Uptime</dt><dd>" +
|
|
250
|
+
fmtUptime(up.seconds) +
|
|
251
|
+
" (" +
|
|
252
|
+
up.seconds +
|
|
253
|
+
" s)</dd>" +
|
|
254
|
+
"<dt>Last boot (local)</dt><dd>" +
|
|
255
|
+
up.boot_time_iso +
|
|
256
|
+
"</dd></dl></section>";
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let timer = null;
|
|
260
|
+
async function loadReport() {
|
|
261
|
+
const btn = document.getElementById("refresh");
|
|
262
|
+
const st = document.getElementById("status");
|
|
263
|
+
const err = document.getElementById("err");
|
|
264
|
+
const ports = document.getElementById("ports").checked ? "1" : "0";
|
|
265
|
+
btn.disabled = true;
|
|
266
|
+
st.textContent = "Fetching…";
|
|
267
|
+
err.classList.add("hidden");
|
|
268
|
+
try {
|
|
269
|
+
const res = await fetch("/api/report?ports=" + ports);
|
|
270
|
+
if (!res.ok) throw new Error(res.statusText);
|
|
271
|
+
const data = await res.json();
|
|
272
|
+
render(data);
|
|
273
|
+
st.textContent = "OK";
|
|
274
|
+
} catch (e) {
|
|
275
|
+
err.textContent = "Could not load report: " + e.message;
|
|
276
|
+
err.classList.remove("hidden");
|
|
277
|
+
st.textContent = "Error";
|
|
278
|
+
} finally {
|
|
279
|
+
btn.disabled = false;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function schedule() {
|
|
284
|
+
if (timer) clearInterval(timer);
|
|
285
|
+
timer = null;
|
|
286
|
+
if (document.getElementById("auto").checked) {
|
|
287
|
+
timer = setInterval(loadReport, 15000);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
document.getElementById("refresh").addEventListener("click", loadReport);
|
|
292
|
+
document.getElementById("auto").addEventListener("change", schedule);
|
|
293
|
+
document.getElementById("ports").addEventListener("change", loadReport);
|
|
294
|
+
loadReport();
|
|
295
|
+
schedule();
|
|
296
|
+
</script>
|
|
297
|
+
</body>
|
|
298
|
+
</html>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: systemreports
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Cross-platform system report with a local web dashboard (Windows, macOS, Linux).
|
|
5
|
+
Home-page: https://github.com/sriramsreedhar/systemreports.git
|
|
6
|
+
Author: Sriram Sreedhar
|
|
7
|
+
Author-email: sriramsreedhar003@gmail.com
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.8
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
License-File: NOTICE
|
|
16
|
+
Requires-Dist: psutil>=5.9.0
|
|
17
|
+
Requires-Dist: flask>=2.0.0
|
|
18
|
+
Dynamic: author
|
|
19
|
+
Dynamic: author-email
|
|
20
|
+
Dynamic: classifier
|
|
21
|
+
Dynamic: description
|
|
22
|
+
Dynamic: description-content-type
|
|
23
|
+
Dynamic: home-page
|
|
24
|
+
Dynamic: license
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
# SystemReports
|
|
31
|
+
|
|
32
|
+
Cross-platform system metrics with a **local web dashboard** (Windows, macOS, Linux) and optional CLI/JSON output.
|
|
33
|
+
|
|
34
|
+
- **GitHub:** [github.com/sriramsreedhar/systemreports](https://github.com/sriramsreedhar/systemreports.git)
|
|
35
|
+
- **License:** [Apache-2.0](LICENSE)
|
|
36
|
+
|
|
37
|
+
## Screenshot
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
The UI shows CPU, memory, OS, disk (including I/O), network (interfaces, traffic, optional listening ports), top processes, and uptime. Use **Refresh now** or enable **Auto-refresh** to keep values current.
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- **Web dashboard** — Run `systemreports` and open the URL in your browser (default: `http://127.0.0.1:5050/`).
|
|
46
|
+
- **CLI / JSON** — `systemreports --cli` for a text summary; `systemreports --json` for full JSON.
|
|
47
|
+
- **Legacy** — Original CentOS-oriented script: `legacy_cli.py` (Unix-oriented).
|
|
48
|
+
|
|
49
|
+
**Requirements:** Python 3.8+, [psutil](https://github.com/giampaolo/psutil), [Flask](https://flask.palletsprojects.com/).
|
|
50
|
+
|
|
51
|
+
## Install
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install -e .
|
|
55
|
+
# or
|
|
56
|
+
pip install systemreports
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Run the dashboard
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
systemreports
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Other useful options:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Do not open a browser automatically
|
|
69
|
+
systemreports --no-browser
|
|
70
|
+
|
|
71
|
+
# Listen on all interfaces (use only on trusted networks)
|
|
72
|
+
systemreports --host 0.0.0.0 --port 5050
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## API
|
|
76
|
+
|
|
77
|
+
- `GET /api/report` — JSON snapshot (includes listening ports when permitted).
|
|
78
|
+
- `GET /api/report?ports=0` — Skip port enumeration (fewer permission prompts).
|
|
79
|
+
|
|
80
|
+
You can also run the module directly: `python -m systemreports`.
|
|
81
|
+
|
|
82
|
+
## Publishing to PyPI
|
|
83
|
+
|
|
84
|
+
Use a **dedicated virtualenv** for releases if other tools pin an old **packaging** (for example some stacks require `packaging<25`).
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python -m venv .venv-release
|
|
88
|
+
source .venv-release/bin/activate # Windows: .venv-release\Scripts\activate
|
|
89
|
+
pip install --upgrade build twine packaging
|
|
90
|
+
python -m build
|
|
91
|
+
python -m twine check dist/*
|
|
92
|
+
python -m twine upload dist/*
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
If `twine check` / `twine upload` fails with **unrecognized or malformed field `license-file`**, upgrade **`packaging`** (and **twine**). Wheels use metadata 2.4; older `packaging` does not understand the `License-File` field. See [pypa/twine#1216](https://github.com/pypa/twine/issues/1216).
|
|
96
|
+
|
|
97
|
+
## More detail
|
|
98
|
+
|
|
99
|
+
See [README.rst](README.rst) for the original project notes and older pip/output examples.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
systemreports/__init__.py,sha256=vZmQ6FuBpOySrTiq_mLi-9z8-NvuRLMoAPDkl7W2sFM,88
|
|
2
|
+
systemreports/__main__.py,sha256=X-kTCWBt2C4-ILeNIr9qQQ6uwMt_V7fG69q4u31WvTw,74
|
|
3
|
+
systemreports/app.py,sha256=JdyzahwFsN3sk3tGQadAaIqCGa7nX3PNfT49-qTqP-w,922
|
|
4
|
+
systemreports/cli.py,sha256=mY6Ky_pd3rS3Gurx5kStuGfUD1R2bPlchvKBOUjeyAM,3380
|
|
5
|
+
systemreports/collector.py,sha256=krJ_je9sLyNw_0bc16qamsjXOV3HLGTE-WdU5ZYT1x4,9084
|
|
6
|
+
systemreports/static/style.css,sha256=zswFXDPQKHJfw8-vyArTXdM4eA5fbqBrar6UqlmsyNk,3120
|
|
7
|
+
systemreports/templates/index.html,sha256=p93iGuSFnXyDO7FWK4VNFtRe1TdDHvDbeAOFTaUnsgo,9456
|
|
8
|
+
systemreports-2.0.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
9
|
+
systemreports-2.0.0.dist-info/licenses/NOTICE,sha256=ADPZMK4T1XU1HvzhYoXhCGi9a4BOWMseNtpUTmIRg64,158
|
|
10
|
+
systemreports-2.0.0.dist-info/METADATA,sha256=3EWp4osU2ZdUKEPxQzWj3SbfydWpDI-vg3vqPx1YLs8,3215
|
|
11
|
+
systemreports-2.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
12
|
+
systemreports-2.0.0.dist-info/entry_points.txt,sha256=UrlTdFKbX6peLutehFeWlCsmNnF7iwfWHY6K-HD1rYk,57
|
|
13
|
+
systemreports-2.0.0.dist-info/top_level.txt,sha256=oa__vtIHy4fIEw7qt9XfgEpyWG3RexjJHedysHKuUjg,14
|
|
14
|
+
systemreports-2.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
systemreports
|