style: configure deno fmt to use single quotes
- Add singleQuote: true to deno.json fmt configuration - Reformat all files with single quotes using deno fmt
This commit is contained in:
108
readme.md
108
readme.md
@@ -1,8 +1,10 @@
|
||||
# NUPST - Network UPS Shutdown Tool
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
**Version 4.0+** is powered by Deno and distributed as pre-compiled binaries requiring zero dependencies.
|
||||
**Version 4.0+** is powered by Deno and distributed as pre-compiled binaries requiring zero
|
||||
dependencies.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -10,12 +12,15 @@ NUPST is a lightweight, self-contained command-line tool that monitors SNMP-enab
|
||||
- **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
|
||||
- **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
|
||||
- **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
|
||||
- **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
|
||||
- **Cross-Platform**: Binaries available for Linux (x64, ARM64), macOS (Intel, Apple Silicon), and Windows
|
||||
- **Cross-Platform**: Binaries available for Linux (x64, ARM64), macOS (Intel, Apple Silicon), and
|
||||
Windows
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -36,6 +41,7 @@ curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh |
|
||||
```
|
||||
|
||||
The installer will:
|
||||
|
||||
1. Auto-detect your platform (OS and architecture)
|
||||
2. Download the latest pre-compiled binary from releases
|
||||
3. Install to `/opt/nupst/nupst`
|
||||
@@ -43,7 +49,8 @@ The installer will:
|
||||
|
||||
### Manual Installation
|
||||
|
||||
Download the appropriate binary for your platform from the [releases page](https://code.foss.global/serve.zone/nupst/releases):
|
||||
Download the appropriate binary for your platform from the
|
||||
[releases page](https://code.foss.global/serve.zone/nupst/releases):
|
||||
|
||||
- **Linux x64**: `nupst-linux-x64`
|
||||
- **Linux ARM64**: `nupst-linux-arm64`
|
||||
@@ -91,16 +98,17 @@ When installed, NUPST makes the following changes to your system:
|
||||
|
||||
### File System Changes
|
||||
|
||||
| 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) |
|
||||
| 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) |
|
||||
|
||||
### Service Changes
|
||||
|
||||
- Creates and enables a systemd service called `nupst.service` (when enabled with `nupst service enable`)
|
||||
- Creates and enables a systemd service called `nupst.service` (when enabled with
|
||||
`nupst service enable`)
|
||||
- The service runs with root permissions to allow system shutdown capabilities
|
||||
|
||||
### Network Access
|
||||
@@ -204,7 +212,8 @@ Aliases (for backward compatibility):
|
||||
|
||||
## Configuration
|
||||
|
||||
NUPST supports monitoring multiple UPS devices organized into groups. The configuration file is located at `/etc/nupst/config.json`.
|
||||
NUPST supports monitoring multiple UPS devices organized into groups. The configuration file is
|
||||
located at `/etc/nupst/config.json`.
|
||||
|
||||
### Interactive Configuration
|
||||
|
||||
@@ -288,6 +297,7 @@ Here's an example configuration with multiple UPS devices in a redundant group:
|
||||
- `groups`: Array of group IDs this UPS belongs to
|
||||
|
||||
**SNMP Configuration:**
|
||||
|
||||
- `host`: IP address or hostname of your UPS
|
||||
- `port`: SNMP port (default: 161)
|
||||
- `version`: SNMP version (1, 2, or 3)
|
||||
@@ -295,9 +305,11 @@ Here's an example configuration with multiple UPS devices in a redundant group:
|
||||
- `upsModel`: UPS brand ('cyberpower', 'apc', 'eaton', 'tripplite', 'liebert', or 'custom')
|
||||
|
||||
**For SNMPv1/v2c:**
|
||||
|
||||
- `community`: SNMP community string (default: "public")
|
||||
|
||||
**For SNMPv3:**
|
||||
|
||||
- `securityLevel`: 'noAuthNoPriv', 'authNoPriv', or 'authPriv'
|
||||
- `username`: SNMPv3 username
|
||||
- `authProtocol`: 'MD5' or 'SHA'
|
||||
@@ -306,12 +318,14 @@ Here's an example configuration with multiple UPS devices in a redundant group:
|
||||
- `privKey`: Privacy/encryption password
|
||||
|
||||
**For Custom UPS Models:**
|
||||
|
||||
- `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:**
|
||||
|
||||
- `battery`: Battery percentage threshold (default: 60%)
|
||||
- `runtime`: Runtime minutes threshold (default: 20 minutes)
|
||||
|
||||
@@ -324,9 +338,11 @@ Here's an example configuration with multiple UPS devices in a redundant group:
|
||||
|
||||
### Group Modes
|
||||
|
||||
- **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.
|
||||
- **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.
|
||||
|
||||
- **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.
|
||||
- **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.
|
||||
|
||||
## Setup as a Service
|
||||
|
||||
@@ -361,6 +377,7 @@ curl -sSL https://code.foss.global/serve.zone/nupst/raw/branch/main/install.sh |
|
||||
```
|
||||
|
||||
The installer will:
|
||||
|
||||
1. Download the latest binary
|
||||
2. Replace the existing installation
|
||||
3. Preserve your configuration at `/etc/nupst/config.json`
|
||||
@@ -435,7 +452,8 @@ sha256sum -c SHA256SUMS.txt --ignore-missing
|
||||
|
||||
## Migration from v3.x
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
### Quick Migration
|
||||
|
||||
@@ -450,6 +468,7 @@ nupst service status
|
||||
```
|
||||
|
||||
**That's it!** The installer automatically:
|
||||
|
||||
- Detects your v3.x installation
|
||||
- Stops the running service
|
||||
- Replaces the binary with v4.0
|
||||
@@ -471,26 +490,27 @@ nupst service status
|
||||
|
||||
v4.0 uses a new subcommand structure, but **old commands still work** with deprecation warnings:
|
||||
|
||||
| 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 |
|
||||
| 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 |
|
||||
| `nupst delete <id>` | `nupst ups remove <id>` | Old works with warning |
|
||||
| `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 |
|
||||
| `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 |
|
||||
|
||||
**New aliases:** `nupst ls` (list UPS devices), `nupst rm <id>` (remove UPS device)
|
||||
|
||||
### Configuration Compatibility
|
||||
|
||||
✅ **Fully Compatible:**
|
||||
|
||||
- Configuration file format: `/etc/nupst/config.json`
|
||||
- All SNMP settings (host, port, community, version, security)
|
||||
- UPS device configurations (IDs, names, thresholds, groups)
|
||||
@@ -500,6 +520,7 @@ v4.0 uses a new subcommand structure, but **old commands still work** with depre
|
||||
### Troubleshooting Migration
|
||||
|
||||
**Service won't start after migration:**
|
||||
|
||||
```bash
|
||||
# Re-enable service to update systemd file
|
||||
sudo nupst service disable
|
||||
@@ -508,11 +529,13 @@ sudo nupst service start
|
||||
```
|
||||
|
||||
**Binary won't execute:**
|
||||
|
||||
```bash
|
||||
sudo chmod +x /opt/nupst/nupst
|
||||
```
|
||||
|
||||
**Command not found:**
|
||||
|
||||
```bash
|
||||
# Recreate symlink
|
||||
sudo ln -sf /opt/nupst/nupst /usr/local/bin/nupst
|
||||
@@ -575,6 +598,7 @@ sudo nupst group add
|
||||
### Building from Source
|
||||
|
||||
Requirements:
|
||||
|
||||
- [Deno](https://deno.land/) v1.x or later
|
||||
|
||||
```bash
|
||||
@@ -601,6 +625,7 @@ deno test --allow-all tests/
|
||||
### Contributing
|
||||
|
||||
Contributions are welcome! Please:
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
@@ -614,19 +639,28 @@ Contributions are welcome! Please:
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
**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.
|
||||
**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.
|
||||
|
||||
### Trademarks
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District court Bremen HRB 35230 HB, Germany
|
||||
Task Venture Capital GmbH Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
For any legal inquiries or if you require further information, please contact us via email at
|
||||
hello@task.vc.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
Reference in New Issue
Block a user