PeaNUT: A Tiny Dashboard for Network UPS Tools

Summary
PeaNUT is an open-source, lightweight dashboard designed to monitor Uninterruptible Power Supply (UPS) devices connected via Network UPS Tools (NUT). It provides real-time statistics, status updates, and control capabilities through a user-friendly interface. Built with TypeScript and Next.js, PeaNUT offers flexible deployment options and extensive integration possibilities for home lab enthusiasts and system administrators.
Repository Info
Tags
Click on any tag to explore related repositories
Introduction
PeaNUT is an open-source, lightweight dashboard designed to provide a user-friendly interface for monitoring Uninterruptible Power Supply (UPS) devices connected via Network UPS Tools (NUT). It allows users to view real-time statistics, status updates, and manage their UPS devices efficiently. Built with TypeScript and Next.js, PeaNUT offers a modern and responsive experience for keeping an eye on your power infrastructure.
Installation
PeaNUT provides flexible installation options, primarily leveraging Docker for ease of deployment.
Using Docker
You can run PeaNUT directly with docker run or integrate it into your docker-compose.yml setup.
docker run
docker run -v ${PWD}/config:/config -p 8080:8080 --restart unless-stopped \
--env WEB_PORT=8080 brandawg93/peanut
docker-compose.yml
services:
peanut:
image: brandawg93/peanut:latest
container_name: PeaNUT
restart: unless-stopped
volumes:
- /path/to/config:/config
ports:
- 8080:8080
environment:
- WEB_PORT=8080
Compile from Source
For those who prefer to build from source, PeaNUT can be compiled using pnpm.
git clone https://github.com/Brandawg93/PeaNUT.git
cd PeaNUT
npm i -g pnpm # only if you don't have pnpm installed
pnpm i
pnpm run build:local
pnpm run start:local
PeaNUT supports linux/amd64 and linux/arm64 platforms, making it suitable for devices like Raspberry Pi 4+.
Examples
PeaNUT is designed for integration and offers various ways to display and interact with your UPS data.
Homepage Support
PeaNUT integrates seamlessly with Homepage, allowing you to display UPS metrics directly on your dashboard.
widget:
type: peanut
url: http://peanut.host.or.ip:port
key: nameofyourups
More advanced customization is possible using the customapi widget.
Glance Support
You can also integrate PeaNUT with Glance for a detailed overview of your UPS status.
- type: custom-api
title: UPS
cache: 5m
url: http://{HOSTNAME}:{PORT}/api/v1/devices/{UPS_NAME}
template: |
{{ if .JSON.Exists "ups\.status" }}
{{ $jsonStatus := .JSON.String "ups\.status" }}
<div class="flex justify-between text-center">
<div>
<div class="color-highlight size-h3">{{ .JSON.Int "battery\.charge" | formatNumber }}%</div>
<div class="size-h6">BATTERY CHARGE</div>
</div>
<div>
<div class="color-highlight size-h3">{{ concat (.JSON.String "battery\.runtime") "s" | duration }} ({{ div (.JSON.Int "battery\.runtime") 60 | formatNumber }} Wh)</div>
<div class="size-h6">BATTERY RUNTIME</div>
</div>
<div>
<div class="color-highlight size-h3">{{ .JSON.Int "ups\.load" | formatNumber }}% ({{ .JSON.Int "ups\.realpower" | formatNumber }} W / {{ .JSON.Int "ups\.power" | formatNumber }} VA)</div>
<div class="size-h6">UPS LOAD</div>
</div>
<div>
<div class="color-highlight size-h3">
{{ if eq $jsonStatus "OL" }}
Online
{{ else if eq $jsonStatus "OL CHRG" }}
Online Charging
{{ else if eq $jsonStatus "OB" }}
On Battery
{{ else if eq $jsonStatus "OB DISCHRG" }}
On Battery Discharging
{{ else if eq $jsonStatus "LB" }}
Low Battery
{{ else }}
Unknown
{{ end }}
</div>
<div class="size-h6">UPS STATUS</div>
</div>
</div>
{{ else }}
<div class="widget-error-header">
<div class="color-negative size-h3">ERROR</div>
<svg class="widget-error-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"></path>
</svg>
</div>
<p class="break-all">UPS is unavailable</p>
{{ end }}
API Access
PeaNUT also provides a comprehensive API for integration with other tools and custom scripting, allowing for programmatic control and data retrieval from your UPS devices.
Why Use PeaNUT
PeaNUT stands out as an excellent choice for UPS monitoring due to its robust feature set and user-friendly design:
- Comprehensive Monitoring: View real-time statistics and status of multiple UPS devices connected via NUT.
- Customizable Dashboard: Tailor the dashboard layout to your preferences.
- Flexible Configuration: Configure settings via a user-friendly UI or through manual YAML file editing.
- Extensive Integrations: Supports InfluxDB v2 for Grafana, Prometheus for monitoring and alerting, and customizable widgets for Homepage and Glance.
- API Access: Offers a full API for seamless integration with other systems.
- Platform Support: Optimized for
linux/amd64andlinux/arm64, including Raspberry Pi 4+. - Active Development & Documentation: Benefits from ongoing development, detailed documentation, and a growing list of tested UPS devices.
Links
- GitHub Repository: Brandawg93/PeaNUT
- Documentation (Wiki): PeaNUT Wiki
- Sponsor on GitHub: Sponsor Brandawg93
- Donate via PayPal: Donate to PeaNUT