Protect your Linux system from data loss during power outages with automated UPS monitoring and shutdown. This repository provides complete setup instructions for Network UPS Tools (NUT) with smart battery management.
✨ Key Features:
- Automatic shutdown on low battery (customizable 5-20%)
- Real-time battery level monitoring
- System logs and event notifications
- Extended power outage protection
- Easy configuration templates
If your UPS has the same ID when you run lsusb, you can copy the repository files; otherwise, you can follow the guide on how to configure it from scratch.
Bus 001 Device 005: ID 0665:5161 Cypress Semiconductor USB to Serial
If you don't have the same model, you should follow the guide for other models.
Before using this quick guide, verify your UPS ID by running:
lsusbLook for this exact line:
Bus 001 Device XXX: ID 0665:5161 Cypress Semiconductor USB to Serial
The device number (XXX) doesn't matter, only the ID 0665:5161 needs to match.
Follow the complete guide instead: Manual Setup Guide for All Models
This is a ready-to-use configuration specifically for UPS devices using:
- USB Chip: Cypress Semiconductor USB to Serial
- Vendor ID: 0665
- Product ID: 5161
- Protocol: Voltronic-QS
- Driver: nutdrv_qx
This configuration works with many UPS brands that use Voltronic chipsets:
- Voltronic Power (OEM)
- APC, Armac, Blazer, Energy Sistem
- Fenton Technologies, GE
- Lyonn
- Mustek, Powercool
- Any UPS that came with "Viewpower" software
How to verify: Run lsusb and look for:
Bus XXX Device XXX: ID 0665:5161 Cypress Semiconductor USB to Serial
Ubuntu/Debian/Linux Mint:
sudo apt update
sudo apt install nut inotify-toolsFedora:
sudo dnf install nut inotify-toolsArch Linux:
sudo pacman -S nut inotify-toolsClone this repository:
git clone https://github.com/YOUR_USERNAME/ups-monitor-linux.git
cd ups-monitor-linux/config-examples/cypress-voltronic-qsCopy all configuration files:
# Backup original configs (just in case)
sudo cp -r /etc/nut /etc/nut.backup
# Copy pre-configured files
sudo cp nut/ups.conf /etc/nut/
sudo cp nut/nut.conf /etc/nut/
sudo cp nut/upsd.users /etc/nut/
sudo cp nut/upsmon.conf /etc/nut/
sudo cp nut/upssched.conf /etc/nut/
sudo cp nut/upssched-cmd /etc/nut/
sudo chmod +x /etc/nut/upssched-cmd
# Copy wrapper script
sudo cp upssched-wrapper /usr/local/bin/
sudo chmod +x /usr/local/bin/upssched-wrapper# Start the driver
sudo upsdrvctl start
# Enable and start services
sudo systemctl enable nut-server nut-monitor
sudo systemctl start nut-server
sudo systemctl start nut-monitorCheck UPS status:
upsc upsYou should see something like:
battery.charge: 100
battery.charge.low: 10
battery.voltage: 27.0
ups.status: OL
input.voltage: 220.0
Monitor in real-time:
watch -n 2 'upsc ups | grep -E "battery.charge|ups.status|input.voltage"'- Low battery threshold: 10%
- Warning threshold: 20%
- Shutdown delay: 30 seconds after reaching low battery
- Extended outage: Shutdown after 15 minutes on battery (backup safety)
- Power fails → Logs event, starts 15-minute timer
- Battery reaches 10% → Waits 30 seconds, then shuts down
- Power returns → Cancels all shutdown timers
Edit /etc/nut/ups.conf:
override.battery.charge.low = 5 # Change to 5%, 15%, etc.Restart driver:
sudo upsdrvctl stop && sudo upsdrvctl startEdit /etc/nut/upssched.conf:
AT LOWBATT * START-TIMER shutdown-lowbatt 60 # 60 seconds instead of 30Restart monitor:
sudo systemctl restart nut-monitorEdit /etc/nut/upssched.conf:
AT ONBATT * START-TIMER shutdown-onbatt 600 # 10 minutes instead of 15Restart monitor:
sudo systemctl restart nut-monitorupsc upsupsc ups | grep batteryjournalctl -u nut-monitor --since "10 minutes ago" | grep upsschedjournalctl -f -u nut-monitorWARNING: Only test if you're prepared for a simulated power event.
journalctl -f -u nut-monitor | grep upsschedYou should see:
upssched: Power failure - Running on battery
UPS status will change from OL (OnLine) to OB (On Battery)
You should see:
upssched: Power restored
IMPORTANT: The default configuration uses these passwords:
- Admin password:
admin123 - Monitor password:
monpass123
For production systems, change these in /etc/nut/upsd.users:
sudo nano /etc/nut/upsd.usersThen restart:
sudo systemctl restart nut-server nut-monitor