File size: 3,890 Bytes
bad179a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # Server Monitor (Python, Windows)
A desktop program that watches Windows machines in detail, keeps their history from seconds to years, analyzes that history with plain statistics (no AI), and fixes common problems automatically. It is a port of the C++/Qt edition to the Python 3 standard library only: the interface is tkinter, and every gauge, chart, tile and table is drawn by hand on a canvas.
## Requirements
- Windows 10 / 11 or Windows Server 2016 and newer, with Windows PowerShell 5.1 (built in).
- Python 3.8 or newer from python.org (tkinter is included). No pip packages.
- The OpenSSH client (`ssh`, built in since Windows 10 1809 / Server 2019), only for remote servers. Password login needs OpenSSH 8.4 or newer; key login works with any version.
## Run
Double-click `run.bat`, or run `python main.py`.
The first start adds "This computer". Closing the window ends the program (there is no tray icon).
## How it connects
- **This machine:** no setup. A PowerShell script (embedded in `plat.py`) reads performance counters and WMI.
- **SSH:** nothing to install on the server besides the built-in OpenSSH Server feature. The same script is sent over your `ssh` client to the server's `powershell`. Keys are recommended; a password also works, and a small temporary helper script answers ssh's password prompt.
All calculations happen in the app. Control actions (stopping processes of other users, services, cleanup) need administrator rights: start the app elevated, or log in over SSH as an administrator. Process owners are shown only when elevated.
## Features
- **Dashboard:** a live card per server (gauges, sparkline, health grade), totals, recent events, search.
- **Server tabs:** Overview, CPU (per core, temperatures, GPUs), Memory, Storage, Network, Processes (end task, kill, priority), Services (start/stop/restart/enable/disable, events), History, Insights & Autopilot, Alert rules, Console (PowerShell).
- **History:** every sample kept 6 h, 1-minute averages and peaks 30 days, hourly 2 years, daily 20 years; downtime is stored too. Ranges from 1 h to all time, min / average / 95th percentile / peak, CSV export.
- **Analysis (every minute):** disk-full forecast, memory trend, per-process leaks and runaways, failed or flapping services, overload, swap thrashing, anomalies against the same weekday and hour, availability, capacity advice, health score with grade, weekly heatmap.
- **Autopilot:** acts on the findings with cooldowns and a restart limit; **dry run** only reports. Services that were already failed when monitoring started are left alone.
- **Alert rules:** "CPU > 90 % for 60 s → warning → restart a service"; events go to the Events page and to `alerts.log`.
The load average has the Unix meaning (running plus waiting tasks, averaged over 1 / 5 / 15 minutes); it is computed from CPU usage and the processor queue length.
## Data
Everything is stored in `%APPDATA%\ServerMonitorPy`:
- `servers.json`: servers, rules and autopilot settings. Saved SSH passwords are only lightly disguised, not encrypted, so prefer keys.
- `history\<server id>\{raw,minute,hour,day}.bin`: the history tiers.
- `alerts.log`: every alert and action.
The file formats are the same as in the other Server Monitor editions, so files can be copied between them.
## Code
```
main.py entry point
plat.py everything Windows-specific: collector script, spawning, frame parser, command tables
metrics.py one parsed sample + helpers shared by the platform parsers
model.py configuration, rules, formatting
history.py history store + analyzer
session.py ssh/local link, per-server session (rules, autopilot), manager
widgets.py theme, hand-drawn widgets, small UI builders
tabs.py server detail tabs
ui.py dashboard, detail page, add/edit dialog, main window
```
Only `plat.py` differs from the Linux edition.
|