105 lines
2.3 KiB
Markdown
105 lines
2.3 KiB
Markdown
# Uptime.bot - Rocket.Chat Bot voor Uptime Kuma
|
|
|
|
Een Rocket.Chat bot die altijd online is en helpt met monitoring via Uptime Kuma.
|
|
|
|
## Features
|
|
|
|
- ✅ Altijd online
|
|
- 🤖 Reageert op commando's
|
|
- 📊 Geeft status updates
|
|
- 🔔 Kan notificaties doorsturen
|
|
|
|
## Commando's
|
|
|
|
- `!help` - Toon help informatie
|
|
- `!ping` - Check of bot online is
|
|
- `!status` - Toon monitoring status
|
|
- `!uptime` - Toon bot uptime
|
|
|
|
## Setup
|
|
|
|
### Stap 1: Bot account aanmaken in Rocket.Chat
|
|
|
|
1. Log in als admin in Rocket.Chat
|
|
2. Ga naar **Administration** → **Users**
|
|
3. Klik op **New** (of **+**)
|
|
4. Vul in:
|
|
- **Name:** Uptime Bot
|
|
- **Username:** uptime.bot
|
|
- **Email:** uptime.bot@jouwdomein.nl
|
|
- **Password:** Kies een sterk wachtwoord
|
|
- **Roles:** Selecteer `bot`
|
|
5. Klik op **Save**
|
|
|
|
### Stap 2: Configuratie
|
|
|
|
1. Kopieer `.env.example` naar `.env`:
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
2. Pas `.env` aan met jouw instellingen:
|
|
```env
|
|
ROCKETCHAT_URL=jouw-rocketchat.com:3000
|
|
ROCKETCHAT_USE_SSL=true
|
|
BOT_USERNAME=uptime.bot
|
|
BOT_PASSWORD=jouw-bot-wachtwoord
|
|
UPTIME_KUMA_URL=http://uptime-kuma:3001
|
|
```
|
|
|
|
### Stap 3: Bot starten
|
|
|
|
**Met Docker Compose:**
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
**Met npm (lokaal testen):**
|
|
```bash
|
|
npm install
|
|
npm start
|
|
```
|
|
|
|
### Stap 4: Bot uitnodigen in kanaal
|
|
|
|
1. Ga naar het kanaal waar je de bot wilt
|
|
2. Type: `/invite @uptime.bot`
|
|
3. Test met: `!ping`
|
|
|
|
## Portainer Setup
|
|
|
|
Als je Portainer gebruikt:
|
|
|
|
1. Upload deze bestanden naar je GitHub repo in een `uptime-bot` folder
|
|
2. Maak een nieuwe Stack in Portainer:
|
|
- Name: `uptime-bot`
|
|
- Build method: **Repository**
|
|
- Repository URL: `https://github.com/MisticDruid/mijn-docker-stacks`
|
|
- Compose path: `uptime-bot/docker-compose.yml`
|
|
3. Voeg environment variabelen toe in Portainer
|
|
4. Deploy!
|
|
|
|
## Troubleshooting
|
|
|
|
**Bot komt niet online:**
|
|
- Check of het bot account bestaat in Rocket.Chat
|
|
- Controleer username en password in `.env`
|
|
- Check de logs: `docker-compose logs -f`
|
|
|
|
**Bot reageert niet:**
|
|
- Zorg dat de bot is uitgenodigd in het kanaal
|
|
- Type `!ping` om te testen
|
|
- Check of bot de `bot` role heeft in Rocket.Chat
|
|
|
|
## Aanpassingen
|
|
|
|
Je kunt extra commando's toevoegen in `bot.js` in de `handleCommand` functie.
|
|
|
|
Bijvoorbeeld een custom commando:
|
|
```javascript
|
|
if (text === '!mijncommando') {
|
|
await sendMessage(roomId, 'Dit is mijn custom response!');
|
|
return;
|
|
}
|
|
```
|