Monitoring & Health Checks
Health Check Endpoint
Section titled “Health Check Endpoint”The bot provides a monitoring endpoint on the configured port.
curl http://your-bot:8080/healthcheckResponse
Section titled “Response”Healthy (200 OK):
{ "status": "ok", "version": "3.4.2", "commit": "abc123", "buildDate": "2024-11-10"}Error (500 Error):
{ "status": "error", "message": "database connection failed"}What Gets Checked
Section titled “What Gets Checked”- Database - PostgreSQL connectivity
- Remnawave Panel - API availability
- Bot Service - Process running
- API Key - Credentials valid
Monitoring Setup
Section titled “Monitoring Setup”Docker Compose Health Check
Section titled “Docker Compose Health Check”Already configured in docker-compose.yaml:
healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/healthcheck"] interval: 30s timeout: 10s retries: 3Manual Monitoring
Section titled “Manual Monitoring”Check status regularly:
# Check nowcurl -s http://localhost:8080/healthcheck | jq
# Check every minutewatch -n 60 'curl -s http://localhost:8080/healthcheck | jq'
# Log resultswhile true; do echo "$(date): $(curl -s http://localhost:8080/healthcheck)" sleep 60done >> /var/log/bot-health.logExternal Monitoring
Section titled “External Monitoring”Uptime Robot (recommended):
- Go to uptimerobot.com
- Add HTTP monitor
- URL:
https://bot.example.com/healthcheck - Interval: 5 minutes
- Get alerts on failures
Grafana + Prometheus:
- Scrape endpoint every 30s
- Create dashboards
- Set up alerts
Logs & Debugging
Section titled “Logs & Debugging”View Logs
Section titled “View Logs”# Current logsdocker compose logs remnawave-telegram-shop-bot
# Follow logs (live)docker compose logs -f remnawave-telegram-shop-bot
# Last N linesdocker compose logs --tail 100 remnawave-telegram-shop-bot
# Specific time rangedocker compose logs --since 2024-11-10T10:00:00 --until 2024-11-10T11:00:00 remnawave-telegram-shop-botDatabase Logs
Section titled “Database Logs”docker compose logs -f postgresFilter Logs
Section titled “Filter Logs”# Errors onlydocker compose logs remnawave-telegram-shop-bot | grep ERROR
# Payment relateddocker compose logs remnawave-telegram-shop-bot | grep -i payment
# Specific userdocker compose logs remnawave-telegram-shop-bot | grep "user_id:123456789"