2025-10-18 13:33:46 +00:00
|
|
|
# NUPST - Network UPS Shutdown Tool
|
2025-03-25 09:06:23 +00:00
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
NUPST is a lightweight, self-contained command-line tool that monitors SNMP-enabled UPS devices and
|
|
|
|
initiates system shutdown when power outages are detected and battery levels are low.
|
2025-10-18 13:33:46 +00:00
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
**Version 4.0+** is powered by Deno and distributed as pre-compiled binaries requiring zero
|
|
|
|
dependencies.
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
## Features
|
|
|
|
|
2025-03-28 16:19:43 +00:00
|
|
|
- **Multi-UPS Support**: Monitor and manage multiple UPS devices from a single installation
|
|
|
|
- **Group Management**: Organize UPS devices into groups with different operating modes
|
|
|
|
- **Redundant Mode**: Only shutdown when ALL UPS devices in a group are in critical condition
|
|
|
|
- **Non-Redundant Mode**: Shutdown when ANY UPS device in a group is in critical condition
|
2025-10-19 13:14:18 +00:00
|
|
|
- **SNMP Protocol Support**: Full support for SNMP v1, v2c, and v3 with authentication and
|
|
|
|
encryption
|
|
|
|
- **Multiple UPS Brands**: Works with CyberPower, APC, Eaton, TrippLite, Liebert/Vertiv, and custom
|
|
|
|
OID configurations
|
2025-10-18 13:33:46 +00:00
|
|
|
- **Systemd Integration**: Simple service installation and management
|
|
|
|
- **Real-time Monitoring**: Live status updates and log viewing
|
|
|
|
- **Zero Dependencies**: Single self-contained binary with no runtime requirements
|
2025-10-19 13:14:18 +00:00
|
|
|
- **Cross-Platform**: Binaries available for Linux (x64, ARM64), macOS (Intel, Apple Silicon), and
|
|
|
|
Windows
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
### Quick Install (Recommended)
|
|
|
|
|
|
|
|
The easiest way to install NUPST is using the automated installer:
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
# Download and run installer (most reliable)
|
|
|
|
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh -o nupst-install.sh
|
|
|
|
sudo bash nupst-install.sh
|
|
|
|
rm nupst-install.sh
|
2025-03-25 13:15:48 +00:00
|
|
|
```
|
2025-03-25 13:12:38 +00:00
|
|
|
|
2025-03-25 13:15:48 +00:00
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
# One-line installation (non-interactive with auto-confirm)
|
2025-03-25 13:12:38 +00:00
|
|
|
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -s -- -y
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
The installer will:
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
1. Auto-detect your platform (OS and architecture)
|
|
|
|
2. Download the latest pre-compiled binary from releases
|
|
|
|
3. Install to `/opt/nupst/nupst`
|
|
|
|
4. Create a symlink in `/usr/local/bin/nupst` for global access
|
2025-03-25 13:15:48 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
### Manual Installation
|
2025-03-25 09:06:23 +00:00
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
Download the appropriate binary for your platform from the
|
|
|
|
[releases page](https://code.foss.global/serve.zone/nupst/releases):
|
2025-10-18 13:33:46 +00:00
|
|
|
|
|
|
|
- **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`
|
|
|
|
|
|
|
|
Then install manually:
|
2025-03-25 09:06:23 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
```bash
|
|
|
|
# Download binary (replace with your platform)
|
|
|
|
curl -sSL https://code.foss.global/serve.zone/nupst/releases/download/v4.0.0/nupst-linux-x64 -o nupst
|
2025-03-25 09:06:23 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Make executable
|
|
|
|
chmod +x nupst
|
2025-03-25 11:31:24 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Move to system path
|
|
|
|
sudo mv nupst /usr/local/bin/nupst
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
|
|
|
|
2025-03-25 11:31:24 +00:00
|
|
|
### Installation Options
|
|
|
|
|
|
|
|
The installer script (`install.sh`) supports the following options:
|
|
|
|
|
|
|
|
```
|
2025-10-18 13:33:46 +00:00
|
|
|
-y, --yes Automatically answer yes to all prompts
|
|
|
|
-h, --help Show help message
|
|
|
|
--version VERSION Install specific version (e.g., --version v4.0.0)
|
|
|
|
--install-dir DIR Custom installation directory (default: /opt/nupst)
|
2025-03-25 11:31:24 +00:00
|
|
|
```
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
Examples:
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
# Install specific version
|
|
|
|
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -s -- --version v4.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
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
|
|
|
|
2025-03-25 11:31:24 +00:00
|
|
|
## System Changes
|
|
|
|
|
|
|
|
When installed, NUPST makes the following changes to your system:
|
|
|
|
|
|
|
|
### File System Changes
|
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
| Path | Description |
|
|
|
|
| ----------------------------------- | -------------------------------------- |
|
|
|
|
| `/opt/nupst/nupst` | Pre-compiled binary (default location) |
|
|
|
|
| `/etc/nupst/config.json` | Configuration file |
|
|
|
|
| `/usr/local/bin/nupst` | Symlink to the NUPST binary |
|
|
|
|
| `/etc/systemd/system/nupst.service` | Systemd service file (when enabled) |
|
2025-03-25 11:31:24 +00:00
|
|
|
|
|
|
|
### Service Changes
|
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
- Creates and enables a systemd service called `nupst.service` (when enabled with
|
|
|
|
`nupst service enable`)
|
2025-03-25 11:31:24 +00:00
|
|
|
- The service runs with root permissions to allow system shutdown capabilities
|
|
|
|
|
|
|
|
### Network Access
|
|
|
|
|
|
|
|
- NUPST only communicates with your UPS device via SNMP (default port 161)
|
2025-10-18 13:33:46 +00:00
|
|
|
- No external network connections required after installation
|
2025-03-25 11:31:24 +00:00
|
|
|
|
2025-03-25 09:06:23 +00:00
|
|
|
## Uninstallation
|
|
|
|
|
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
# Disable and remove service first
|
|
|
|
sudo nupst service disable
|
2025-03-25 11:31:24 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Remove binary and config
|
|
|
|
sudo rm /usr/local/bin/nupst
|
|
|
|
sudo rm /opt/nupst/nupst
|
|
|
|
sudo rm -rf /etc/nupst/
|
2025-03-25 09:06:23 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Or use the uninstall script if installed from git
|
|
|
|
sudo ./uninstall.sh
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
### Command Structure (v4.0+)
|
|
|
|
|
|
|
|
NUPST v4.0 uses a subcommand structure for better organization:
|
|
|
|
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
2025-10-18 13:33:46 +00:00
|
|
|
NUPST - Network UPS Shutdown Tool
|
|
|
|
Version: 4.0.0
|
|
|
|
|
|
|
|
Usage: nupst <command> [subcommand] [options]
|
2025-03-25 09:06:23 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
Service Management:
|
|
|
|
nupst service enable - Install and enable the systemd service
|
|
|
|
nupst service disable - Stop and disable the systemd service
|
|
|
|
nupst service start - Start the systemd service
|
|
|
|
nupst service stop - Stop the systemd service
|
|
|
|
nupst service restart - Restart the systemd service
|
|
|
|
nupst service status - Show service and UPS status
|
|
|
|
nupst service logs - Show service logs in real-time
|
|
|
|
nupst service start-daemon - Start daemon directly (for testing)
|
2025-03-28 16:19:43 +00:00
|
|
|
|
|
|
|
UPS Management:
|
2025-10-18 13:33:46 +00:00
|
|
|
nupst ups add - Add a new UPS device
|
|
|
|
nupst ups edit [id] - Edit a UPS device (prompts if no ID)
|
|
|
|
nupst ups remove <id> - Remove a UPS device by ID
|
|
|
|
nupst ups list - List all configured UPS devices
|
|
|
|
nupst ups test - Test UPS connections
|
|
|
|
|
2025-03-28 16:19:43 +00:00
|
|
|
Group Management:
|
2025-10-18 13:33:46 +00:00
|
|
|
nupst group add - Add a new UPS group
|
|
|
|
nupst group edit <id> - Edit a UPS group
|
|
|
|
nupst group remove <id> - Remove a UPS group
|
|
|
|
nupst group list - List all UPS groups
|
|
|
|
|
|
|
|
Configuration:
|
|
|
|
nupst config show - Display current configuration
|
|
|
|
|
|
|
|
Global Options:
|
|
|
|
--version, -v - Show version information
|
|
|
|
--help, -h - Show help message
|
|
|
|
--debug, -d - Enable debug mode for detailed logging
|
|
|
|
|
|
|
|
Aliases (for backward compatibility):
|
|
|
|
nupst ls - Alias for 'nupst ups list'
|
|
|
|
nupst rm <id> - Alias for 'nupst ups remove'
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
### Quick Start Guide
|
|
|
|
|
|
|
|
1. **Install NUPST** (see Installation section above)
|
|
|
|
|
|
|
|
2. **Add your first UPS device:**
|
|
|
|
```bash
|
|
|
|
sudo nupst ups add
|
|
|
|
```
|
|
|
|
Follow the interactive prompts to configure your UPS.
|
|
|
|
|
|
|
|
3. **Test the configuration:**
|
|
|
|
```bash
|
|
|
|
nupst ups test
|
|
|
|
```
|
|
|
|
|
|
|
|
4. **Enable the service:**
|
|
|
|
```bash
|
|
|
|
sudo nupst service enable
|
|
|
|
sudo nupst service start
|
|
|
|
```
|
|
|
|
|
|
|
|
5. **Check status:**
|
|
|
|
```bash
|
|
|
|
nupst service status
|
|
|
|
```
|
|
|
|
|
|
|
|
6. **View logs:**
|
|
|
|
```bash
|
|
|
|
nupst service logs
|
|
|
|
```
|
|
|
|
|
2025-03-25 09:06:23 +00:00
|
|
|
## Configuration
|
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
NUPST supports monitoring multiple UPS devices organized into groups. The configuration file is
|
|
|
|
located at `/etc/nupst/config.json`.
|
2025-10-18 13:33:46 +00:00
|
|
|
|
|
|
|
### Interactive Configuration
|
|
|
|
|
|
|
|
The easiest way to configure NUPST is through the interactive commands:
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
```bash
|
2025-03-28 16:19:43 +00:00
|
|
|
# Add a new UPS device
|
2025-10-18 13:33:46 +00:00
|
|
|
sudo nupst ups add
|
2025-03-28 16:19:43 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Create a group
|
|
|
|
sudo nupst group add
|
2025-03-28 16:19:43 +00:00
|
|
|
|
|
|
|
# Assign UPS devices to groups
|
2025-10-18 13:33:46 +00:00
|
|
|
sudo nupst group edit <group-id>
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
|
|
|
|
2025-03-28 16:19:43 +00:00
|
|
|
### Configuration File Structure
|
2025-03-25 09:06:23 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
Here's an example configuration with multiple UPS devices in a redundant group:
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2025-03-28 16:19:43 +00:00
|
|
|
"checkInterval": 30000,
|
|
|
|
"upsDevices": [
|
|
|
|
{
|
|
|
|
"id": "ups-1",
|
|
|
|
"name": "Server Room UPS",
|
|
|
|
"snmp": {
|
|
|
|
"host": "192.168.1.100",
|
|
|
|
"port": 161,
|
|
|
|
"community": "public",
|
|
|
|
"version": 1,
|
|
|
|
"timeout": 5000,
|
|
|
|
"upsModel": "cyberpower"
|
|
|
|
},
|
|
|
|
"thresholds": {
|
|
|
|
"battery": 60,
|
|
|
|
"runtime": 20
|
|
|
|
},
|
|
|
|
"groups": ["datacenter"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "ups-2",
|
|
|
|
"name": "Network Rack UPS",
|
|
|
|
"snmp": {
|
|
|
|
"host": "192.168.1.101",
|
|
|
|
"port": 161,
|
|
|
|
"community": "public",
|
|
|
|
"version": 1,
|
|
|
|
"timeout": 5000,
|
|
|
|
"upsModel": "apc"
|
|
|
|
},
|
|
|
|
"thresholds": {
|
|
|
|
"battery": 50,
|
|
|
|
"runtime": 15
|
|
|
|
},
|
|
|
|
"groups": ["datacenter"]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"groups": [
|
|
|
|
{
|
|
|
|
"id": "datacenter",
|
|
|
|
"name": "Data Center",
|
|
|
|
"mode": "redundant",
|
2025-10-18 13:33:46 +00:00
|
|
|
"description": "Main data center UPS group with redundant power"
|
2025-03-28 16:19:43 +00:00
|
|
|
}
|
|
|
|
]
|
2025-03-25 09:06:23 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2025-03-28 16:19:43 +00:00
|
|
|
### Configuration Fields
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
#### Global Settings
|
|
|
|
|
2025-03-25 09:06:23 +00:00
|
|
|
- `checkInterval`: How often to check UPS status in milliseconds (default: 30000)
|
2025-10-18 13:33:46 +00:00
|
|
|
|
|
|
|
#### UPS Device Settings
|
|
|
|
|
|
|
|
- `id`: Unique identifier for the UPS
|
|
|
|
- `name`: Friendly name for the UPS
|
|
|
|
- `groups`: Array of group IDs this UPS belongs to
|
|
|
|
|
|
|
|
**SNMP Configuration:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
- `host`: IP address or hostname of your UPS
|
|
|
|
- `port`: SNMP port (default: 161)
|
|
|
|
- `version`: SNMP version (1, 2, or 3)
|
|
|
|
- `timeout`: Timeout in milliseconds (default: 5000)
|
|
|
|
- `upsModel`: UPS brand ('cyberpower', 'apc', 'eaton', 'tripplite', 'liebert', or 'custom')
|
|
|
|
|
|
|
|
**For SNMPv1/v2c:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
- `community`: SNMP community string (default: "public")
|
|
|
|
|
|
|
|
**For SNMPv3:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
- `securityLevel`: 'noAuthNoPriv', 'authNoPriv', or 'authPriv'
|
|
|
|
- `username`: SNMPv3 username
|
|
|
|
- `authProtocol`: 'MD5' or 'SHA'
|
|
|
|
- `authKey`: Authentication password
|
|
|
|
- `privProtocol`: 'DES' or 'AES' (for authPriv level)
|
|
|
|
- `privKey`: Privacy/encryption password
|
|
|
|
|
|
|
|
**For Custom UPS Models:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
- `customOIDs`: Custom OID mappings
|
|
|
|
- `POWER_STATUS`: OID for AC power status
|
|
|
|
- `BATTERY_CAPACITY`: OID for battery percentage
|
|
|
|
- `BATTERY_RUNTIME`: OID for runtime remaining (minutes)
|
|
|
|
|
|
|
|
**Shutdown Thresholds:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
- `battery`: Battery percentage threshold (default: 60%)
|
|
|
|
- `runtime`: Runtime minutes threshold (default: 20 minutes)
|
|
|
|
|
|
|
|
#### Group Settings
|
|
|
|
|
|
|
|
- `id`: Unique identifier for the group
|
|
|
|
- `name`: Friendly name for the group
|
|
|
|
- `mode`: Operating mode ('redundant' or 'nonRedundant')
|
|
|
|
- `description`: Optional description
|
2025-03-28 16:19:43 +00:00
|
|
|
|
|
|
|
### Group Modes
|
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
- **Redundant Mode**: System shuts down only when ALL UPS devices in the group are critical. Ideal
|
|
|
|
for setups with backup UPS units where one can maintain power.
|
2025-10-18 13:33:46 +00:00
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
- **Non-Redundant Mode**: System shuts down when ANY UPS device in the group is critical. Used when
|
|
|
|
all UPS devices must be operational for system stability.
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
## Setup as a Service
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
Enable NUPST as a systemd service for automatic monitoring:
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
# Enable and start service
|
|
|
|
sudo nupst service enable
|
|
|
|
sudo nupst service start
|
|
|
|
|
|
|
|
# Check status
|
|
|
|
nupst service status
|
|
|
|
|
|
|
|
# View real-time logs
|
|
|
|
nupst service logs
|
|
|
|
|
|
|
|
# Stop service
|
|
|
|
sudo nupst service stop
|
|
|
|
|
|
|
|
# Disable service
|
|
|
|
sudo nupst service disable
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
## Updating NUPST
|
|
|
|
|
|
|
|
### Automatic Update
|
|
|
|
|
|
|
|
Re-run the installer to update to the latest version:
|
2025-03-25 09:06:23 +00:00
|
|
|
|
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -s -- -y
|
2025-03-25 09:06:23 +00:00
|
|
|
```
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
The installer will:
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
1. Download the latest binary
|
|
|
|
2. Replace the existing installation
|
|
|
|
3. Preserve your configuration at `/etc/nupst/config.json`
|
|
|
|
4. Restart the service if it was running
|
|
|
|
|
|
|
|
### Manual Update
|
|
|
|
|
|
|
|
1. Download the latest binary from [releases](https://code.foss.global/serve.zone/nupst/releases)
|
|
|
|
2. Replace the existing binary:
|
|
|
|
```bash
|
|
|
|
sudo nupst service stop
|
|
|
|
sudo mv nupst-linux-x64 /opt/nupst/nupst # adjust for your platform
|
|
|
|
sudo chmod +x /opt/nupst/nupst
|
|
|
|
sudo nupst service start
|
|
|
|
```
|
|
|
|
|
|
|
|
### Version Checking
|
|
|
|
|
|
|
|
Check your current version:
|
2025-03-25 09:49:30 +00:00
|
|
|
|
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
nupst --version
|
2025-03-25 09:49:30 +00:00
|
|
|
```
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
## Security
|
|
|
|
|
|
|
|
NUPST is designed with security as a priority:
|
|
|
|
|
|
|
|
### Architecture Security
|
|
|
|
|
|
|
|
- **Single Binary**: Self-contained executable with no external dependencies
|
|
|
|
- **No Runtime Dependencies**: Unlike v3.x (Node.js), v4.0+ requires no runtime environment
|
|
|
|
- **Minimal Attack Surface**: Compiled Deno binary with only essential SNMP functionality
|
|
|
|
- **No Supply Chain Risk**: Pre-compiled binaries verified with SHA256 checksums
|
|
|
|
- **Isolated Execution**: Runs with minimal required privileges
|
|
|
|
|
|
|
|
### SNMP Security
|
|
|
|
|
|
|
|
- **SNMPv3 Support**: Full authentication and encryption support
|
|
|
|
- `noAuthNoPriv`: Basic access (no security)
|
|
|
|
- `authNoPriv`: Authentication without encryption
|
|
|
|
- `authPriv`: Full authentication and encryption (recommended)
|
|
|
|
- **Authentication**: MD5 or SHA protocols
|
|
|
|
- **Encryption**: DES or AES privacy protocols
|
|
|
|
- **Secure Defaults**: Automatic timeout adjustment based on security level
|
|
|
|
|
|
|
|
### Installation Security
|
|
|
|
|
|
|
|
- **Checksum Verification**: SHA256SUMS.txt provided for all releases
|
|
|
|
- **Transparent Installation**: Standard locations with clear documentation
|
|
|
|
- **Minimal Permissions**: Only systemd operations require root access
|
|
|
|
- **Source Available**: Full source code available for audit
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
### Network Security
|
|
|
|
|
|
|
|
- **Local-Only Communication**: Only connects to UPS devices on local network
|
|
|
|
- **No Telemetry**: No data sent to external servers
|
|
|
|
- **No Update Checks**: Manual update process only
|
|
|
|
|
|
|
|
### Verifying Downloads
|
|
|
|
|
|
|
|
All releases include SHA256 checksums:
|
2025-03-25 09:49:30 +00:00
|
|
|
|
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
# Download binary and checksums
|
|
|
|
curl -sSL https://code.foss.global/serve.zone/nupst/releases/download/v4.0.0/nupst-linux-x64 -o nupst
|
|
|
|
curl -sSL https://code.foss.global/serve.zone/nupst/releases/download/v4.0.0/SHA256SUMS.txt -o SHA256SUMS.txt
|
|
|
|
|
|
|
|
# Verify checksum
|
|
|
|
sha256sum -c SHA256SUMS.txt --ignore-missing
|
2025-03-25 09:49:30 +00:00
|
|
|
```
|
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
## Migration from v3.x
|
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
If you're upgrading from NUPST v3.x (Node.js-based) to v4.0 (Deno-based), the migration is
|
|
|
|
straightforward using the install.sh script.
|
2025-10-19 13:05:51 +00:00
|
|
|
|
|
|
|
### Quick Migration
|
|
|
|
|
|
|
|
The installer script automatically handles the entire migration while preserving your configuration:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Run the installer (handles stop/update/restart automatically)
|
|
|
|
curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh | sudo bash -s -- -y
|
|
|
|
|
|
|
|
# Verify
|
|
|
|
nupst service status
|
|
|
|
```
|
|
|
|
|
|
|
|
**That's it!** The installer automatically:
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-19 13:05:51 +00:00
|
|
|
- Detects your v3.x installation
|
|
|
|
- Stops the running service
|
|
|
|
- Replaces the binary with v4.0
|
|
|
|
- Restarts the service
|
|
|
|
- Preserves your `/etc/nupst/config.json` (fully compatible, no changes needed)
|
|
|
|
|
|
|
|
### Key Changes in v4.0
|
|
|
|
|
|
|
|
- **Runtime**: Node.js → Deno
|
|
|
|
- **Distribution**: Git repository + npm packages → Pre-compiled binaries
|
|
|
|
- **Installation**: Clone + setup.sh → Download binary via install.sh
|
|
|
|
- **Dependencies**: Node.js + npm packages → Zero dependencies (self-contained binary)
|
|
|
|
- **CLI Structure**: Flat commands → Subcommand structure (backward compatible)
|
|
|
|
- **Updates**: `nupst update` → Re-run install.sh
|
|
|
|
- **Footprint**: Single ~340MB self-contained binary (vs repo + node_modules in v3.x)
|
|
|
|
- **Startup**: Seconds → Milliseconds
|
|
|
|
|
|
|
|
### Command Mapping
|
|
|
|
|
|
|
|
v4.0 uses a new subcommand structure, but **old commands still work** with deprecation warnings:
|
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
| v3.x Command | v4.0 Command | Notes |
|
|
|
|
| ------------------- | ----------------------- | ---------------------- |
|
|
|
|
| `nupst enable` | `nupst service enable` | Old works with warning |
|
|
|
|
| `nupst disable` | `nupst service disable` | Old works with warning |
|
|
|
|
| `nupst start` | `nupst service start` | Old works with warning |
|
|
|
|
| `nupst stop` | `nupst service stop` | Old works with warning |
|
|
|
|
| `nupst status` | `nupst service status` | Old works with warning |
|
|
|
|
| `nupst logs` | `nupst service logs` | Old works with warning |
|
|
|
|
| `nupst add` | `nupst ups add` | Old works with warning |
|
|
|
|
| `nupst edit [id]` | `nupst ups edit [id]` | Old works with warning |
|
2025-10-19 13:05:51 +00:00
|
|
|
| `nupst delete <id>` | `nupst ups remove <id>` | Old works with warning |
|
2025-10-19 13:14:18 +00:00
|
|
|
| `nupst list` | `nupst ups list` | Old works with warning |
|
|
|
|
| `nupst test` | `nupst ups test` | Old works with warning |
|
|
|
|
| `nupst config` | `nupst config show` | Old works with warning |
|
2025-10-19 13:05:51 +00:00
|
|
|
|
|
|
|
**New aliases:** `nupst ls` (list UPS devices), `nupst rm <id>` (remove UPS device)
|
|
|
|
|
|
|
|
### Configuration Compatibility
|
|
|
|
|
|
|
|
✅ **Fully Compatible:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-19 13:05:51 +00:00
|
|
|
- Configuration file format: `/etc/nupst/config.json`
|
|
|
|
- All SNMP settings (host, port, community, version, security)
|
|
|
|
- UPS device configurations (IDs, names, thresholds, groups)
|
|
|
|
- Group configurations (redundant/non-redundant modes)
|
|
|
|
- Supported UPS models (CyberPower, APC, Eaton, TrippLite, Liebert, custom OIDs)
|
|
|
|
|
|
|
|
### Troubleshooting Migration
|
|
|
|
|
|
|
|
**Service won't start after migration:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-19 13:05:51 +00:00
|
|
|
```bash
|
|
|
|
# Re-enable service to update systemd file
|
|
|
|
sudo nupst service disable
|
|
|
|
sudo nupst service enable
|
|
|
|
sudo nupst service start
|
|
|
|
```
|
|
|
|
|
|
|
|
**Binary won't execute:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-19 13:05:51 +00:00
|
|
|
```bash
|
|
|
|
sudo chmod +x /opt/nupst/nupst
|
|
|
|
```
|
|
|
|
|
|
|
|
**Command not found:**
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-19 13:05:51 +00:00
|
|
|
```bash
|
|
|
|
# Recreate symlink
|
|
|
|
sudo ln -sf /opt/nupst/nupst /usr/local/bin/nupst
|
|
|
|
```
|
2025-10-18 13:33:46 +00:00
|
|
|
|
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
### Binary Won't Execute
|
2025-03-26 13:49:47 +00:00
|
|
|
|
|
|
|
```bash
|
2025-10-18 13:33:46 +00:00
|
|
|
# Make sure it's executable
|
|
|
|
chmod +x /opt/nupst/nupst
|
2025-03-26 13:54:49 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Check architecture matches your system
|
|
|
|
uname -m # Should match binary (x86_64 = x64, aarch64 = arm64)
|
2025-03-26 13:49:47 +00:00
|
|
|
```
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
### Service Won't Start
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
```bash
|
|
|
|
# Check service status
|
|
|
|
sudo systemctl status nupst
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Check logs for errors
|
|
|
|
sudo journalctl -u nupst -n 50
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Verify configuration
|
|
|
|
nupst config show
|
|
|
|
```
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
### Can't Connect to UPS
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
```bash
|
|
|
|
# Test SNMP connectivity
|
|
|
|
nupst ups test --debug
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Check network connectivity
|
|
|
|
ping <ups-ip-address>
|
2025-03-26 13:27:47 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
# Verify SNMP port is accessible
|
|
|
|
nc -zv <ups-ip-address> 161
|
|
|
|
```
|
2025-03-26 13:27:47 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
### Permission Denied Errors
|
|
|
|
|
|
|
|
Most operations that modify the system require root:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Service management
|
|
|
|
sudo nupst service enable
|
|
|
|
sudo nupst service start
|
|
|
|
|
|
|
|
# Configuration changes
|
|
|
|
sudo nupst ups add
|
|
|
|
sudo nupst group add
|
|
|
|
```
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
### Building from Source
|
|
|
|
|
|
|
|
Requirements:
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
- [Deno](https://deno.land/) v1.x or later
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# Clone repository
|
|
|
|
git clone https://code.foss.global/serve.zone/nupst.git
|
|
|
|
cd nupst
|
|
|
|
|
|
|
|
# Run directly with Deno
|
|
|
|
deno run --allow-all mod.ts help
|
|
|
|
|
|
|
|
# Compile for current platform
|
|
|
|
deno compile --allow-all --output nupst mod.ts
|
|
|
|
|
|
|
|
# Compile for all platforms
|
|
|
|
bash scripts/compile-all.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
### Running Tests
|
|
|
|
|
|
|
|
```bash
|
|
|
|
deno test --allow-all tests/
|
|
|
|
```
|
|
|
|
|
|
|
|
### Contributing
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
Contributions are welcome! Please:
|
2025-10-19 13:14:18 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
1. Fork the repository
|
|
|
|
2. Create a feature branch
|
|
|
|
3. Make your changes
|
|
|
|
4. Submit a pull request
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
## Support
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-10-18 13:33:46 +00:00
|
|
|
- **Issues**: [Report bugs or request features](https://code.foss.global/serve.zone/nupst/issues)
|
|
|
|
- **Documentation**: [Full documentation](https://code.foss.global/serve.zone/nupst)
|
|
|
|
- **Source Code**: [View source](https://code.foss.global/serve.zone/nupst)
|
2025-03-25 09:49:30 +00:00
|
|
|
|
2025-03-25 11:36:11 +00:00
|
|
|
## License and Legal Information
|
2025-03-25 09:06:23 +00:00
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
This repository contains open-source code licensed under the MIT License. A copy of the MIT License
|
|
|
|
can be found in the [license](license) file within this repository.
|
2025-03-25 11:36:11 +00:00
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks,
|
|
|
|
service marks, or product names of the project, except as required for reasonable and customary use
|
|
|
|
in describing the origin of the work and reproducing the content of the NOTICE file.
|
2025-03-25 11:36:11 +00:00
|
|
|
|
|
|
|
### Trademarks
|
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated
|
|
|
|
with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture
|
|
|
|
Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these
|
|
|
|
trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be
|
|
|
|
approved in writing by Task Venture Capital GmbH.
|
2025-03-25 11:36:11 +00:00
|
|
|
|
|
|
|
### Company Information
|
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
Task Venture Capital GmbH Registered at District court Bremen HRB 35230 HB, Germany
|
2025-03-25 11:36:11 +00:00
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
For any legal inquiries or if you require further information, please contact us via email at
|
|
|
|
hello@task.vc.
|
2025-03-25 11:36:11 +00:00
|
|
|
|
2025-10-19 13:14:18 +00:00
|
|
|
By using this repository, you acknowledge that you have read this section, agree to comply with its
|
|
|
|
terms, and understand that the licensing of the code does not imply endorsement by Task Venture
|
|
|
|
Capital GmbH of any derivative works.
|