Ajout surveillance Zabbix optionnelle et migration Alpine

- Migration vers Debian Trixie avec surveillance Zabbix optionnelle
- Configure variables d'environnement pour activation conditionnelle
- Met à jour documentation avec instructions Docker complètes
This commit is contained in:
skylanix
2025-08-09 00:32:03 +02:00
parent 3c693a7848
commit 662a6ef34e
6 changed files with 29 additions and 21 deletions

View File

@@ -1,10 +1,10 @@
# Configuration Discord Bot # Configuration Discord Bot
TOKEN=your_discord_bot_token_here TOKEN=votre_token_discord
STATUS=online STATUS=online
INTERVAL=3600 INTERVAL=3600
# Configuration Zabbix (optionnel) # Configuration Zabbix (optionnel)
ENABLE_ZABBIX=false ENABLE_ZABBIX=false
ZABBIX_SERVER=zabbix-server.example.com ZABBIX_SERVER=zabbix-server.example.com
ZABBIX_HOSTNAME=mamie-henrriette-bot ZABBIX_HOSTNAME=MamieHenriette
ZABBIX_PORT=10050 ZABBIX_PORT=10050

View File

@@ -1,8 +1,21 @@
FROM alpine:3.22.1 FROM debian:trixie-slim
WORKDIR /app WORKDIR /app
RUN apk add --no-cache python3 py3-pip zabbix-agent2 ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
python3 \
python3-pip \
python3-venv \
wget \
&& wget https://repo.zabbix.com/zabbix/7.4/release/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.4+debian12_all.deb \
&& dpkg -i zabbix-release_latest_7.4+debian12_all.deb \
&& apt-get update \
&& apt-get install -y --no-install-recommends zabbix-agent2 \
&& rm -rf /var/lib/apt/lists/* \
&& rm zabbix-release_latest_7.4+debian12_all.deb
COPY requirements.txt . COPY requirements.txt .
COPY bot.py . COPY bot.py .

View File

@@ -1,9 +1,9 @@
# 👵 Mamie Henrriette - Discord Status Bot 🤖 # 👵 Mamie Henriette - Discord Status Bot 🤖
## 📖 Description ## 📖 Description
Mamie Henrriette est un bot Discord intelligent qui change automatiquement de statut, surveillant et gérant votre serveur avec une touche d'humour et de caractère. Mamie Henriette est un bot Discord intelligent qui change automatiquement de statut, surveillant et gérant votre serveur avec une touche d'humour et de caractère.
## ✨ Fonctionnalités ## ✨ Fonctionnalités
@@ -89,7 +89,7 @@ Dans votre fichier `.env` :
```bash ```bash
ENABLE_ZABBIX=true ENABLE_ZABBIX=true
ZABBIX_SERVER=votre-serveur-zabbix.com ZABBIX_SERVER=votre-serveur-zabbix.com
ZABBIX_HOSTNAME=mamie-henrriette-bot ZABBIX_HOSTNAME=MamieHenriette
``` ```
### Fichier `statuts.txt` ### Fichier `statuts.txt`

Binary file not shown.

View File

@@ -1,18 +1,16 @@
services: services:
discord-bot: discord-bot:
container_name: MamieHenrriette container_name: MamieHenriette
build: . build: .
restart: on-failure restart: on-failure
environment: environment:
- TOKEN=your token - TOKEN=VOTRE_TOKEN_DISCORD_ICI
- STATUS=online - STATUS=online
- INTERVAL=3600 - INTERVAL=3600
- ENABLE_ZABBIX=${ENABLE_ZABBIX:-false} - ENABLE_ZABBIX=false
- ZABBIX_SERVER=${ZABBIX_SERVER:-zabbix-server.example.com} - ZABBIX_SERVER=zabbix-server.example.com
- ZABBIX_HOSTNAME=${ZABBIX_HOSTNAME:-mamie-henrriette-bot} - ZABBIX_HOSTNAME=mamie-henriette-bot
volumes: volumes:
- ./statuts.txt:/app/statuts.txt - ./statuts.txt:/app/statuts.txt
ports: # ports:
- "${ZABBIX_PORT:-10050}:10050" # - "10050:10050" # Décommentez si ENABLE_ZABBIX=true
profiles:
- default

View File

@@ -5,7 +5,7 @@ Server=zabbix-server.example.com
ServerActive=zabbix-server.example.com:10051 ServerActive=zabbix-server.example.com:10051
# Configuration de l'agent # Configuration de l'agent
Hostname=mamie-henrriette-bot Hostname=MamieHenriette
ListenPort=10050 ListenPort=10050
ListenIP=0.0.0.0 ListenIP=0.0.0.0
@@ -24,7 +24,4 @@ UserParameter=discord.bot.memory,ps -o pid,vsz,rss,comm -p $(pgrep -f bot.py) |
# Surveillance des logs # Surveillance des logs
UserParameter=discord.bot.errors,grep -c "ERROR" /var/log/discord-bot.log 2>/dev/null || echo 0 UserParameter=discord.bot.errors,grep -c "ERROR" /var/log/discord-bot.log 2>/dev/null || echo 0
UserParameter=discord.bot.warnings,grep -c "WARNING" /var/log/discord-bot.log 2>/dev/null || echo 0 UserParameter=discord.bot.warnings,grep -c "WARNING" /var/log/discord-bot.log 2>/dev/null || echo 0
# Vérification de la connectivité Discord
UserParameter=discord.connectivity,timeout 5 curl -s https://discord.com/api/v10/gateway >/dev/null && echo 1 || echo 0