133 lines
3.1 KiB
Markdown
133 lines
3.1 KiB
Markdown
# Fresh Start Installation Script 🚀
|
|
|
|
> A powerful bash script for automating Proxmox installations with monitoring tools and system health checks.
|
|
|
|
## ✨ Features
|
|
|
|
* 📦 Installs essential system packages
|
|
* 📊 Sets up Prometheus Node Exporter (v1.8.2)
|
|
* 🔍 Configures system health monitoring daemon (hwmon)
|
|
* ✅ Performs initial dry-run test of monitoring systems
|
|
|
|
## 📋 Prerequisites
|
|
|
|
* Debian-based system (Proxmox)
|
|
* Root/sudo access
|
|
* Internet connectivity
|
|
|
|
## 🛠️ Installation
|
|
|
|
Execute these commands as root:
|
|
|
|
```bash
|
|
chmod +x freshStart.sh
|
|
./freshStart.sh
|
|
```
|
|
|
|
## 📦 Components Installed
|
|
|
|
### System Packages
|
|
* python3-pip
|
|
* smartmontools
|
|
* iperf3
|
|
* python3-psutil
|
|
* python3-requests
|
|
* lm-sensors
|
|
* neofetch
|
|
* rsync
|
|
|
|
### Prometheus Node Exporter
|
|
✅ Installed as a systemd service
|
|
✅ Runs on default port 9100
|
|
✅ Configured to start on boot
|
|
|
|
### Hardware Monitoring Daemon (hwmon)
|
|
✅ Installed as a systemd service and timer
|
|
✅ 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
|
|
|
|
Verify service status after installation:
|
|
```bash
|
|
systemctl status node_exporter
|
|
systemctl status hwmon.timer
|
|
```
|
|
|
|
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. |