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:
@@ -0,0 +1,70 @@
|
||||
# nasmon
|
||||
|
||||
Lightweight NAS health monitor written in Go. Web dashboard (CPU, memory
|
||||
incl. ZFS ARC, temperatures, physical disks with SMART, ZFS pools and
|
||||
datasets) with periodic SMART/ZFS checks and e-mail alerts, plus SMB/NFS
|
||||
share management from the UI.
|
||||
|
||||
* 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`
|
||||
|
||||
No authentication — designed for a LAN-only NAS (the `/shares` page can
|
||||
create SMB/NFS users and exports, so keep it off the public internet).
|
||||
|
||||
See [packaging/README.md](packaging/README.md) for the full operational
|
||||
doc (ZFS dataset management, SMB/NFS shares, alert lifecycle) — it ships
|
||||
inside the package as `/usr/share/doc/nasmon/README.md`.
|
||||
|
||||
## Build
|
||||
|
||||
Go 1.22, [nfpm](https://nfpm.goreleaser.com/) (no `rpmbuild`/`dpkg-deb`
|
||||
needed — nfpm builds both formats natively).
|
||||
|
||||
```powershell
|
||||
# Windows
|
||||
.\build.ps1 # dist\nasmon_<version>_amd64.deb + dist\nasmon-<version>.x86_64.rpm
|
||||
.\build.ps1 -Test # go vet + go test first
|
||||
.\build.ps1 -Version 0.2.0
|
||||
```
|
||||
|
||||
```bash
|
||||
# Linux/WSL/CI
|
||||
./build.sh
|
||||
TEST=1 ./build.sh
|
||||
VERSION=0.2.0 ./build.sh
|
||||
```
|
||||
|
||||
One-time tool setup:
|
||||
|
||||
```
|
||||
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
|
||||
```
|
||||
|
||||
## Packaging
|
||||
|
||||
`packaging/nfpm.yaml` builds both formats from one spec:
|
||||
|
||||
- **.deb** (Ubuntu/Debian): depends on `smartmontools`, `zfsutils-linux`, `util-linux`;
|
||||
recommends `samba`, `nfs-kernel-server`, `wsdd` for the `/shares` page.
|
||||
- **.rpm** (Fedora/RHEL/Rocky, `dnf`): depends on `smartmontools`, `util-linux`;
|
||||
recommends `samba`, `nfs-utils`, `wsdd`. ZFS is **not** a hard dependency on
|
||||
rpm — RHEL-family distros have no native ZFS package; install the
|
||||
[OpenZFS](https://openzfs.github.io/openzfs-docs/Getting%20Started/RHEL-based%20distro/index.html)
|
||||
repo yourself if you need the `/zfs` page's pool/dataset features.
|
||||
|
||||
Both formats install the same systemd unit (`packaging/nasmon.service`, run
|
||||
as root — it needs `smartctl`/`zpool`), just at their respective conventional
|
||||
paths (`/lib/systemd/system` on deb, `/usr/lib/systemd/system` on rpm), plus
|
||||
the bundled `wsdd.service` unit (Ubuntu/Fedora `wsdd` packages ship no unit
|
||||
of their own), default config at `/etc/nasmon/config.json`, and
|
||||
`postinst.sh`/`prerm.sh`/`postrm.sh` maintainer scripts (written to run
|
||||
correctly under both dpkg and rpm argument conventions).
|
||||
|
||||
## CI
|
||||
|
||||
`.gitea/workflows/build.yml` runs `go vet`/`go test` and builds both
|
||||
packages on every push, uploading `dist/*.deb` and `dist/*.rpm` as build
|
||||
artifacts.
|
||||
Reference in New Issue
Block a user