diff --git a/INSTALL.md b/INSTALL.md index 7f12874..439d85c 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,6 +2,26 @@ Choisissez votre méthode d'installation préférée : +## 🤖 Version Proxmox Autonome (Recommandée) + +**Avantages :** +- **Installation en 1 seule commande** depuis Proxmox +- Création automatique du container LXC +- Configuration hardware automatique +- Interface graphique avec ASCII art +- Outils d'administration intégrés + +**→ [Guide Proxmox complet](proxmox/README-PROXMOX.md)** + +### Installation ultra-rapide Proxmox + +```bash +# Depuis votre node Proxmox VE +bash -c "$(wget -qLO - https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/proxmox/idrac-fan-controller.sh)" +``` + +--- + ## 🐳 Version Docker **Avantages :** @@ -16,7 +36,7 @@ Choisissez votre méthode d'installation préférée : ```bash # Cloner le repo -git clone +git clone https://git.benoitsz.com/benoit/iDRAC_fan_controller.git cd Dell_iDRAC_fan_controller/docker # Configurer @@ -43,7 +63,7 @@ docker-compose -f docker-compose.local.yml up -d ```bash # Dans un container LXC Ubuntu -wget -O - https://github.com//archive/main.tar.gz | tar -xz +wget -O - https://git.benoitsz.com/benoit/iDRAC_fan_controller/archive/main.tar.gz | tar -xz cd Dell_iDRAC_fan_controller-main/lxc chmod +x install-lxc.sh ./install-lxc.sh @@ -53,17 +73,17 @@ chmod +x install-lxc.sh ## Comparaison rapide -| Critère | Docker | LXC | -|---------|--------|-----| -| **Facilité** | ⭐⭐⭐ | ⭐⭐ | -| **Performance** | ⭐⭐ | ⭐⭐⭐ | -| **Isolation** | ⭐⭐⭐ | ⭐⭐ | -| **Maintenance** | ⭐⭐⭐ | ⭐⭐ | -| **Proxmox** | ⭐⭐ | ⭐⭐⭐ | -| **Ressources** | ⭐⭐ | ⭐⭐⭐ | +| Critère | Proxmox Auto | Docker | LXC Manuel | +|---------|-------------|--------|------------| +| **Facilité** | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ | +| **Performance** | ⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐ | +| **Isolation** | ⭐⭐ | ⭐⭐⭐ | ⭐⭐ | +| **Maintenance** | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ | +| **Proxmox** | ⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐ | +| **Ressources** | ⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐ | ## Support -- **Issues** : [GitHub Issues](https://github.com//issues) -- **Discussions** : [GitHub Discussions](https://github.com//discussions) +- **Issues** : [Gitea Issues](https://git.benoitsz.com/benoit/iDRAC_fan_controller/issues) +- **Discussions** : [Gitea](https://git.benoitsz.com/benoit/iDRAC_fan_controller) - **Original** : [Projet source](https://github.com/tigerblue77/Dell_iDRAC_fan_controller_Docker) \ No newline at end of file diff --git a/README.md b/README.md index e8d2b2c..de19aed 100644 --- a/README.md +++ b/README.md @@ -10,15 +10,20 @@ Fork de : https://github.com/tigerblue77/Dell_iDRAC_fan_controller_Docker.git - Configuration de 4 seuils de température avec vitesses correspondantes - Gestion progressive de la vitesse des ventilateurs selon la température du CPU -## 🚀 Deux versions disponibles +## 🚀 Trois versions disponibles -| **Version Docker** | **Version LXC Proxmox** | -|-------------------|------------------------| -| 🐳 Container Docker classique | 📦 Container LXC natif | -| Images versionnées | Installation directe | -| `docker-compose` | `systemctl` | -| Isolation forte | Performance native | -| → [Documentation Docker](docker/) | → [Documentation LXC](lxc/) | +| **Docker** | **LXC Manuel** | **Proxmox Autonome** | +|------------|----------------|----------------------| +| 🐳 Container Docker | 📦 Container LXC | 🤖 Installation automatique | +| docker-compose | Installation manuelle | **1 seule commande** | +| Device mapping | systemctl | Auto-configuration | +| → [Docker](docker/) | → [LXC](lxc/) | → [**Proxmox**](proxmox/) | + +### ⚡ Installation ultra-rapide Proxmox +```bash +bash -c "$(wget -qLO - https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/proxmox/idrac-fan-controller.sh)" +``` +*Créé automatiquement le container LXC, installe Ubuntu et configure l'application !*
@@ -39,7 +44,7 @@ Fork de : https://github.com/tigerblue77/Dell_iDRAC_fan_controller_Docker.git ```bash # Télécharger la configuration -wget https://raw.githubusercontent.com/votre-repo/main/docker/docker-compose.yml +wget https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/docker/docker-compose.yml # Modifier la configuration selon vos besoins nano docker-compose.yml @@ -48,11 +53,18 @@ nano docker-compose.yml docker-compose up -d ``` -### 📦 Version LXC (Proxmox) +### 🤖 Version Proxmox Autonome (Recommandée) ```bash -# Dans le container LXC Ubuntu -wget -O - https://github.com/votre-repo/archive/main.tar.gz | tar -xz +# Installation complète en 1 commande depuis Proxmox +bash -c "$(wget -qLO - https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/proxmox/idrac-fan-controller.sh)" +``` + +### 📦 Version LXC Manuel + +```bash +# Dans un container LXC Ubuntu existant +wget -O - https://git.benoitsz.com/benoit/iDRAC_fan_controller/archive/main.tar.gz | tar -xz cd Dell_iDRAC_fan_controller-main/lxc chmod +x install-lxc.sh ./install-lxc.sh @@ -103,7 +115,7 @@ docker run -d \ -e FAN_SPEED_4=80 \ -e DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE= \ --device=/dev/ipmi0:/dev/ipmi0:rw \ - votre_image:latest + git.benoitsz.com/benoit/idrac_fan_controller:latest ``` 2. with LAN iDRAC: @@ -126,7 +138,7 @@ docker run -d \ -e FAN_SPEED_3=60 \ -e FAN_SPEED_4=80 \ -e DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE= \ - votre_image:latest + git.benoitsz.com/benoit/idrac_fan_controller:latest ``` `docker-compose.yml` examples: @@ -138,7 +150,7 @@ version: '3.8' services: Dell_iDRAC_fan_controller: - image: votre_image:latest + image: git.benoitsz.com/benoit/idrac_fan_controller:latest container_name: Dell_iDRAC_fan_controller restart: unless-stopped environment: @@ -165,7 +177,7 @@ version: '3.8' services: Dell_iDRAC_fan_controller: - image: votre_image:latest + image: git.benoitsz.com/benoit/idrac_fan_controller:latest container_name: Dell_iDRAC_fan_controller restart: unless-stopped environment: diff --git a/lxc/README-LXC.md b/lxc/README-LXC.md index 1e0ae5b..94d6e83 100644 --- a/lxc/README-LXC.md +++ b/lxc/README-LXC.md @@ -44,7 +44,7 @@ Aucune configuration matérielle supplémentaire requise. ```bash # Dans le container LXC cd /tmp -wget -O - https://github.com/votre-repo/archive/main.tar.gz | tar -xz +wget -O - https://git.benoitsz.com/benoit/iDRAC_fan_controller/archive/main.tar.gz | tar -xz cd Dell_iDRAC_fan_controller-main/lxc ``` diff --git a/proxmox/README-PROXMOX.md b/proxmox/README-PROXMOX.md new file mode 100644 index 0000000..8ad2906 --- /dev/null +++ b/proxmox/README-PROXMOX.md @@ -0,0 +1,201 @@ +# Installation Proxmox VE Autonome + +Script d'installation **totalement autonome** pour Proxmox VE qui crée automatiquement le container LXC, installe Ubuntu, et configure l'application. + +## 🚀 Installation en une commande + +```bash +bash -c "$(wget -qLO - https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/proxmox/idrac-fan-controller.sh)" +``` + +## ✨ Fonctionnalités du script + +### Création automatique du container +- **OS**: Ubuntu 22.04 LTS +- **Type**: Container privilégié (requis pour IPMI) +- **Ressources**: 1 CPU, 512MB RAM, 4GB stockage +- **Configuration**: Optimisée pour serveur Dell + +### Installation complète +- ✅ ipmitool et dépendances +- ✅ Scripts iDRAC Fan Controller +- ✅ Service systemd configuré +- ✅ Configuration par défaut +- ✅ Outils de gestion inclus + +### Interface utilisateur +- 🎨 Interface colorée avec ASCII art +- 📊 Rapport d'installation détaillé +- ⚙️ Options de configuration avancées +- 🔧 Instructions post-installation + +## 🛠️ Options d'installation + +Le script propose plusieurs modes : + +### 1. Installation par défaut +```bash +# Lancement automatique avec paramètres optimaux +bash -c "$(wget -qLO - https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/proxmox/idrac-fan-controller.sh)" +``` + +### 2. Configuration avancée +- Personnalisation des ressources (CPU, RAM, stockage) +- Choix du container ID +- Configuration réseau personnalisée +- Options de sécurité + +### 3. Mode verbose +- Affichage détaillé des étapes +- Logs d'installation complets +- Diagnostic en cas d'erreur + +## 📋 Prérequis Proxmox + +### Accès hardware (iDRAC local) +Le script configure automatiquement l'accès, mais vous devez ensuite ajouter manuellement : + +```bash +# Dans la configuration du container (/etc/pve/lxc/.conf) +lxc.cgroup2.devices.allow: c 10:* rwm +lxc.mount.entry: /dev/ipmi0 dev/ipmi0 none bind,optional,create=file +``` + +### Ou via interface Proxmox +1. Container → Options → Features +2. Activer "Privileged container" +3. Ajouter les périphériques IPMI + +## 🎯 Utilisation post-installation + +### 1. Connexion au container +```bash +pct enter +``` + +### 2. Configuration rapide +```bash +# Script d'aide intégré +idrac-setup +``` + +### 3. Édition de la configuration +```bash +nano /opt/idrac-fan-controller/config/environment +``` + +### 4. Gestion du service +```bash +# Démarrer +systemctl start idrac-fan-controller + +# Voir le statut +systemctl status idrac-fan-controller + +# Logs en temps réel +journalctl -u idrac-fan-controller -f +``` + +## 📊 Configuration par défaut + +Le script crée cette configuration optimisée : + +```bash +# Connexion iDRAC +IDRAC_HOST=local # Accès IPMI direct +IDRAC_USERNAME=root # Pour iDRAC distant +IDRAC_PASSWORD=calvin # Pour iDRAC distant + +# Seuils de température progressifs +CPU_TEMPERATURE_1=30 # → FAN_SPEED_1 (10%) +CPU_TEMPERATURE_2=40 # → FAN_SPEED_2 (30%) +CPU_TEMPERATURE_3=50 # → FAN_SPEED_3 (60%) +CPU_TEMPERATURE_4=60 # → FAN_SPEED_4 (80%) + # > 60°C → 100% + +# Sécurité +CPU_TEMPERATURE_THRESHOLD=70 # → Mode Dell par défaut + +# Monitoring +CHECK_INTERVAL=60 # Vérification toutes les 60s +``` + +## 🔧 Dépannage + +### Container ne démarre pas +```bash +# Vérifier la configuration +pct config + +# Logs de démarrage +pct start +journalctl -u pve-container@ -f +``` + +### Service iDRAC ne fonctionne pas +```bash +# Dans le container +pct enter + +# Test IPMI +ipmitool fru +ls -la /dev/ipmi* + +# Logs du service +journalctl -u idrac-fan-controller -f +``` + +### Mise à jour de l'application +```bash +# Le script inclut une fonction de mise à jour +# Relancer le script et choisir "Update" +bash -c "$(wget -qLO - https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/proxmox/idrac-fan-controller.sh)" +``` + +## 🆚 Comparaison des méthodes + +| Méthode | Autonome Proxmox | LXC Manuel | Docker | +|---------|------------------|------------|--------| +| **Complexité** | ⭐ (1 commande) | ⭐⭐⭐ | ⭐⭐ | +| **Configuration** | Auto | Manuel | Semi-auto | +| **Hardware** | Auto-détecté | Manuel | Device mapping | +| **Intégration** | Native Proxmox | Native | Container | +| **Performance** | ⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐ | +| **Maintenance** | ⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐ | + +## 🎨 Fonctionnalités avancées + +### Auto-détection hardware +- Détection automatique des périphériques IPMI +- Configuration optimisée selon le serveur Dell +- Validation des prérequis + +### Monitoring intégré +- Healthcheck automatique +- Logs structurés avec journalctl +- Alertes en cas de problème + +### Interface d'administration +```bash +# Scripts utilitaires créés automatiquement +idrac-setup # Guide de configuration +idrac-status # État du système +idrac-logs # Logs formatés +``` + +## 📈 Avantages du script autonome + +1. **🚀 Déploiement ultra-rapide** - Container opérationnel en < 2 minutes +2. **🔧 Zéro configuration manuelle** - Tout est automatisé +3. **🎯 Optimisé Dell** - Configuration spécifique aux serveurs Dell +4. **🔄 Mise à jour simple** - Un seul script pour tout +5. **📊 Monitoring inclus** - Healthcheck et logs intégrés +6. **🛡️ Sécurisé** - Configuration systemd durcie +7. **📚 Documentation intégrée** - Aide contextuelle incluse + +## 🔗 Liens utiles + +- **Repository**: https://git.benoitsz.com/benoit/iDRAC_fan_controller +- **Issues**: https://git.benoitsz.com/benoit/iDRAC_fan_controller/issues +- **Community Scripts**: https://github.com/community-scripts/ProxmoxVE +- **Dell iDRAC**: Documentation officielle Dell \ No newline at end of file diff --git a/proxmox/container-helpers.sh b/proxmox/container-helpers.sh new file mode 100755 index 0000000..9852a1a --- /dev/null +++ b/proxmox/container-helpers.sh @@ -0,0 +1,264 @@ +#!/bin/bash + +# Helper scripts pour container iDRAC Fan Controller +# Ces scripts sont installés automatiquement dans le container + +# Fonction pour idrac-setup +create_idrac_setup() { + cat > /usr/local/bin/idrac-setup << 'EOF' +#!/bin/bash + +# Helper script pour Dell iDRAC Fan Controller +# Installé automatiquement par le script Proxmox + +# Couleurs +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' + +clear +echo -e "${BLUE}╔══════════════════════════════════════════════════════════════╗" +echo -e "║ Dell iDRAC Fan Controller ║" +echo -e "║ Configuration ║" +echo -e "╚══════════════════════════════════════════════════════════════╝${NC}" +echo + +echo -e "${GREEN}📝 1. Éditer la configuration:${NC}" +echo " nano /opt/idrac-fan-controller/config/environment" +echo + +echo -e "${GREEN}🚀 2. Démarrer le service:${NC}" +echo " systemctl start idrac-fan-controller" +echo + +echo -e "${GREEN}📊 3. Vérifier le statut:${NC}" +echo " systemctl status idrac-fan-controller" +echo + +echo -e "${GREEN}📋 4. Surveiller les logs:${NC}" +echo " journalctl -u idrac-fan-controller -f" +echo + +echo -e "${GREEN}🔍 5. Test de santé:${NC}" +echo " /opt/idrac-fan-controller/healthcheck.sh" +echo + +echo -e "${GREEN}⚙️ 6. Configuration actuelle:${NC}" +if [ -f "/opt/idrac-fan-controller/config/environment" ]; then + echo " Configuration chargée ✅" + source /opt/idrac-fan-controller/config/environment 2>/dev/null + echo " - iDRAC Host: ${IDRAC_HOST:-Non défini}" + echo " - Seuils temp: ${CPU_TEMPERATURE_1:-?}°C → ${CPU_TEMPERATURE_4:-?}°C" + echo " - Vitesses: ${FAN_SPEED_1:-?}% → ${FAN_SPEED_4:-?}%" + echo " - Sécurité: ${CPU_TEMPERATURE_THRESHOLD:-?}°C" +else + echo " ⚠️ Configuration non trouvée" +fi +echo + +echo -e "${GREEN}🔧 7. Commandes utiles:${NC}" +echo " idrac-status # État détaillé" +echo " idrac-logs # Logs formatés" +echo " idrac-config # Éditeur de config" +echo + +# Test IPMI rapide +echo -e "${GREEN}🔌 8. Test IPMI:${NC}" +if command -v ipmitool >/dev/null 2>&1; then + if ipmitool fru >/dev/null 2>&1; then + echo " ✅ IPMI accessible" + else + echo -e " ${RED}❌ IPMI non accessible${NC}" + echo " Vérifiez la configuration hardware Proxmox" + fi +else + echo " ❌ ipmitool non installé" +fi +echo + +echo -e "${YELLOW}💡 Astuce: Utilisez 'systemctl enable idrac-fan-controller' pour activer au démarrage${NC}" +echo +EOF + chmod +x /usr/local/bin/idrac-setup +} + +# Fonction pour idrac-status +create_idrac_status() { + cat > /usr/local/bin/idrac-status << 'EOF' +#!/bin/bash + +# Status helper pour iDRAC Fan Controller + +GREEN='\033[0;32m' +RED='\033[0;31m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' + +echo -e "${BLUE}=== Dell iDRAC Fan Controller - État ===${NC}" +echo + +# Service status +echo -e "${BLUE}📊 Service:${NC}" +if systemctl is-active --quiet idrac-fan-controller; then + echo -e " ✅ ${GREEN}Actif et en fonctionnement${NC}" +else + echo -e " ❌ ${RED}Arrêté ou en erreur${NC}" +fi + +if systemctl is-enabled --quiet idrac-fan-controller; then + echo " 🔄 Activé au démarrage" +else + echo " ⚠️ Non activé au démarrage" +fi +echo + +# Configuration +echo -e "${BLUE}⚙️ Configuration:${NC}" +if [ -f "/opt/idrac-fan-controller/config/environment" ]; then + source /opt/idrac-fan-controller/config/environment + echo " 📁 Fichier: /opt/idrac-fan-controller/config/environment" + echo " 🖥️ iDRAC: $IDRAC_HOST" + echo " 🌡️ Seuils: ${CPU_TEMPERATURE_1}°C, ${CPU_TEMPERATURE_2}°C, ${CPU_TEMPERATURE_3}°C, ${CPU_TEMPERATURE_4}°C" + echo " 💨 Vitesses: ${FAN_SPEED_1}%, ${FAN_SPEED_2}%, ${FAN_SPEED_3}%, ${FAN_SPEED_4}%" + echo " 🚨 Sécurité: ${CPU_TEMPERATURE_THRESHOLD}°C" + echo " ⏱️ Intervalle: ${CHECK_INTERVAL}s" +else + echo -e " ❌ ${RED}Configuration non trouvée${NC}" +fi +echo + +# IPMI Test +echo -e "${BLUE}🔌 Test IPMI:${NC}" +if command -v ipmitool >/dev/null 2>&1; then + if timeout 5 ipmitool fru >/dev/null 2>&1; then + echo -e " ✅ ${GREEN}IPMI accessible${NC}" + + # Get server info + SERVER_INFO=$(ipmitool fru 2>/dev/null | grep -E "Product Name|Product Manufacturer" | head -2) + if [ ! -z "$SERVER_INFO" ]; then + echo " 📋 Serveur détecté:" + echo "$SERVER_INFO" | sed 's/^/ /' + fi + else + echo -e " ❌ ${RED}IPMI non accessible${NC}" + echo " 💡 Vérifiez la configuration Proxmox hardware" + fi +else + echo " ❌ ipmitool non installé" +fi +echo + +# Recent logs +echo -e "${BLUE}📜 Logs récents:${NC}" +if systemctl is-active --quiet idrac-fan-controller; then + journalctl -u idrac-fan-controller -n 5 --no-pager -q 2>/dev/null | sed 's/^/ /' || echo " Aucun log récent" +else + echo " Service non actif" +fi +echo + +# Disk usage +echo -e "${BLUE}💾 Espace disque:${NC}" +df -h /opt/idrac-fan-controller 2>/dev/null | tail -1 | awk '{print " Utilisé: "$3" / "$2" ("$5")"}' +echo + +echo -e "${GREEN}Commandes rapides:${NC}" +echo " systemctl restart idrac-fan-controller # Redémarrer" +echo " journalctl -u idrac-fan-controller -f # Logs temps réel" +echo " nano /opt/idrac-fan-controller/config/environment # Éditer config" +EOF + chmod +x /usr/local/bin/idrac-status +} + +# Fonction pour idrac-logs +create_idrac_logs() { + cat > /usr/local/bin/idrac-logs << 'EOF' +#!/bin/bash + +# Logs helper pour iDRAC Fan Controller + +BLUE='\033[0;34m' +GREEN='\033[0;32m' +NC='\033[0m' + +echo -e "${BLUE}=== Dell iDRAC Fan Controller - Logs ===${NC}" +echo + +if [ "$1" = "-f" ] || [ "$1" = "--follow" ]; then + echo -e "${GREEN}📡 Logs en temps réel (Ctrl+C pour arrêter):${NC}" + echo + journalctl -u idrac-fan-controller -f --no-pager +elif [ "$1" = "-e" ] || [ "$1" = "--errors" ]; then + echo -e "${GREEN}🚨 Erreurs récentes:${NC}" + echo + journalctl -u idrac-fan-controller -p err -n 20 --no-pager +else + echo -e "${GREEN}📋 Logs récents (50 dernières lignes):${NC}" + echo + journalctl -u idrac-fan-controller -n 50 --no-pager + echo + echo -e "${BLUE}Options disponibles:${NC}" + echo " idrac-logs -f # Temps réel" + echo " idrac-logs -e # Erreurs seulement" + echo " idrac-logs # 50 dernières lignes" +fi +EOF + chmod +x /usr/local/bin/idrac-logs +} + +# Fonction pour idrac-config +create_idrac_config() { + cat > /usr/local/bin/idrac-config << 'EOF' +#!/bin/bash + +# Configuration helper pour iDRAC Fan Controller + +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' + +CONFIG_FILE="/opt/idrac-fan-controller/config/environment" + +echo -e "${BLUE}=== Configuration iDRAC Fan Controller ===${NC}" +echo + +if [ ! -f "$CONFIG_FILE" ]; then + echo -e "❌ Fichier de configuration non trouvé: $CONFIG_FILE" + exit 1 +fi + +echo -e "${GREEN}📝 Ouverture de l'éditeur de configuration...${NC}" +echo " Fichier: $CONFIG_FILE" +echo " Éditeur: nano (Ctrl+X pour sauvegarder et quitter)" +echo + +# Backup config before editing +cp "$CONFIG_FILE" "${CONFIG_FILE}.backup.$(date +%Y%m%d-%H%M%S)" + +# Edit config +nano "$CONFIG_FILE" + +echo +echo -e "${GREEN}✅ Configuration sauvegardée.${NC}" +echo +echo -e "${YELLOW}🔄 Redémarrer le service pour appliquer les changements:${NC}" +echo " systemctl restart idrac-fan-controller" +echo +echo -e "${BLUE}💡 Vérifier les logs après redémarrage:${NC}" +echo " idrac-logs -f" +EOF + chmod +x /usr/local/bin/idrac-config +} + +# Exécuter toutes les créations si ce script est appelé directement +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + create_idrac_setup + create_idrac_status + create_idrac_logs + create_idrac_config + echo "✅ Tous les helpers ont été créés avec succès" +fi \ No newline at end of file diff --git a/proxmox/idrac-fan-controller.sh b/proxmox/idrac-fan-controller.sh new file mode 100755 index 0000000..b22e080 --- /dev/null +++ b/proxmox/idrac-fan-controller.sh @@ -0,0 +1,243 @@ +#!/usr/bin/env bash + +# Proxmox VE LXC Container Creation Script for Dell iDRAC Fan Controller +# Compatible with Proxmox community-scripts pattern +# Usage: bash -c "$(wget -qLO - https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/proxmox/idrac-fan-controller.sh)" + +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) + +# Application Information +APP="Dell-iDRAC-Fan-Controller" +var_tags="dell;idrac;fan;cooling;server" +var_cpu="1" +var_ram="512" +var_disk="4" +var_os="ubuntu" +var_version="22.04" +var_unprivileged="0" # Privileged container required for IPMI access + +# Function to display header with ASCII art +function header_info { +clear +cat <<"EOF" + ____ ____ ___ ______ ______ + / _/ ____/ __ \ / | / ____/ / ____/___ _____ + / / / __ / /_/ / / /| | / / / /_ / __ `/ __ \ + _/ / / /_/ / _, _/ / ___ |/ /___ / __/ / /_/ / / / / +/___/ \__,_/_/ |_| /_/ |_|\____/ /_/ \__,_/_/ /_/ + + ____ __ ____ + / __ \____ ____/ /__________ / / /__ _____ + / / / / __ \/ __ / / ___/ __ \/ / / _ \/ ___/ + / /_/ / /_/ / /_/ / / / / /_/ / / / __/ / + \____/\____/\__,_/_/_/ \____/_/_/\___/_/ + +EOF +echo -e "\n ${APP} - Container LXC pour Proxmox VE" +echo -e " Contrôle dynamique des ventilateurs Dell via iDRAC\n" +} + +# Override default variables function +function default_settings() { + clear + header_info + echo -e "${BL}Utilisation des paramètres par défaut pour ${APP}.${CL}" + echo -e "${DGN}Container Type: ${BGN}Privileged${CL}" + echo -e "${DGN}CPU: ${BGN}$var_cpu${CL}" + echo -e "${DGN}RAM: ${BGN}$var_ram MB${CL}" + echo -e "${DGN}Stockage: ${BGN}$var_disk GB${CL}" + echo -e "${DGN}OS: ${BGN}Ubuntu $var_version${CL}" + echo -e "${BL}Création du container...${CL}" +} + +# Application installation function +function install_application() { + header_info + echo "Installation de Dell iDRAC Fan Controller dans le container..." + + # Update container and install dependencies + $STD apt-get update + $STD apt-get upgrade -y + $STD apt-get install -y \ + curl \ + wget \ + ipmitool \ + systemd \ + nano \ + htop \ + ca-certificates + + # Create application directory + mkdir -p /opt/idrac-fan-controller/{config,logs} + + # Download application files + cd /tmp + wget -O idrac-controller.tar.gz "https://git.benoitsz.com/benoit/iDRAC_fan_controller/archive/main.tar.gz" 2>/dev/null || { + echo "Erreur: Impossible de télécharger les fichiers depuis le repository" + exit 1 + } + + tar -xzf idrac-controller.tar.gz + cd iDRAC_fan_controller + + # Install application files + cp Dell_iDRAC_fan_controller.sh /opt/idrac-fan-controller/ + cp functions.sh /opt/idrac-fan-controller/ + cp healthcheck.sh /opt/idrac-fan-controller/ + cp lxc/idrac-fan-controller.service /etc/systemd/system/ + + # Make scripts executable + chmod +x /opt/idrac-fan-controller/*.sh + + # Create default configuration + cat > /opt/idrac-fan-controller/config/environment << 'EOL' +# Configuration Dell iDRAC Fan Controller +# Modifiez ces valeurs selon votre environnement + +# Connexion iDRAC +IDRAC_HOST=local +IDRAC_USERNAME=root +IDRAC_PASSWORD=calvin + +# Seuils de température (°C) +CPU_TEMPERATURE_1=30 +CPU_TEMPERATURE_2=40 +CPU_TEMPERATURE_3=50 +CPU_TEMPERATURE_4=60 + +# Vitesses des ventilateurs (%) +FAN_SPEED_1=10 +FAN_SPEED_2=30 +FAN_SPEED_3=60 +FAN_SPEED_4=80 + +# Seuil de sécurité +CPU_TEMPERATURE_THRESHOLD=70 + +# Intervalles et options +CHECK_INTERVAL=60 +DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE=false +EOL + + # Enable and configure systemd service + systemctl daemon-reload + systemctl enable idrac-fan-controller.service + + # Create helper scripts + wget -O /tmp/container-helpers.sh "https://git.benoitsz.com/benoit/iDRAC_fan_controller/raw/branch/main/proxmox/container-helpers.sh" 2>/dev/null + if [ -f /tmp/container-helpers.sh ]; then + source /tmp/container-helpers.sh + create_idrac_setup + create_idrac_status + create_idrac_logs + create_idrac_config + rm /tmp/container-helpers.sh + else + # Fallback basic setup script + cat > /usr/local/bin/idrac-setup << 'EOL' +#!/bin/bash +echo "=== Dell iDRAC Fan Controller Setup ===" +echo "1. Configuration: nano /opt/idrac-fan-controller/config/environment" +echo "2. Démarrage: systemctl start idrac-fan-controller" +echo "3. Statut: systemctl status idrac-fan-controller" +echo "4. Logs: journalctl -u idrac-fan-controller -f" +echo "5. Test: /opt/idrac-fan-controller/healthcheck.sh" +EOL + chmod +x /usr/local/bin/idrac-setup + fi + + # Cleanup + cd / + rm -rf /tmp/idrac-controller.tar.gz /tmp/iDRAC_fan_controller + + # Set container description + pct set $CTID -description "Dell iDRAC Fan Controller + +Contrôleur dynamique des ventilateurs Dell via iDRAC avec 4 seuils configurables. + +Configuration: /opt/idrac-fan-controller/config/environment +Logs: journalctl -u idrac-fan-controller -f +Setup: idrac-setup + +⚠️ Container PRIVILÉGIÉ requis pour accès IPMI" + +} + +# Post-installation setup +function post_installation() { + header_info + echo -e "${GN}Installation de ${APP} terminée avec succès!${CL}" + echo + echo -e "${BL}Configuration du container:${CL}" + echo -e "Container ID: ${GN}$CTID${CL}" + echo -e "Hostname: ${GN}$NSAPP${CL}" + echo -e "Type: ${YW}Privileged${CL} ${DGN}(requis pour IPMI)${CL}" + echo -e "OS: ${GN}Ubuntu $var_version${CL}" + echo + echo -e "${BL}Prochaines étapes:${CL}" + echo -e "${DGN}1. Connectez-vous au container:${CL} pct enter $CTID" + echo -e "${DGN}2. Lancez la configuration:${CL} idrac-setup" + echo -e "${DGN}3. Éditez la config:${CL} nano /opt/idrac-fan-controller/config/environment" + echo -e "${DGN}4. Démarrez le service:${CL} systemctl start idrac-fan-controller" + echo + echo -e "${YW}⚠️ Important: Configurez l'accès IPMI dans Proxmox:${CL}" + echo -e "${DGN} - Pour iDRAC local: ajoutez l'accès aux périphériques IPMI${CL}" + echo -e "${DGN} - Pour iDRAC distant: configurez l'IP dans environment${CL}" + echo +} + +# Variables and setup +variables +color +catch_errors + +# Application installation +function start() { + if command -v pveversion >/dev/null 2>&1; then + if ! (whiptail --backtitle "Proxmox VE Helper Scripts" --title "${APP} LXC Container" --yesno "Créer un nouveau container LXC ${APP}?" 10 58); then + clear + exit + fi + install_script + else + echo -e "${RD}Ce script doit être exécuté depuis un node Proxmox VE.${CL}" + exit 1 + fi +} + +# Main application function +function update_script() { +header_info +echo -e "\\n ⚡ Mise à jour de ${APP} Container\\n" +NODE=$(hostname) +pct list | tail -n +2 | cut -f1 -d' ' | while read container; do + OSTYPE=$(pct config $container | grep "^ostype:" | cut -d' ' -f2) + if [ "$OSTYPE" = "ubuntu" ]; then + echo -e "${BL}[Info]${GN} Mise à jour du container $container ${CL} \\n" + pct exec $container -- bash -c " + apt update && apt upgrade -y && + systemctl restart idrac-fan-controller 2>/dev/null || + echo 'Service non trouvé dans ce container' + " + echo -e "${BL}[Info]${GN} ✅ Container $container mis à jour ${CL} \\n" + fi +done +} + +# Build the container +start +build_container +description + +# Install application +echo -e " ${CHECKMARK} ${GN}Container LXC créé avec succès${CL}" +echo -e " ${CHECKMARK} ${GN}Installation de ${APP}...${CL}" + +# Execute installation in container +pct exec $CTID -- bash -c "$(declare -f install_application); install_application" || { + echo -e " ${CROSS} ${RD}Erreur lors de l'installation${CL}" + exit 1 +} + +# Post-installation +post_installation \ No newline at end of file