Initial import: nasmon health monitor, split out of home_nas

Go service (nasmon/) plus nfpm packaging (packaging/), carried over from
the home_nas monorepo. Adds rpm packaging alongside the existing deb
build (Fedora/RHEL/Rocky dependency names via nfpm overrides, per-format
systemd unit path, dpkg+rpm-compatible maintainer scripts) and a Gitea
Actions workflow that builds both formats on every push.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-19 10:24:34 +03:00
co-authored by Claude Sonnet 5
commit 09159a5f31
61 changed files with 7882 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
# nasmon
Lightweight NAS health monitor: web dashboard on port 8090 with CPU, memory
(incl. ZFS ARC), temperatures, physical disks with SMART, ZFS pools and datasets;
periodic SMART/ZFS checks with e-mail alerts.
* Web UI: http://<host>:8090
* Settings: http://<host>:8090/settings (also /etc/nasmon/config.json)
* State: /var/lib/nasmon/nasmon.db (SMART history, alert log)
* Service: systemctl status nasmon ; journalctl -u nasmon -f
* JSON API: /api/status, /api/history?hours=24, /api/disks/<serial>/history?days=30
## ZFS datasets from the UI
The ZFS page (http://<host>:8090/zfs) can create datasets in a pool — name (nested
names like media/video are fine), owner uid:gid for the mountpoint, compression,
optional quota — and destroy datasets that are empty (no data, no children, no
snapshots; the check is repeated against the live system before "zfs destroy").
nasmon runs sandboxed (ProtectSystem=strict → own mount namespace), so these
commands are executed on the host through transient units:
`systemd-run --wait --pipe --collect zfs create …`. Every action is logged
(journalctl -u nasmon).
nasmon has no authentication: keep port 8090 on the LAN only.
## SMB / NFS shares from the UI
http://<host>:8090/shares manages Samba shares (guest or per-user, files always
written as the data owner uid 1000), SMB users (smbpasswd; a login-less Unix
account is created when needed) and NFS exports (host/IP/CIDR clients, rw/ro,
squash). Definitions are stored in /etc/nasmon/shares.json; nasmon regenerates
/etc/samba/smb.conf (whole file, header "Managed by nasmon") and
/etc/exports.d/nasmon.exports, validates with testparm, then reloads smbd /
exportfs -ra. A rejected config is rolled back to the .bak copy. Daemons are
enabled while at least one share exists and disabled otherwise.
Alerts: the × on an open alert acknowledges it (hidden and not mailed until the
problem changes or clears); the × on a resolved alert removes it from the log.
Resolved alerts older than 7 days are hidden by default, older than 90 days
deleted.