feat(snmp): add configurable SNMP runtime units with v4.3 migration support
This commit is contained in:
11
readme.md
11
readme.md
@@ -223,7 +223,7 @@ NUPST stores configuration at `/etc/nupst/config.json`. The easiest way to confi
|
||||
|
||||
```json
|
||||
{
|
||||
"version": "4.2",
|
||||
"version": "4.3",
|
||||
"checkInterval": 30000,
|
||||
"httpServer": {
|
||||
"enabled": true,
|
||||
@@ -242,7 +242,8 @@ NUPST stores configuration at `/etc/nupst/config.json`. The easiest way to confi
|
||||
"community": "public",
|
||||
"version": 1,
|
||||
"timeout": 5000,
|
||||
"upsModel": "cyberpower"
|
||||
"upsModel": "cyberpower",
|
||||
"runtimeUnit": "ticks"
|
||||
},
|
||||
"actions": [
|
||||
{
|
||||
@@ -323,6 +324,7 @@ Each UPS device has a `protocol` field:
|
||||
| `version` | SNMP version | `1`, `2`, or `3` |
|
||||
| `timeout` | Timeout in milliseconds | Default: `5000` |
|
||||
| `upsModel` | UPS brand/model | `cyberpower`, `apc`, `eaton`, `tripplite`, `liebert`, `custom` |
|
||||
| `runtimeUnit` | Battery runtime unit | `minutes`, `seconds`, or `ticks` (1/100s). Overrides auto-detection |
|
||||
| `community` | Community string (v1/v2c) | Default: `"public"` |
|
||||
|
||||
**SNMPv3 fields** (when `version: 3`):
|
||||
@@ -659,6 +661,7 @@ sha256sum -c SHA256SUMS.txt --ignore-missing
|
||||
```json
|
||||
{
|
||||
"upsModel": "custom",
|
||||
"runtimeUnit": "seconds",
|
||||
"customOIDs": {
|
||||
"POWER_STATUS": "1.3.6.1.4.1.1234.1.1.0",
|
||||
"BATTERY_CAPACITY": "1.3.6.1.4.1.1234.1.2.0",
|
||||
@@ -667,6 +670,8 @@ sha256sum -c SHA256SUMS.txt --ignore-missing
|
||||
}
|
||||
```
|
||||
|
||||
> 💡 **Tip:** If your UPS (e.g., HPE, Huawei) reports runtime in seconds instead of minutes, set `"runtimeUnit": "seconds"`. For CyberPower-style TimeTicks (1/100 second), use `"ticks"`. When omitted, NUPST auto-detects based on `upsModel`.
|
||||
|
||||
### UPSD/NIS-based
|
||||
|
||||
Any UPS supported by [NUT (Network UPS Tools)](https://networkupstools.org/) — this covers **hundreds of models** from virtually every manufacturer, including USB-connected devices. Check the [NUT hardware compatibility list](https://networkupstools.org/stable-hcl.html).
|
||||
@@ -848,7 +853,7 @@ nupst/
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
|
||||
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license) 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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user