Skip to content

Monitors the status of your servers and sends notifications to Telegram if the server is unavailable

License

Notifications You must be signed in to change notification settings

Romancha/server-healthcheck-telegram-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server Health Check Telegram Bot

GitHub release (with filter) GitHub Release Date - Published_At License

Introduction

The Server Health Check Telegram Bot monitors the status of your servers and sends notifications to Telegram if the server is unavailable.

Bot sends requests to the servers and checks the response code. If the response code is not 200, the bot sends a message to the specified chat.

Installation and Usage

Docker

To run from Docker, you need to do the following:

  1. Install Docker and Docker Compose.
  2. Create your bot and get a token from @BotFather.
  3. Get chat_id from @userinfobot.
  4. Set mandatory env docker-compose.yml: TELEGRAM_TOKEN, TELEGRAM_CHAT and args super.
    version: '2'
    services:
    server-healthcheck:
    image: ghcr.io/romancha/server-healthcheck:latest
    hostname: server-healthcheck
    restart: always
    container_name: server-healthcheck
    environment:
    - TELEGRAM_TOKEN=
    - TELEGRAM_CHAT=
    volumes:
    - ./data:/data
    command: /go/bin/app --super=youTelegramUser --super=youTelegramUser2
  5. Configure the volumes in docker-compose.yml to persist servers list.
  6. Run command docker-compose up -d.

From source

You can also run the bot from source code, build Go binary and run it.

Configuration

Param Description
TELEGRAM_TOKEN Telegram bot token, take from @BotFather
TELEGRAM_CHAT Chat ID where the bot will send messages. @userinfobot Can help to get chat id
ALERT_THRESHOLD The number of failed requests after which the bot will send a notification. Default 3
CHECKS_CRON Cron with seconds to checks server status. Default */30 * * * * *
DEBUG Enable debug mode. Default false

Commands

Command Description
/add [url] [name] Add server to monitor. For example: /add github.com github
/remove [name] Remove server from monitor. For example: /remove github
/removeAll Remove all servers from monitor
/list Show list of monitored servers

Contributing

We welcome contributions to improve this project.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

Monitors the status of your servers and sends notifications to Telegram if the server is unavailable

Topics

Resources

License

Stars

Watchers

Forks

Packages