mchuca's picture
Server Monitor: six editions (C++/Qt, Python, web for Linux and Windows), requirements and developer kit
bad179a
|
Raw History Blame Contribute Delete
3.43 kB

Server Monitor (Python, Linux)

A desktop program that watches Linux 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

  • Linux, Python 3.8 or newer with tkinter (sudo apt install python3-tk on Debian/Ubuntu). No pip packages.
  • The system ssh client, only for remote servers.

Run

./run.sh          # or: python3 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 small POSIX sh script (embedded in plat.py) reads /proc and /sys.
  • SSH: nothing to install on the server. The same script is sent over your ssh client. Keys are recommended (ssh-copy-id user@host); a password also works, and a small temporary helper script answers ssh's password prompt.

All calculations happen in the app. Control actions run as the login user; tick sudo -n for a server to allow privileged actions (needs passwordless sudo).

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 (signals, priority), Services (start/stop/restart/enable/disable, logs), History, Insights & Autopilot, Alert rules, Console.
  • 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.

Data

Everything is stored in ~/.config/ServerMonitorPy (or $XDG_CONFIG_HOME/ServerMonitorPy):

  • servers.json (mode 600): 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 Linux-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 Windows edition.