diff --git a/.env.example b/.env.example index c943d44..36cd4eb 100644 --- a/.env.example +++ b/.env.example @@ -1,10 +1,10 @@ # Configuration Discord Bot -TOKEN=your_discord_bot_token_here +TOKEN=votre_token_discord STATUS=online INTERVAL=3600 # Configuration Zabbix (optionnel) ENABLE_ZABBIX=false ZABBIX_SERVER=zabbix-server.example.com -ZABBIX_HOSTNAME=mamie-henrriette-bot +ZABBIX_HOSTNAME=MamieHenriette ZABBIX_PORT=10050 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 78bf22b..b72b160 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,21 @@ -FROM alpine:3.22.1 +FROM debian:trixie-slim 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 bot.py . diff --git a/README.md b/README.md index 1da58b9..f43c289 100755 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# 👵 Mamie Henrriette - Discord Status Bot 🤖 +# 👵 Mamie Henriette - Discord Status Bot 🤖 ## 📖 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 @@ -89,7 +89,7 @@ Dans votre fichier `.env` : ```bash ENABLE_ZABBIX=true ZABBIX_SERVER=votre-serveur-zabbix.com -ZABBIX_HOSTNAME=mamie-henrriette-bot +ZABBIX_HOSTNAME=MamieHenriette ``` ### Fichier `statuts.txt` diff --git a/__pycache__/bot.cpython-313.pyc b/__pycache__/bot.cpython-313.pyc new file mode 100644 index 0000000..9fd9ce4 Binary files /dev/null and b/__pycache__/bot.cpython-313.pyc differ diff --git a/docker-compose.yml b/docker-compose.yml index 1c54d54..f6f46a0 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,16 @@ services: discord-bot: - container_name: MamieHenrriette + container_name: MamieHenriette build: . restart: on-failure environment: - - TOKEN=your token + - TOKEN=VOTRE_TOKEN_DISCORD_ICI - STATUS=online - INTERVAL=3600 - - ENABLE_ZABBIX=${ENABLE_ZABBIX:-false} - - ZABBIX_SERVER=${ZABBIX_SERVER:-zabbix-server.example.com} - - ZABBIX_HOSTNAME=${ZABBIX_HOSTNAME:-mamie-henrriette-bot} + - ENABLE_ZABBIX=false + - ZABBIX_SERVER=zabbix-server.example.com + - ZABBIX_HOSTNAME=mamie-henriette-bot volumes: - ./statuts.txt:/app/statuts.txt - ports: - - "${ZABBIX_PORT:-10050}:10050" - profiles: - - default \ No newline at end of file + # ports: + # - "10050:10050" # Décommentez si ENABLE_ZABBIX=true \ No newline at end of file diff --git a/zabbix_agent2.conf b/zabbix_agent2.conf index 5cf04b4..4b6cfbe 100644 --- a/zabbix_agent2.conf +++ b/zabbix_agent2.conf @@ -5,7 +5,7 @@ Server=zabbix-server.example.com ServerActive=zabbix-server.example.com:10051 # Configuration de l'agent -Hostname=mamie-henrriette-bot +Hostname=MamieHenriette ListenPort=10050 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 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 - -# 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 \ No newline at end of file +UserParameter=discord.bot.warnings,grep -c "WARNING" /var/log/discord-bot.log 2>/dev/null || echo 0 \ No newline at end of file