From f0f7c06e5c4206e16340edcc32e74b4ff59bb83f Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Thu, 7 May 2026 20:22:12 +0000 Subject: [PATCH] docs: refresh readme and legal info --- readme.md | 1116 ++++++++++++----------------------------------------- 1 file changed, 250 insertions(+), 866 deletions(-) diff --git a/readme.md b/readme.md index 5937f9e..47383c0 100644 --- a/readme.md +++ b/readme.md @@ -1,1000 +1,384 @@ -# ⚑ NUPST β€” Network UPS Shutdown Tool +# @serve.zone/nupst -**Keep your systems safe when the power goes out.** NUPST is a lightweight, battle-tested CLI tool -that monitors UPS devices via SNMP or NUT (UPSD) and orchestrates graceful shutdowns during power -emergencies β€” including Proxmox VMs, LXC containers, and the host itself. - -Distributed as **self-contained binaries** with zero runtime dependencies. No Node.js, no Python, no -package managers. Just download and run. +NUPST is a Network UPS Shutdown Tool for servers that need predictable behavior when power gets ugly. It monitors UPS devices through SNMP or NUT/UPSD, evaluates per-device and grouped power conditions, and runs ordered actions such as Proxmox guest shutdown, webhooks, scripts, and host shutdown. ## Issue Reporting and Security -For reporting bugs, issues, or security vulnerabilities, please visit -[community.foss.global/](https://community.foss.global/). This is the central community hub for all -issue reporting. Developers who sign and comply with our contribution agreement and go through -identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull -Requests directly. +For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly. -## ✨ Features +## Why It Exists -- **πŸ”Œ Multi-UPS Support** β€” Monitor multiple UPS devices from a single daemon -- **πŸ“‘ Dual Protocol Support** β€” SNMP (v1/v2c/v3) for network UPS + UPSD/NIS for USB-connected UPS - via NUT -- **πŸ–₯️ Proxmox Integration** β€” Gracefully shut down QEMU VMs and LXC containers before host - shutdown, with optional HA-aware stop requests for HA-managed guests -- **πŸ‘₯ Group Management** β€” Organize UPS devices into groups with flexible operating modes - - **Redundant Mode** β€” Only trigger actions when ALL UPS devices in a group are critical - - **Non-Redundant Mode** β€” Trigger actions when ANY UPS device is critical -- **βš™οΈ Action System** β€” Define custom responses with flexible trigger conditions - - Edge-triggered battery & runtime threshold triggers - - Power status change triggers - - Webhook notifications (POST/GET) - - Custom shell scripts - - Proxmox VM/LXC shutdown - - Configurable shutdown delays -- **🏭 Multiple UPS Brands** β€” CyberPower, APC, Eaton, TrippLite, Liebert/Vertiv, and custom OID - configurations -- **🌐 HTTP API** β€” Optional JSON status endpoint with token authentication -- **⏸️ Pause/Resume** β€” Temporarily suppress actions during maintenance windows -- **πŸ›‘οΈ Network Loss Detection** β€” Detects unreachable UPS devices and prevents false shutdowns -- **πŸ“Š Power Metrics** β€” Monitor output load, power (watts), voltage, and current -- **πŸ“¦ Single Binary** β€” Zero runtime dependencies. Download, `chmod +x`, run. -- **πŸ–₯️ Cross-Platform** β€” Linux (x64, ARM64), macOS (Intel, Apple Silicon), Windows +Power-failure automation must be boring, explicit, and local-first. NUPST is built as a single compiled Deno binary that can sit on a Proxmox host or another Linux server, poll one or more UPS devices, and execute a controlled shutdown sequence before batteries are exhausted. -## πŸš€ Quick Start +It is useful when you need: -### One-Line Installation +- SNMP monitoring for network UPS units. +- NUT/UPSD monitoring for USB UPS units exposed by Network UPS Tools. +- Multiple UPS devices on one daemon. +- Redundant or non-redundant UPS groups. +- Proxmox VM/LXC shutdown before host shutdown. +- Webhook or script notifications. +- A small authenticated HTTP JSON status endpoint. +- Pause/resume for maintenance windows. +- Configuration migration from older NUPST formats. + +## Installation + +Install the released binary: ```bash curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash ``` -### Initial Setup +Install through the npm package wrapper with pnpm: + +```bash +pnpm add --global @serve.zone/nupst +``` + +The installer places the binary under `/opt/nupst/nupst`, creates a symlink in `/usr/local/bin` or `/usr/bin`, and preserves existing `/etc/nupst/config.json` when upgrading. + +## Quick Start + +Create the first UPS config interactively: ```bash -# 1. Add your first UPS device (interactive wizard) sudo nupst ups add +``` -# 2. Test the connection -nupst ups test +Test connectivity: -# 3. Enable and start monitoring +```bash +nupst ups test --debug +``` + +Install and start the systemd service: + +```bash sudo nupst service enable sudo nupst service start +``` -# 4. Check status +Inspect status and logs: + +```bash nupst service status +nupst service logs ``` -**That's it!** Your system is now protected. πŸ›‘οΈ - -## πŸ“₯ Installation - -### Automated Installer (Recommended) +## CLI Reference ```bash -curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -``` - -**What it does:** - -1. Detects your platform (OS + architecture) -2. Downloads the latest pre-compiled binary -3. Installs to `/opt/nupst/nupst` -4. Creates symlink at `/usr/local/bin/nupst` -5. Preserves existing configuration - -**Options:** - -```bash -# Install specific version -curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | \ - sudo bash -s -- --version v5.0.0 - -# Custom installation directory -curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | \ - sudo bash -s -- --install-dir /usr/local/nupst - -# Show help -curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | bash -s -- --help -``` - -### Manual Installation - -Download the binary for your platform from -[releases](https://code.foss.global/serve.zone/nupst/releases): - -| Platform | Binary | -| ------------------- | ----------------------- | -| Linux x64 | `nupst-linux-x64` | -| Linux ARM64 | `nupst-linux-arm64` | -| macOS Intel | `nupst-macos-x64` | -| macOS Apple Silicon | `nupst-macos-arm64` | -| Windows x64 | `nupst-windows-x64.exe` | - -```bash -# Download (replace with your platform) -curl -sSL https://code.foss.global/serve.zone/nupst/releases/download/v5.0.0/nupst-linux-x64 -o nupst -chmod +x nupst -sudo mv nupst /usr/local/bin/nupst -``` - -### Via npm - -```bash -npm install -g @serve.zone/nupst -``` - -> This downloads the appropriate pre-compiled binary for your platform during installation. - -### Verify Installation - -```bash -nupst --version -nupst help -``` - -## πŸ“– CLI Reference - -### Command Structure - -``` nupst [subcommand] [options] ``` -### Global Options +Global options: -| Flag | Description | -| ----------------- | --------------------------------------------- | -| `--version`, `-v` | Show version | -| `--help`, `-h` | Show help | -| `--debug`, `-d` | Enable debug mode (verbose SNMP/UPSD logging) | +| Option | Purpose | +| --- | --- | +| `--version`, `-v` | Show version. | +| `--help`, `-h` | Show help. | +| `--debug`, `-d` | Enable detailed SNMP/UPSD logging. | -### Service Management +Service commands: -```bash -nupst service enable # Install and enable systemd service -nupst service disable # Stop and disable systemd service -nupst service start # Start the service -nupst service stop # Stop the service -nupst service restart # Restart the service -nupst service status # Show service and UPS status -nupst service logs # Tail live service logs (Ctrl+C to exit) +| Command | Purpose | +| --- | --- | +| `service enable` | Install and enable the systemd service. Requires root. | +| `service disable` | Stop, disable, and remove the service. Requires root. | +| `service start` | Start `nupst.service`. | +| `service stop` | Stop `nupst.service`. | +| `service restart` | Restart the service. | +| `service status` | Show service and UPS state. | +| `service logs` | Follow live service logs. | +| `service start-daemon` | Run the daemon process directly. Used by systemd/testing. | + +Configuration commands: + +| Command | Purpose | +| --- | --- | +| `ups add` | Add a UPS device interactively. | +| `ups edit [id]` | Edit a UPS device. | +| `ups remove ` | Remove a UPS device. Alias: `rm`. | +| `ups list` | List UPS devices. Alias: `ls`. | +| `ups test` | Test configured UPS connections. | +| `group add` | Create a UPS group. | +| `group edit ` | Edit a group. | +| `group remove ` | Remove a group. Alias: `rm`. | +| `group list` | List groups. Alias: `ls`. | +| `action add ` | Add an action to a UPS or group. | +| `action edit ` | Edit an action by array index. | +| `action remove ` | Remove an action. Alias: `rm`. | +| `action list [target-id]` | List actions globally or for one target. Alias: `ls`. | +| `feature httpServer` | Configure the optional JSON status endpoint. Aliases: `http-server`, `http`. | +| `config show` | Display the active configuration. | +| `pause [--duration