A Docker container running Network UPS Tools (NUT) server with email notification support. This container allows you to monitor your UPS (Uninterruptible Power Supply) and receive email notifications for various UPS events.
- NUT server running on Alpine Linux
- Email notifications for UPS events
- USB UPS support
- Automatic permission handling
- SMTP support (including Gmail)
- Startup notification
- Configurable monitoring parameters
- Docker
- Docker Compose
- A USB UPS device
- SMTP server access (for notifications)
-
Clone the repository:
git clone https://github.com/DartSteven/alpine-nut.git cd alpine-nut -
Create a
.envfile with your email configuration:NOTIFY_FROM=your-email@example.com NOTIFY_TO=your-email@example.com SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USER=your-email@gmail.com SMTP_PASS=your-app-specific-password SMTP_FROM=your-email@gmail.com
-
Start the container:
docker-compose up -d
| Variable | Description | Default |
|---|---|---|
| NOTIFY_FROM | Email address for sending notifications | your-email@example.com |
| NOTIFY_TO | Email address to receive notifications | your-email@example.com |
| SMTP_HOST | SMTP server hostname | smtp.gmail.com |
| SMTP_PORT | SMTP server port | 587 |
| SMTP_USER | SMTP username | your-email@gmail.com |
| SMTP_PASS | SMTP password or app-specific password | your-app-specific-password |
| SMTP_FROM | Email address shown in From field | your-email@gmail.com |
The NUT server is configured with the following default settings:
- Server port: 3493
- Admin user:
admin(password:adminpass) - Monitor user:
monuser(password:monpass)
You can modify these settings in the following configuration files:
config/nut/ups.conf: UPS device configurationconfig/nut/upsd.conf: NUT server configurationconfig/nut/upsd.users: User access configurationconfig/nut/upsmon.conf: UPS monitoring configuration
The container will send email notifications for the following UPS events:
- UPS Online
- UPS on Battery
- UPS Battery Low
- UPS Forced Shutdown
- UPS Communication Restored/Lost
- UPS Shutdown
- UPS Battery Replacement Needed
To build the image locally:
docker-compose build --no-cacheThe container exposes port 3493 for NUT server communication.
The container uses the following device mapping:
/dev/bus/usb:/dev/bus/usb:rwfor USB UPS access
- All configuration files have appropriate permissions set
- The NUT server runs with limited privileges
- SSL/TLS is enabled for SMTP communication
- USB access is restricted to the NUT user
-
Check container logs:
docker-compose logs -f
-
Verify UPS connection:
docker exec -it Nut-Server upsc ups@localhost -
Test email notifications:
docker exec -it Nut-Server /etc/nut/notifycmd.sh
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Network UPS Tools (NUT) project
- Alpine Linux team
- Docker community
DartSteven (DartSteven@icloud.com)
For support, please open an issue on the GitHub repository.