Added api key for hwmonDaemon

This commit is contained in:
2026-01-01 16:00:44 -05:00
parent 29f0157436
commit bc50fd7348
3 changed files with 189 additions and 15 deletions

View File

@@ -25,33 +25,109 @@ chmod +x freshStart.sh
```
## 📦 Components Installed
**System Packages:**
### System Packages
* python3-pip
* smartmontools
* iperf3
* python3-psutil
* python3-requests
* lm-sensors
* neofetch
* rsync
**Prometheus Node Exporter:**
### Prometheus Node Exporter
✅ Installed as a systemd service
✅ Runs on default port 9100
✅ Configured to start on boot
**Hardware Monitoring Daemon (hwmon):**
### Hardware Monitoring Daemon (hwmon)
✅ Installed as a systemd service and timer
✅ Performs regular system health checks
✅ Performs regular system health checks every 15 minutes
✅ Creates tickets for detected issues
**NEW:** API key configuration via `/etc/hwmonDaemon/.env`
## ⚙️ Configuration
### hwmonDaemon API Key Setup
The script will prompt you for an API key during installation. You can:
**Option 1: Enter during installation**
```bash
Enter API key (or press Enter to skip): d8f356a06bd5612eca9c5ff948b592a56020cc61937764461458372c9ef30931
```
**Option 2: Configure later**
Edit the configuration file:
```bash
nano /etc/hwmonDaemon/.env
```
Add your API key:
```env
TICKET_API_KEY=your_actual_api_key_here
TICKET_API_URL=http://10.10.10.45/create_ticket_api.php
```
The `.env` file is created with restricted permissions (`chmod 600`) for security.
## 🔍 Verification
🔍 **Verification**
Verify service status after installation:
```bash
systemctl status node_exporter
systemctl status hwmon.timer
```
🌐 **Network Requirements**
Service Purpose
GitHub Node Exporter download
10.10.10.110:3000 hwmon daemon files
10.10.10.45 Ticket API access
Test hwmonDaemon with dry-run:
```bash
/usr/bin/env python3 -c "import urllib.request; exec(urllib.request.urlopen('http://10.10.10.63:3000/LotusGuild/hwmonDaemon/raw/branch/main/hwmonDaemon.py').read().decode('utf-8'))" --dry-run
```
Check if API key is loaded:
```bash
cat /etc/hwmonDaemon/.env
journalctl -u hwmon.service | grep "TICKET_API_KEY"
```
## 🌐 Network Requirements
| Service | Purpose |
|---------|---------|
| GitHub | Node Exporter download |
| 10.10.10.63:3000 | hwmon daemon files (Gitea) |
| 10.10.10.45 | Ticket API access |
## 📁 File Locations
| File/Directory | Purpose |
|---------------|---------|
| `/etc/hwmonDaemon/.env` | API key configuration |
| `/var/log/hwmonDaemon/` | hwmon log files |
| `/etc/systemd/system/hwmon.service` | hwmon systemd service |
| `/etc/systemd/system/hwmon.timer` | hwmon systemd timer |
| `/usr/local/bin/node_exporter` | Node Exporter binary |
## 🔧 Troubleshooting
### hwmonDaemon not creating tickets
Check if API key is configured:
```bash
cat /etc/hwmonDaemon/.env
```
Check logs for authentication errors:
```bash
journalctl -u hwmon.service -n 50
```
### Update API key after installation
Edit the configuration file:
```bash
nano /etc/hwmonDaemon/.env
```
No service restart needed - changes take effect on next run.