eneru 4.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eneru-4.8/LICENSE +21 -0
- eneru-4.8/PKG-INFO +196 -0
- eneru-4.8/README.md +152 -0
- eneru-4.8/pyproject.toml +96 -0
- eneru-4.8/setup.cfg +4 -0
- eneru-4.8/src/eneru/__init__.py +75 -0
- eneru-4.8/src/eneru/__main__.py +6 -0
- eneru-4.8/src/eneru/monitor.py +2643 -0
- eneru-4.8/src/eneru.egg-info/PKG-INFO +196 -0
- eneru-4.8/src/eneru.egg-info/SOURCES.txt +22 -0
- eneru-4.8/src/eneru.egg-info/dependency_links.txt +1 -0
- eneru-4.8/src/eneru.egg-info/entry_points.txt +2 -0
- eneru-4.8/src/eneru.egg-info/requires.txt +15 -0
- eneru-4.8/src/eneru.egg-info/top_level.txt +1 -0
- eneru-4.8/tests/test_calculations.py +194 -0
- eneru-4.8/tests/test_cli.py +476 -0
- eneru-4.8/tests/test_config.py +1071 -0
- eneru-4.8/tests/test_constants.py +26 -0
- eneru-4.8/tests/test_integration.py +224 -0
- eneru-4.8/tests/test_notifications.py +430 -0
- eneru-4.8/tests/test_remote_commands.py +555 -0
- eneru-4.8/tests/test_run_command.py +156 -0
- eneru-4.8/tests/test_state.py +300 -0
- eneru-4.8/tests/test_triggers.py +245 -0
eneru-4.8/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Federico Iezzi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
eneru-4.8/PKG-INFO
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eneru
|
|
3
|
+
Version: 4.8
|
|
4
|
+
Summary: Intelligent UPS Monitoring & Shutdown Orchestration for NUT
|
|
5
|
+
Author-email: Eneru Maintainers <noreply@github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/m4r1k/Eneru
|
|
8
|
+
Project-URL: Documentation, https://m4r1k.github.io/Eneru/
|
|
9
|
+
Project-URL: Repository, https://github.com/m4r1k/Eneru.git
|
|
10
|
+
Project-URL: Issues, https://github.com/m4r1k/Eneru/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/m4r1k/Eneru/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: ups,nut,monitoring,shutdown,power,infrastructure
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Topic :: System :: Monitoring
|
|
26
|
+
Classifier: Topic :: System :: Power (UPS)
|
|
27
|
+
Classifier: Topic :: System :: Systems Administration
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: PyYAML>=5.4.1
|
|
32
|
+
Provides-Extra: notifications
|
|
33
|
+
Requires-Dist: apprise>=1.9.6; extra == "notifications"
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-timeout>=2.1.0; extra == "dev"
|
|
39
|
+
Requires-Dist: apprise>=1.9.6; extra == "dev"
|
|
40
|
+
Provides-Extra: docs
|
|
41
|
+
Requires-Dist: mkdocs>=1.6.1; extra == "docs"
|
|
42
|
+
Requires-Dist: mkdocs-material>=9.7.1; extra == "docs"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
<div align="center">
|
|
46
|
+
|
|
47
|
+
# ⚡ Eneru
|
|
48
|
+
|
|
49
|
+
**Intelligent UPS Monitoring & Shutdown Orchestration for NUT**
|
|
50
|
+
|
|
51
|
+
[](https://opensource.org/licenses/MIT)
|
|
52
|
+
[](https://www.python.org/downloads/)
|
|
53
|
+
[](https://networkupstools.org/)
|
|
54
|
+
[](https://codecov.io/gh/m4r1k/Eneru)
|
|
55
|
+
[](https://eneru.readthedocs.io/)
|
|
56
|
+
[](https://pypi.org/project/eneru/)
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
<img src="docs/images/eneru-diagram.png" alt="Eneru Architecture" width="600">
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
A Python-based UPS monitoring daemon that watches UPS status via [Network UPS Tools (NUT)](https://networkupstools.org/) and executes configurable shutdown sequences to protect your entire infrastructure during power events.
|
|
63
|
+
|
|
64
|
+
[Documentation](https://eneru.readthedocs.io/) •
|
|
65
|
+
[Getting Started](https://eneru.readthedocs.io/getting-started/) •
|
|
66
|
+
[Configuration](https://eneru.readthedocs.io/configuration/) •
|
|
67
|
+
[Changelog](CHANGELOG.md)
|
|
68
|
+
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## ✨ Why Eneru?
|
|
74
|
+
|
|
75
|
+
Most UPS shutdown solutions are **single-system focused**. Eneru is designed for **modern infrastructure**:
|
|
76
|
+
|
|
77
|
+
| Challenge | Eneru Solution |
|
|
78
|
+
|-----------|----------------|
|
|
79
|
+
| Multiple servers need coordinated shutdown | ✅ Orchestrated multi-server shutdown via SSH |
|
|
80
|
+
| VMs and containers need graceful stop | ✅ Libvirt VM and Docker/Podman container handling |
|
|
81
|
+
| Network mounts hang during power loss | ✅ Timeout-protected unmounting |
|
|
82
|
+
| No visibility during power events | ✅ Real-time notifications via 100+ services |
|
|
83
|
+
| Different systems need different commands | ✅ Per-server custom shutdown commands |
|
|
84
|
+
| Hypervisors need graceful VM shutdown | ✅ Pre-shutdown actions (Proxmox, ESXi, XCP-ng, libvirt) |
|
|
85
|
+
| Battery estimates are unreliable | ✅ Multi-vector shutdown triggers |
|
|
86
|
+
| Network down during outage | ✅ Non-blocking notifications with persistent retry |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 🎯 Built For
|
|
91
|
+
|
|
92
|
+
- 🏠 **Homelabs** - Protect your self-hosted infrastructure
|
|
93
|
+
- 🖥️ **Virtualization Hosts** - Graceful VM shutdown before power loss
|
|
94
|
+
- 🐳 **Container Hosts** - Stop Docker/Podman containers safely
|
|
95
|
+
- 📦 **NAS Systems** - Coordinate shutdown of Synology, QNAP, TrueNAS
|
|
96
|
+
- 🏢 **Small Business** - Multi-server environments with single UPS
|
|
97
|
+
- ☁️ **Hybrid Setups** - Mix of physical and virtual infrastructure
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 🚀 Quick Start
|
|
102
|
+
|
|
103
|
+
### Installation
|
|
104
|
+
|
|
105
|
+
**PyPI:**
|
|
106
|
+
```bash
|
|
107
|
+
pip install eneru[notifications]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Debian/Ubuntu:**
|
|
111
|
+
```bash
|
|
112
|
+
curl -fsSL https://m4r1k.github.io/Eneru/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/eneru.gpg
|
|
113
|
+
echo "deb [arch=all signed-by=/usr/share/keyrings/eneru.gpg] https://m4r1k.github.io/Eneru/deb stable main" | sudo tee /etc/apt/sources.list.d/eneru.list
|
|
114
|
+
sudo apt update && sudo apt install eneru
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**RHEL/Fedora:**
|
|
118
|
+
```bash
|
|
119
|
+
sudo dnf install -y epel-release
|
|
120
|
+
sudo curl -o /etc/yum.repos.d/eneru.repo https://m4r1k.github.io/Eneru/rpm/eneru.repo
|
|
121
|
+
sudo dnf install eneru
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Configuration
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Edit configuration
|
|
128
|
+
sudo nano /etc/ups-monitor/config.yaml
|
|
129
|
+
|
|
130
|
+
# Validate and start
|
|
131
|
+
sudo python3 /opt/ups-monitor/eneru.py --validate-config
|
|
132
|
+
sudo systemctl enable --now eneru.service
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Minimal Config
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
ups:
|
|
139
|
+
name: "UPS@192.168.1.100"
|
|
140
|
+
|
|
141
|
+
triggers:
|
|
142
|
+
low_battery_threshold: 20
|
|
143
|
+
critical_runtime_threshold: 600
|
|
144
|
+
|
|
145
|
+
local_shutdown:
|
|
146
|
+
enabled: true
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
See the [full documentation](https://eneru.readthedocs.io/) for complete configuration options.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## ✨ Features
|
|
154
|
+
|
|
155
|
+
- **Multi-vector shutdown triggers** - Battery %, runtime, depletion rate, time on battery, FSD flag
|
|
156
|
+
- **Orchestrated shutdown** - VMs, containers, remote servers, filesystems, local system
|
|
157
|
+
- **100+ notification services** - Discord, Slack, Telegram, ntfy, Email via [Apprise](https://github.com/caronc/apprise/wiki)
|
|
158
|
+
- **Non-blocking notifications** - Persistent retry without delaying shutdown
|
|
159
|
+
- **Power quality monitoring** - Voltage, AVR, bypass, and overload detection
|
|
160
|
+
- **Dry-run mode** - Test your configuration safely
|
|
161
|
+
- **Tested on every commit** - Full test suite across 7 Linux distros ensures no regressions
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🤔 Why an Old-Fashioned Systemd Daemon? (No Docker)
|
|
166
|
+
|
|
167
|
+
Eneru runs as a systemd daemon, not a container. This is intentional—Eneru's job is to shut down Docker/Podman containers during power events. If Eneru ran inside a container, it would be killed during its own shutdown sequence.
|
|
168
|
+
|
|
169
|
+
See the [documentation](https://eneru.readthedocs.io/#why-a-systemd-daemon-no-docker) for the full explanation.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## ⚡ The Name
|
|
174
|
+
|
|
175
|
+
<img src="docs/images/eneru.jpg" alt="Eneru from One Piece" width="120" align="right">
|
|
176
|
+
|
|
177
|
+
Named after [Eneru (エネル)](https://onepiece.fandom.com/wiki/Enel) from *One Piece*—the self-proclaimed God of Skypiea who ate the Goro Goro no Mi (Rumble-Rumble Fruit), granting him absolute control over electricity. Just as Eneru commands lightning from the sky, this tool commands your infrastructure when the power from the grid fails. *Unlimited power... management!* ⚡
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 📚 Documentation
|
|
182
|
+
|
|
183
|
+
Full documentation is available at **[eneru.readthedocs.io](https://eneru.readthedocs.io/)**:
|
|
184
|
+
|
|
185
|
+
- [Getting Started](https://eneru.readthedocs.io/getting-started/) - Installation and basic setup
|
|
186
|
+
- [Configuration](https://eneru.readthedocs.io/configuration/) - Full configuration reference
|
|
187
|
+
- [Shutdown Triggers](https://eneru.readthedocs.io/triggers/) - How shutdown decisions are made
|
|
188
|
+
- [Notifications](https://eneru.readthedocs.io/notifications/) - Setting up Discord, Slack, Telegram, etc.
|
|
189
|
+
- [Remote Servers](https://eneru.readthedocs.io/remote-servers/) - SSH setup for NAS and other servers
|
|
190
|
+
- [Troubleshooting](https://eneru.readthedocs.io/troubleshooting/) - Common issues and solutions
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 📄 License
|
|
195
|
+
|
|
196
|
+
MIT License - See [LICENSE](LICENSE) file for details.
|
eneru-4.8/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ⚡ Eneru
|
|
4
|
+
|
|
5
|
+
**Intelligent UPS Monitoring & Shutdown Orchestration for NUT**
|
|
6
|
+
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://www.python.org/downloads/)
|
|
9
|
+
[](https://networkupstools.org/)
|
|
10
|
+
[](https://codecov.io/gh/m4r1k/Eneru)
|
|
11
|
+
[](https://eneru.readthedocs.io/)
|
|
12
|
+
[](https://pypi.org/project/eneru/)
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<img src="docs/images/eneru-diagram.png" alt="Eneru Architecture" width="600">
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
A Python-based UPS monitoring daemon that watches UPS status via [Network UPS Tools (NUT)](https://networkupstools.org/) and executes configurable shutdown sequences to protect your entire infrastructure during power events.
|
|
19
|
+
|
|
20
|
+
[Documentation](https://eneru.readthedocs.io/) •
|
|
21
|
+
[Getting Started](https://eneru.readthedocs.io/getting-started/) •
|
|
22
|
+
[Configuration](https://eneru.readthedocs.io/configuration/) •
|
|
23
|
+
[Changelog](CHANGELOG.md)
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## ✨ Why Eneru?
|
|
30
|
+
|
|
31
|
+
Most UPS shutdown solutions are **single-system focused**. Eneru is designed for **modern infrastructure**:
|
|
32
|
+
|
|
33
|
+
| Challenge | Eneru Solution |
|
|
34
|
+
|-----------|----------------|
|
|
35
|
+
| Multiple servers need coordinated shutdown | ✅ Orchestrated multi-server shutdown via SSH |
|
|
36
|
+
| VMs and containers need graceful stop | ✅ Libvirt VM and Docker/Podman container handling |
|
|
37
|
+
| Network mounts hang during power loss | ✅ Timeout-protected unmounting |
|
|
38
|
+
| No visibility during power events | ✅ Real-time notifications via 100+ services |
|
|
39
|
+
| Different systems need different commands | ✅ Per-server custom shutdown commands |
|
|
40
|
+
| Hypervisors need graceful VM shutdown | ✅ Pre-shutdown actions (Proxmox, ESXi, XCP-ng, libvirt) |
|
|
41
|
+
| Battery estimates are unreliable | ✅ Multi-vector shutdown triggers |
|
|
42
|
+
| Network down during outage | ✅ Non-blocking notifications with persistent retry |
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🎯 Built For
|
|
47
|
+
|
|
48
|
+
- 🏠 **Homelabs** - Protect your self-hosted infrastructure
|
|
49
|
+
- 🖥️ **Virtualization Hosts** - Graceful VM shutdown before power loss
|
|
50
|
+
- 🐳 **Container Hosts** - Stop Docker/Podman containers safely
|
|
51
|
+
- 📦 **NAS Systems** - Coordinate shutdown of Synology, QNAP, TrueNAS
|
|
52
|
+
- 🏢 **Small Business** - Multi-server environments with single UPS
|
|
53
|
+
- ☁️ **Hybrid Setups** - Mix of physical and virtual infrastructure
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 🚀 Quick Start
|
|
58
|
+
|
|
59
|
+
### Installation
|
|
60
|
+
|
|
61
|
+
**PyPI:**
|
|
62
|
+
```bash
|
|
63
|
+
pip install eneru[notifications]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Debian/Ubuntu:**
|
|
67
|
+
```bash
|
|
68
|
+
curl -fsSL https://m4r1k.github.io/Eneru/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/eneru.gpg
|
|
69
|
+
echo "deb [arch=all signed-by=/usr/share/keyrings/eneru.gpg] https://m4r1k.github.io/Eneru/deb stable main" | sudo tee /etc/apt/sources.list.d/eneru.list
|
|
70
|
+
sudo apt update && sudo apt install eneru
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**RHEL/Fedora:**
|
|
74
|
+
```bash
|
|
75
|
+
sudo dnf install -y epel-release
|
|
76
|
+
sudo curl -o /etc/yum.repos.d/eneru.repo https://m4r1k.github.io/Eneru/rpm/eneru.repo
|
|
77
|
+
sudo dnf install eneru
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Configuration
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Edit configuration
|
|
84
|
+
sudo nano /etc/ups-monitor/config.yaml
|
|
85
|
+
|
|
86
|
+
# Validate and start
|
|
87
|
+
sudo python3 /opt/ups-monitor/eneru.py --validate-config
|
|
88
|
+
sudo systemctl enable --now eneru.service
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Minimal Config
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
ups:
|
|
95
|
+
name: "UPS@192.168.1.100"
|
|
96
|
+
|
|
97
|
+
triggers:
|
|
98
|
+
low_battery_threshold: 20
|
|
99
|
+
critical_runtime_threshold: 600
|
|
100
|
+
|
|
101
|
+
local_shutdown:
|
|
102
|
+
enabled: true
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
See the [full documentation](https://eneru.readthedocs.io/) for complete configuration options.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## ✨ Features
|
|
110
|
+
|
|
111
|
+
- **Multi-vector shutdown triggers** - Battery %, runtime, depletion rate, time on battery, FSD flag
|
|
112
|
+
- **Orchestrated shutdown** - VMs, containers, remote servers, filesystems, local system
|
|
113
|
+
- **100+ notification services** - Discord, Slack, Telegram, ntfy, Email via [Apprise](https://github.com/caronc/apprise/wiki)
|
|
114
|
+
- **Non-blocking notifications** - Persistent retry without delaying shutdown
|
|
115
|
+
- **Power quality monitoring** - Voltage, AVR, bypass, and overload detection
|
|
116
|
+
- **Dry-run mode** - Test your configuration safely
|
|
117
|
+
- **Tested on every commit** - Full test suite across 7 Linux distros ensures no regressions
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## 🤔 Why an Old-Fashioned Systemd Daemon? (No Docker)
|
|
122
|
+
|
|
123
|
+
Eneru runs as a systemd daemon, not a container. This is intentional—Eneru's job is to shut down Docker/Podman containers during power events. If Eneru ran inside a container, it would be killed during its own shutdown sequence.
|
|
124
|
+
|
|
125
|
+
See the [documentation](https://eneru.readthedocs.io/#why-a-systemd-daemon-no-docker) for the full explanation.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## ⚡ The Name
|
|
130
|
+
|
|
131
|
+
<img src="docs/images/eneru.jpg" alt="Eneru from One Piece" width="120" align="right">
|
|
132
|
+
|
|
133
|
+
Named after [Eneru (エネル)](https://onepiece.fandom.com/wiki/Enel) from *One Piece*—the self-proclaimed God of Skypiea who ate the Goro Goro no Mi (Rumble-Rumble Fruit), granting him absolute control over electricity. Just as Eneru commands lightning from the sky, this tool commands your infrastructure when the power from the grid fails. *Unlimited power... management!* ⚡
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 📚 Documentation
|
|
138
|
+
|
|
139
|
+
Full documentation is available at **[eneru.readthedocs.io](https://eneru.readthedocs.io/)**:
|
|
140
|
+
|
|
141
|
+
- [Getting Started](https://eneru.readthedocs.io/getting-started/) - Installation and basic setup
|
|
142
|
+
- [Configuration](https://eneru.readthedocs.io/configuration/) - Full configuration reference
|
|
143
|
+
- [Shutdown Triggers](https://eneru.readthedocs.io/triggers/) - How shutdown decisions are made
|
|
144
|
+
- [Notifications](https://eneru.readthedocs.io/notifications/) - Setting up Discord, Slack, Telegram, etc.
|
|
145
|
+
- [Remote Servers](https://eneru.readthedocs.io/remote-servers/) - SSH setup for NAS and other servers
|
|
146
|
+
- [Troubleshooting](https://eneru.readthedocs.io/troubleshooting/) - Common issues and solutions
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 📄 License
|
|
151
|
+
|
|
152
|
+
MIT License - See [LICENSE](LICENSE) file for details.
|
eneru-4.8/pyproject.toml
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "eneru"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Intelligent UPS Monitoring & Shutdown Orchestration for NUT"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Eneru Maintainers", email = "noreply@github.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ups", "nut", "monitoring", "shutdown", "power", "infrastructure"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: System Administrators",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: POSIX :: Linux",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Programming Language :: Python :: 3.14",
|
|
29
|
+
"Topic :: System :: Monitoring",
|
|
30
|
+
"Topic :: System :: Power (UPS)",
|
|
31
|
+
"Topic :: System :: Systems Administration",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"PyYAML>=5.4.1",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
notifications = [
|
|
39
|
+
"apprise>=1.9.6",
|
|
40
|
+
]
|
|
41
|
+
dev = [
|
|
42
|
+
"pytest>=7.0.0",
|
|
43
|
+
"pytest-cov>=4.0.0",
|
|
44
|
+
"pytest-mock>=3.10.0",
|
|
45
|
+
"pytest-timeout>=2.1.0",
|
|
46
|
+
"apprise>=1.9.6",
|
|
47
|
+
]
|
|
48
|
+
docs = [
|
|
49
|
+
"mkdocs>=1.6.1",
|
|
50
|
+
"mkdocs-material>=9.7.1",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.scripts]
|
|
54
|
+
eneru = "eneru:main"
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
Homepage = "https://github.com/m4r1k/Eneru"
|
|
58
|
+
Documentation = "https://m4r1k.github.io/Eneru/"
|
|
59
|
+
Repository = "https://github.com/m4r1k/Eneru.git"
|
|
60
|
+
Issues = "https://github.com/m4r1k/Eneru/issues"
|
|
61
|
+
Changelog = "https://github.com/m4r1k/Eneru/blob/main/CHANGELOG.md"
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.packages.find]
|
|
64
|
+
where = ["src"]
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.dynamic]
|
|
67
|
+
version = {attr = "eneru.__version__"}
|
|
68
|
+
|
|
69
|
+
[tool.pytest.ini_options]
|
|
70
|
+
testpaths = ["tests"]
|
|
71
|
+
pythonpath = ["src"]
|
|
72
|
+
python_files = ["test_*.py"]
|
|
73
|
+
python_classes = ["Test*"]
|
|
74
|
+
python_functions = ["test_*"]
|
|
75
|
+
addopts = "-v --tb=short --strict-markers"
|
|
76
|
+
markers = [
|
|
77
|
+
"unit: Unit tests (fast, isolated)",
|
|
78
|
+
"integration: Integration tests (may require external services)",
|
|
79
|
+
"slow: Slow tests",
|
|
80
|
+
]
|
|
81
|
+
filterwarnings = [
|
|
82
|
+
"ignore::DeprecationWarning",
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
[tool.coverage.run]
|
|
86
|
+
source = ["src/eneru"]
|
|
87
|
+
branch = true
|
|
88
|
+
|
|
89
|
+
[tool.coverage.report]
|
|
90
|
+
exclude_lines = [
|
|
91
|
+
"pragma: no cover",
|
|
92
|
+
"def __repr__",
|
|
93
|
+
"raise NotImplementedError",
|
|
94
|
+
"if __name__ == .__main__.:",
|
|
95
|
+
"if TYPE_CHECKING:",
|
|
96
|
+
]
|
eneru-4.8/setup.cfg
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""Eneru - Intelligent UPS Monitoring & Shutdown Orchestration for NUT."""
|
|
2
|
+
|
|
3
|
+
from eneru.monitor import (
|
|
4
|
+
__version__,
|
|
5
|
+
# Configuration classes
|
|
6
|
+
Config,
|
|
7
|
+
UPSConfig,
|
|
8
|
+
TriggersConfig,
|
|
9
|
+
DepletionConfig,
|
|
10
|
+
ExtendedTimeConfig,
|
|
11
|
+
BehaviorConfig,
|
|
12
|
+
LoggingConfig,
|
|
13
|
+
NotificationsConfig,
|
|
14
|
+
VMConfig,
|
|
15
|
+
ContainersConfig,
|
|
16
|
+
ComposeFileConfig,
|
|
17
|
+
FilesystemsConfig,
|
|
18
|
+
UnmountConfig,
|
|
19
|
+
RemoteServerConfig,
|
|
20
|
+
RemoteCommandConfig,
|
|
21
|
+
LocalShutdownConfig,
|
|
22
|
+
# State and loader
|
|
23
|
+
MonitorState,
|
|
24
|
+
ConfigLoader,
|
|
25
|
+
# Core classes
|
|
26
|
+
UPSMonitor,
|
|
27
|
+
NotificationWorker,
|
|
28
|
+
# Functions
|
|
29
|
+
main,
|
|
30
|
+
run_command,
|
|
31
|
+
command_exists,
|
|
32
|
+
is_numeric,
|
|
33
|
+
format_seconds,
|
|
34
|
+
REMOTE_ACTIONS,
|
|
35
|
+
# Availability flags
|
|
36
|
+
YAML_AVAILABLE,
|
|
37
|
+
APPRISE_AVAILABLE,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"__version__",
|
|
42
|
+
# Configuration classes
|
|
43
|
+
"Config",
|
|
44
|
+
"UPSConfig",
|
|
45
|
+
"TriggersConfig",
|
|
46
|
+
"DepletionConfig",
|
|
47
|
+
"ExtendedTimeConfig",
|
|
48
|
+
"BehaviorConfig",
|
|
49
|
+
"LoggingConfig",
|
|
50
|
+
"NotificationsConfig",
|
|
51
|
+
"VMConfig",
|
|
52
|
+
"ContainersConfig",
|
|
53
|
+
"ComposeFileConfig",
|
|
54
|
+
"FilesystemsConfig",
|
|
55
|
+
"UnmountConfig",
|
|
56
|
+
"RemoteServerConfig",
|
|
57
|
+
"RemoteCommandConfig",
|
|
58
|
+
"LocalShutdownConfig",
|
|
59
|
+
# State and loader
|
|
60
|
+
"MonitorState",
|
|
61
|
+
"ConfigLoader",
|
|
62
|
+
# Core classes
|
|
63
|
+
"UPSMonitor",
|
|
64
|
+
"NotificationWorker",
|
|
65
|
+
# Functions
|
|
66
|
+
"main",
|
|
67
|
+
"run_command",
|
|
68
|
+
"command_exists",
|
|
69
|
+
"is_numeric",
|
|
70
|
+
"format_seconds",
|
|
71
|
+
"REMOTE_ACTIONS",
|
|
72
|
+
# Availability flags
|
|
73
|
+
"YAML_AVAILABLE",
|
|
74
|
+
"APPRISE_AVAILABLE",
|
|
75
|
+
]
|